开发者

What does lea 0x4(%esp),%ecx mean in AT&T syntax?

开发者 https://www.devze.com 2023-01-12 00:49 出处:网络
What does lea 0x4(%esp),%ecx mean in开发者_如何转开发 at&t assembly? What really is 0x4(%esp)?It\'s %esp + 0x4.

What does lea 0x4(%esp),%ecx mean in开发者_如何转开发 at&t assembly?

What really is 0x4(%esp)?


It's %esp + 0x4.

LEA stands for Load Effective Address. It's, in this case, a simple addition, as shown above. Typically people and compilers don't really use it anymore because CPUs now ship with a nifty address generation unit (otherwise called AGU), which lets you use all kinds of fancy arithmetics to compute addresses from registers and values. In short, whatever you did with lea, you can now embed it inside any other instruction.


lea ecx,[esp+4]


esp is the stack pointer. 0x4 is the offset. AT&T syntax has the command source, destination and the command here is LEA which is "Load Effective Address."

So we're telling the CPU to load the address "stack pointer + 4" into the register "ecx"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号