movzbl(%rdi, %rcx, 1), %ecx 在 x86-64 汇编中是什么意思? [英] what does movzbl(%rdi, %rcx, 1), %ecx mean in x86-64 assembly?

查看:72
本文介绍了movzbl(%rdi, %rcx, 1), %ecx 在 x86-64 汇编中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我明白

movzbl (%rdi, %rcx, 1) , %ecx

表示将零扩展字节移动到长",并表示将 ecx 扩展为 32 位,但我不完全确定语法 (%rdi, %rcx, 1) 指的是什么.

means "move zero-extended byte to long" and is saying to extend ecx into 32 bits, but I'm not entirely sure what the syntax (%rdi, %rcx, 1) refers to.

我在某处看到该语法指的是

I've seen somewhere that that syntax refers to

(Base, Index, Scale)

但我找不到任何能准确说明这意味着什么的资源.我猜这意味着将 (%rdi, %rcx, 1) 中的任何信息移动到 %ecx 以便

but I can't find any resources that say what that means exactly. I'm guessing it means to move whatever info is at (%rdi, %rcx, 1) to %ecx so that

(long) %ecx = (%rdi, %rcx, 1)

但是我怎么知道那是什么位置呢?是否需要某种算术来查找地址或其他内容?

but how do I figure out what location that is? is there some sort of arithmetic involved to find an address or something?

ecx 不是已经隐式 32 位了吗?为什么需要扩展到 32 位?

also isn't ecx implicitly 32 bits already? Why would it need to be extended into 32 bits?

编辑以澄清:

我知道语法 (%rdi, %rcx, 1) 意味着我必须将这三件事加在一起,但我不明白这会产生什么答案.

I understand that the syntax (%rdi, %rcx, 1) means that I have to add those three things together, but I don't understand how that results in an answer.

我要添加什么,寄存器的内容?寄存器地址?如果是地址,我如何找出地址并将其添加在一起?

What am I adding, the contents of the registers? The address of the register? If it's the address, how do I figure out what the address is and add it together?

我在网上找到的只是告诉我语法的含义,而不是如何在示例中使用它.

All I'm finding online is telling me what the syntax means but not how to use it with examples.

推荐答案

引用intel基础架构手册:

To quote the intel basic architecture manual:

3.7.5 指定偏移量 内存地址的偏移量部分可以直接指定为静态值(称为位移)或通过地址计算组成以下一项或多项组成部分:

3.7.5 Specifying an Offset The offset part of a memory address can be specified directly as a static value (called a displacement) or through an address computation made up of one or more of the following components:

  • 位移 -- 8 位、16 位或 32 位值.
  • Base -- 通用寄存器中的值.
  • 索引——通用寄存器中的值.
  • 比例因子 -- 乘以索引的 2、4 或 8 值价值.

添加这些组件所产生的偏移量称为有效地址.

The offset which results from adding these components is called an effective address.

注意它说通用寄存器中的".由于寄存器不是 x86 上内存地址空间的一部分,它们甚至没有地址,因此您唯一可以使用的就是它们中的值.

Notice it says "the value in a general-purpose register". As registers are not part of the memory address space on x86, they don't even have an address, so the only thing you can possibly use is the value in them.

至于movzbl:它指示cpu从内存中获取一个字节,并将其零扩展为32位.

As for the movzbl: it instructs the cpu to fetch a byte from memory, and zero extend it to 32 bits.

这篇关于movzbl(%rdi, %rcx, 1), %ecx 在 x86-64 汇编中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆