x64 Reverse Engineering (Part 15 - SHR Instruction)

x64 Reverse Engineering (Part 15 - SHR Instruction)

For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial

The SHR command stands for shift right.

Let’s assume the register al holds 00010100b which is an 8-bit binary value. Let’s assume the instruction is shr al, 2. Below is what transpires as we see the values move two bits to the left.

 00010100

   00010100

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

00000101

Next week we will dive into ROL! Stay tuned!

A M.

Director of ... <All things AntiTamper>

6 年

Additionally, the CF has no effect on shr/shl instructions... but sar/sal do. The direct shifts are exactly that. But the cf other than being set or cleared has no effect on the value... C example: Unsigned int (notice UNSIGNED!!) foo=0x80000004; (I’m assuming that this is a 32bit int..) ... foo = foo >> 4; Foo is now 0x08000000 even though the high bit was set .. as the compiler will use shr not sar on an unsigned word....

回复
A M.

Director of ... <All things AntiTamper>

6 年

And it’s the lsb that was shifted that goes into the CF... not the msb on a shr operation

回复
A M.

Director of ... <All things AntiTamper>

6 年

Umm.. the new value is 00000101

回复

要查看或添加评论,请登录

Kevin Thomas的更多文章

社区洞察

其他会员也浏览了