Assembly (,% eax, 4)

If one of my teams says:

jmp *0x804a180(,%eax,4) 

what does it mean? I ask specifically, because there is no value before the first comma, and I do not know exactly what * means before the address.

+4
source share
1 answer

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

* Used in AT & T syntax to indicate indirect jumps and calls. It basically means "go to the place indicated here, not the meaning of it." It is useful to distinguish between the following instructions:

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

As for the null value, it is treated as 0. The full form of the AT & T offset(%base, %index, multiplier) , but any of these values ​​can be omitted. The default value for each, except for the multiplier (default is 1), is 0. In most cases, you can just leave them, but if you have an index and no base, you need a comma so that the assembler can determine what it is.

+8
source

Source: https://habr.com/ru/post/1440832/


All Articles