为什么 x86 寄存器如此命名?

发布于 2024-07-21 00:36:34 字数 133 浏览 2 评论 0原文

例如,累加器被命名为EAX,而指令指针被命名为IP。 我还知道有一些字节称为 CLDH。 我知道所有的名字一定有一个约定,但是它是什么呢?

For example, the accumulator is named EAX and, while the instruction pointer is called IP. I also know that there are bytes called CL and DH. I know there must be a convention to all of the names, but what is it?

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

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

发布评论

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

评论(5

顾忌 2024-07-28 00:36:34

以下是每个 x86 通用寄存器代表含义的简要说明:

  • EAX:“扩展累加器” - 用于算术和逻辑运算,以及存储函数的返回值。
  • EBX:“扩展基址”——通常用作指向内存数据段中数据的指针。
  • ECX:“扩展计数器”——通常用于循环和字符串操作,以及存储函数参数。
  • EDX:“扩展数据”——通常用于 I/O 操作和存储函数参数。
  • ESI:“扩展源索引”——通常在字符串操作中用作指向源操作数的指针。
  • EDI:“扩展目标索引” - 通常用作字符串操作中指向目标操作数的指针。
  • EBP:“扩展基址指针”——通常用作指向当前堆栈帧基址的指针。
  • ESP:“扩展堆栈指针”——通常用作指向当前堆栈帧顶部的指针。

The following is a brief explanation of what each of the x86 general-purpose registers stands for:

  • EAX: "Extended Accumulator" - used for arithmetic and logical operations, as well as for storing return values from functions.
  • EBX: "Extended Base" - often used as a pointer to data in the data segment of memory.
  • ECX: "Extended Counter" - often used for loop and string operations, as well as for storing function arguments.
  • EDX: "Extended Data" - often used for I/O operations and for storing function arguments.
  • ESI: "Extended Source Index" - often used as a pointer to a source operand in string operations.
  • EDI: "Extended Destination Index" - often used as a pointer to a destination operand in string operations.
  • EBP: "Extended Base Pointer" - often used as a pointer to the base of the current stack frame.
  • ESP: "Extended Stack Pointer" - often used as a pointer to the top of the current stack frame.
寂寞美少年 2024-07-28 00:36:34

较旧的处理器具有名为 A、B 等(按字母顺序排列)的累加器。 当 16 位和后来的 32 位累加器开发出来时,工程师分别添加了 X (extending) 和 E (extished)。
所以这都是关于历史的,就像 C 语言的名字一样,因为它是从 B 语言(贝尔实验室)发展而来的。

该约定只是内部的,以跟上他们已经熟悉的名称。

Older processors have accumulators named A, B, etc (alphabetically ordered). When 16-bit and later 32-bit accumulators got developed, engineers added an X (extended) and an E (extended) respectively.
So it's all about history, just like the language C is called the way it is, because it was developed from the B language (Bell labs).

The convention is only internal, to keep up with the names they were already familiar with.

你如我软肋 2024-07-28 00:36:34

它的历史。 x86 来自 8086,8086 来自 8080,8080 来自 8008,8008 来自 4004。有 16 位寄存器 AX、BX 等,对于 80386,它们被“扩展”为 32 位。

补充:顺便说一句,摩托罗拉 68K 从一开始就有 32 位寄存器,因此在最初的几十年里编程要容易得多。 我参与的项目中选择英特尔是出于商业原因,而不是技术原因。

It's history. The x86 came from the 8086, which came from the 8080, which came from the 8008, which came from the 4004. There were 16-bit registers AX, BX, etc. and for the 80386 they got "extended" to 32 bits.

Added: BTW the Motorola 68K had 32-bit registers from the start, so it was much easier to program for the first couple decades. I worked on projects where Intel was chosen for business reasons, not technical.

烏雲後面有陽光 2024-07-28 00:36:34

我发现的东西

* EAX - Accumulator Register
* EBX - Base Register
* ECX - Counter Register
* EDX - Data Register
* ESI - Source Index
* EDI - Destination Index
* EBP - Base Pointer
* ESP - Stack Pointer

Something I found:

* EAX - Accumulator Register
* EBX - Base Register
* ECX - Counter Register
* EDX - Data Register
* ESI - Source Index
* EDI - Destination Index
* EBP - Base Pointer
* ESP - Stack Pointer
少女情怀诗 2024-07-28 00:36:34

C 和 D 是数字/类型,H 代表高位寄存器的高位部分,L 代表高位寄存器的低位部分。
http://en.wikipedia.org/wiki/X86

维基百科解释得很好。

更多来自维基百科:

  1. AX/EAX/RAX:累加器
  2. BX/EBX/RBX:基础
  3. CX/ECX/RCX:计数器
  4. DX/EDX/RDX:
    数据/一般

The C and the D are numbers/types and H for high and L for low parts of the higher register.
http://en.wikipedia.org/wiki/X86

Wikipedia explains it very well.

More from the Wikipedia:

  1. AX/EAX/RAX: accumulator
  2. BX/EBX/RBX: base
  3. CX/ECX/RCX: counter
  4. DX/EDX/RDX:
    data/general
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文