LEA in x86 assembly

This question already has an answer here:

  • What's the purpose of the LEA instruction? 14 answers

  • Basically

    mov eax, [esp+0x18]
    

    means

    mov eax, esp
    add eax, 0x18
    mov eax, [eax]
    

    and in C that would look like

    eax = *(unsigned int*)(esp + 0x18)
    

    Meanwhile

    lea eax, [esp+0x18]
    

    means

    mov eax, esp
    add eax, 0x18
    

    and in C that would look like

    eax = esp + 0x18
    

    It stores esp + 0x18 in eax . In other words, it's just addition. LEA is frequently used to perform basic arithmetic.

    链接地址: http://www.djcxy.com/p/72372.html

    上一篇: 汇编寄存器算术?

    下一篇: 在x86程序集中的LEA