control registers
overview
Control registers are used to determine the operating mode of the CPU as well as the characteristics of the currently executing task.
control registers
There are five control registers in total and they are as follows:
| Register | Purpose |
|---|---|
| CR0 | System flag that controls the operating mode and various states of the processor. |
| CR1 | Reserved and not implemented. |
| CR2 | Stores memory page fault information (when a program attempts to access data not currently in physical RAM). |
| CR3 | Stores memory page directory information |
| CR4 | Flags that enable processor features and indicate feature capabilities of the processor. |
important to remember
The values in each of the control registers can’t be directly accessed however the data in the control register can be moved to one of the general-purpose registers and once the data is in a GP register, a program can examine the bit flags in the register to determine the operating status of the processor in conjunction with the current running task.
If a change is required to a control register flag value, the change can be made to the data in the GP register and the register moved to the CR. Low-level System Programmers usually modify the values in control registers. Normal application programs do not usually modify control register entries however they might query flag values to determine the capabilities of the host processor chip on which the program is currently running.