Assembly (,%eax,4)

喜你入骨 提交于 2019-12-04 03:40:07

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/12978560/assembly-eax-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!