我正在学习x86程序集,并且对lea指令有一些麻烦。
0x080486f7 <+21>: lea eax,[esp+0x18]
有人能解释一下这行会发生什么吗?根据我的理解,它取[esp + 0x18]的值并将该值解释为地址,并将地址中的int值放入eax。
答案 0 :(得分:3)
基本上
mov eax, [esp+0x18]
装置
mov eax, esp
add eax, 0x18
mov eax, [eax]
并且在C中看起来像
eax = *(unsigned int*)(esp + 0x18)
同时
lea eax, [esp+0x18]
装置
mov eax, esp
add eax, 0x18
并且在C中看起来像
eax = esp + 0x18
答案 1 :(得分:0)
它将esp + 0x18
存储在eax
中。换句话说,它只是添加。 LEA经常用于执行基本算术。