Arush Agarampur
Arush Agarampur

Reputation: 1420

How do the hex numbers after a jump instruction translate into a memory address?

I have this in my code disassembly: image of disassembly

I see the jump instruction code E9, but how the numbers after E9 translate into the memory address shown?

Upvotes: 1

Views: 638

Answers (1)

prl
prl

Reputation: 12432

The bytes in the instruction are an offset that are added to the address of the next instruction to get the destination address.

7ffbdba881c5 + 2ab125ff = 7ffc0659a7c4

Additional information about the encoding of jumps

Near jumps with the destination in the instruction are always encoded with an signed offset relative to the address of the next instruction. In 32 or 64 bit mode, the offset can be 8 or 32 bits. (In 16 bit mode it can be 8 or 16 bits. Near jumps with an 8-bit offset are also called short jumps.) Indirect near jumps have the destination address in a register or memory location; the destination is absolute (the value to be loaded into [ER]IP).

Far jumps can have the destination either in the instruction or in a memory location; the destination has both the CS and [ER]IP values.

For more details, see an x86 instruction reference, such as the Intel SDM, Volume 2. https://software.intel.com/en-us/articles/intel-sdm

Upvotes: 3

Related Questions