Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly (,%eax,4)

If one of my command lines says:

jmp   *0x804a180(,%eax,4)

what does that mean? I ask specifically because there is no value before the first comma and I'm not sure exactly what the * before the address means.

like image 566
arc Avatar asked Feb 19 '23 19:02

arc


1 Answers

This instruction jumps to the location whose value is located at the address calculated as %eax * 4 + 0x804a180.

The * is used in AT&T syntax to indicate indirect jumps and calls. It basically means "jump to the location pointed to by this, instead of the value of this". It is useful to differentiate the following instructions:

jmp myAddress  # Jumps to the location myAddress
jmp *myPointer # Jumps to the location contained at myPointer

As for the empty value, it is treated as 0. The full form of AT&T addressing is offset(%base, %index, multiplier), but any of these values can be left out. The default for each, except the multiplier (defaults to 1), is 0. Most of the time, you can just leave them out, but if you have an index and no base you need the comma there so that the assembler can tell which it is.

like image 67
ughoavgfhw Avatar answered Feb 28 '23 05:02

ughoavgfhw