1

Here are two lines of assembly code

mov  0xc(%ebp), %eax
lea  0x14(%eax), %edx

I know the first line is the same as the following in pseudo code

%eax = 0xc(%ebp)

and it's make %eax equal to the second parameter. But what is the second line trying to do?

Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
KenKenKen
  • 467
  • 1
  • 5
  • 18
  • That's just a sneaky `add`; `edx = eax + 0x14` – harold Nov 29 '14 at 20:10
  • @harold Is this accessing the value at the address of (eax + 14) – KenKenKen Nov 29 '14 at 20:15
  • No. `lea` just does a bunch of math, it doesn't access any memory. – harold Nov 29 '14 at 20:16
  • See https://stackoverflow.com/questions/1658294/whats-the-purpose-of-the-lea-instruction for details. – stephan Nov 29 '14 at 20:17
  • 3
    possible duplicate of [What does lea 0xY(%esp), %esi do?](http://stackoverflow.com/questions/23869183/what-does-lea-0xyesp-esi-do) – nrz Nov 29 '14 at 21:06
  • Possible duplicate of [What's the purpose of the LEA instruction?](https://stackoverflow.com/questions/1658294/whats-the-purpose-of-the-lea-instruction) – phuclv Apr 16 '18 at 06:51

0 Answers0