Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

x86

assembly

att

What does lea 0x4(%esp),%ecx mean in at&t assembly?

What really is 0x4(%esp)?

like image 845
Luis Avatar asked Nov 04 '25 16:11

Luis


2 Answers

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.

like image 94
zneak Avatar answered Nov 06 '25 06:11

zneak


lea ecx,[esp+4]
like image 38
Jens Björnhager Avatar answered Nov 06 '25 05:11

Jens Björnhager



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!