CPU designs typically include a number of registers which hold all or most of the state of the computation.
There are several properties of these registers, combinations of which continue to surprise me.
Here are some properties:
For instance the 88K has four privileged registers in a small file which are not special.
A special privileged instruction was required to copy between these registers and the general registers.
Our kernel found one of them was very convenient for storing the root of the state of the running process.
It was faster to access than memory.
Another of these registers would serve as temp storage for a few cycles to speed saving user register values upon interrupt and restart.
- In a register file:
- This has more to do with how the registers are named in the instruction stream.
Some register files are inhomogeneous.
The AMD extensions to the x86 architecture provided NUMA register names.
- There are modes where the registers are inaccessible, and thus programs that are unable to access the registers.
- Which means that the bits in the register are inaccessible even as the program specifically names that register to define the program’s meaning.
Values in such registers may be copied but the protection follows the value.
Some capability hardware has such registers.
- Special Purpose:
- When the content of the register influence the program semantics even when the program does not name them.
Floating point mode registers are of this form.
The general registers of most CPUs are uniformly addressed and are neither privileged, protected or special purpose.
Sometimes one of these registers has the special purpose of defining the stack and there may be several instructions that read or write the register without naming it.
Some CPUs have a register file with registers of various special purposes.
(The control registers of the IBM 370.)
Some of these registers may be privileged.