x86 lea指令

发布于 2025-01-02 22:25:30 字数 319 浏览 3 评论 0原文

我试图很好地掌握 x86 中的 LEA 指令:

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

鉴于这两行,我知道:

eax = edx + edx*4

然后

eax = edx + edx*2 两个问题

。首先,如果这些指令像本例中那样按顺序出现,那么一旦第二行执行,eax寄存器就会被覆盖吗?到底什么会被加载到寄存器中?另一个地址?或者这是对这些寄存器指向的值进行算术运算?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝礼 2025-01-09 22:25:30

如果这些指令如本例所示按顺序出现,则 eax
一旦第二行执行,寄存器就被覆盖?

是(两条指令后都会被覆盖)

到底什么会被加载到寄存器中?另一个地址?

EDX 描述的内存地址 + EDX 中存储为值的偏移量乘以 2

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文