Why are x86 registers named the way they are?

2019-01-18 09:58发布

问题:

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?

回答1:

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


回答2:

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


回答3:

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.



回答4:

Some good answers here: x86 assembly registers — Why do they work the way they do?



回答5:

older processors have accumulators named A, B, etc (alphabeticaly orderd). When 16 and 32 bits accumulators were developed, engineers added an X (extended). So its all about history, as the language C is called this way becouse it was developed from B language (Bell labs).

The convention is only internal, to keep up with the names they are alredy familiar with.