6

Im dissasembling something for a project, and I encountered with the following line

jmp *0x80498c0(,%eax,4)

What exactly is that jump instruction trying to do? This is in a gdb environment.

Thanks

leonsas
  • 4,718
  • 6
  • 43
  • 70

2 Answers2

10

This is an indirect jump.

The instruction calculates the location [0x80498c0 + eax*4], loads the value stored there and jumps to the address stored at this location.

This kind of code is quite common seen in jumptables, often after a C switch instruction or equivalent.

Edit: The * is specific to the AT&T syntax. It's a mnemonic for dereference, like in C. It is needed in the case the part in the braces is missing - jmp 0x80498c0 would just jump to this address, where jmp *0x80498c0 jumps to the target of the pointer stored in 0x80498c0.

Gunther Piez
  • 29,760
  • 6
  • 71
  • 103
3

see the Referencing memory: section here
A 32-bit addressing can be seen as follows (AT&T format)

immed32(basepointer,indexpointer,indexscale)

This is translated as the value at address given by

immed32 + basepointer + indexpointer * indexscale

For example, to address a[i] where "a" is an array of integers, you could write

(%eax, %ebx, 4)

such that eax register holds the base pointer of a and ebx has the index i.

ango
  • 829
  • 2
  • 10
  • 23
  • 1
    [Bare links are not real answers.](http://meta.stackexchange.com/a/8259/102937) Can you summarize the portion of the page that you linked to that applies to the OP's question, in your answer here? – Robert Harvey Apr 18 '12 at 02:19
  • I kind of understand now, but what does the asterisk ( * ) before the Immediate value means? – leonsas Apr 18 '12 at 02:28