x86 lea instruction

佐手、 提交于 2019-12-22 14:44:03

问题


I am trying to get a good grip on the LEA instruction in x86:

leal (%edx, %edx, 4), %eax
leal (%edx, %edx, 2), %eax

Given these two lines, i know that:

eax = edx + edx*4

and then

eax = edx + edx*2

Two questions. First, if these instructions appear in sequence as in this example, the eax register is overwritten once the second line executes? And what exactly would be loaded into the register? Another address? Or is this doing arithmetic on the values that these registers point to?


回答1:


if these instructions appear in sequence as in this example, the eax register is overwritten once the second line executes?

Yes (it is overwritten after both instructions)

And what exactly would be loaded into the register? Another address?

The memory address described by EDX + the offset stored as value in EDX multiplied by 2



来源:https://stackoverflow.com/questions/9154330/x86-lea-instruction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!