assembly - movzbl(%rdi, %rcx, 1), %ecx 在 x86-64 汇编中是什么意思?

标签 assembly x86 64-bit x86-64

我想我明白

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

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

我在某处看到该语法指的是
(Base, Index, Scale)

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

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

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

编辑澄清:

我知道语法 (%rdi, %rcx, 1) 意味着我必须将这三件事加在一起,但我不明白这是如何产生答案的。

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

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

最佳答案

引用英特尔基本架构手册:

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:

  • Displacement -- An 8-, 16-, or 32-bit value.
  • Base -- The value in a general-purpose register.
  • Index -- The value in a general-purpose register.
  • Scale factor -- A value of 2, 4, or 8 that is multiplied by the index value.

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



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

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

关于assembly - movzbl(%rdi, %rcx, 1), %ecx 在 x86-64 汇编中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33453239/

相关文章:

assembly - 如何将用户输入的16位数字转换为十进制

c - 内联汇编中 jmp 的地址错误

c++ - 如何检测 Visual C++ 中的 rdtscp 支持?

c++ - VC++,x86上的/volatile:ms

64-bit - x64 位平台无法识别 dllexport

c - 写入系统调用参数寄存器

汇编 x86 除法 fpoint 异常

c++ - x86 MASM - 传递和访问二维数组

.net - 如何在命令行中运行Photoviewer.dll

android - 如何检查 react-native 库的 64 位兼容性