user2167566
user2167566

Reputation: 3

Not sure which address jmp is jumping to

Hi I am just beginning to learn assembly and I've been looking over some code and I know that the jmp function is an unconditional jump, but I am unsure how to tell where this jmp is jumping to.

jmp    *0x804a1a0(,%eax,4)

I know that the "(,%eax,4)" part means the value stored in eax*4, and that it's going to involve adding that to something else to get the final value of where it's going to jump to,but I do not know how to handle the "*" in the *0x804a1a0 part.
Does this mean the value stored at the memory address "0x804a1a0" + eax*4 (and that this in hex is the point I should be jumping to)?

Upvotes: 0

Views: 248

Answers (1)

Leeor
Leeor

Reputation: 19706

This is just a matter of notation in AT&T assembly. See - https://sourceware.org/binutils/docs/as/i386_002dVariations.html

AT&T absolute (as opposed to PC relative) jump/call operands are prefixed by `*'; they are undelimited in Intel syntax.

So your calculation is correct, the jump target is stored in [0x804a1a0 + eax*4], this is most likely a jump table that starts at 0x804a1a0, and the compiler was using eax as an index.

Upvotes: 1

Related Questions