Differentiate between user and control register in CPU.

User registers can read or write by machine instructions. The user registers are divided into data registers and address registers.

Data registers

These registers hold the numeric data values like integers and, in some architectures, hold floating-point values, characters, small bit arrays and other data. In low end CPUs, a special data register, called the accumulator, is used implicitly for many operations.

Address registers

These registers hold addresses and are used by instructions to indirectly access primary memory.

Some of the processors contain registers that are used to hold an address or to hold numeric values. In some cases, it is used as an index register whose value is added as an offset from some address. A variety of possible addressing modes, used to specify the effective address of an operand, exist.

The stack pointer is used to manage the run-time stack. And it also manages other data stacks that are addressed by dedicated address registers, see stack machine.

Control registers

It is called a processor register that changes or controls the general behaviour of a CPU or other services in the system.

The common tasks performed by control registers are interrupt control, switching the addressing mode, paging control, and coprocessor control.

Types of control registers

  • CR0 − It is 32 bits long for higher processors. If we take x64 processors in long mode, it and other control registers are 64 bits long. CR0 has various control flags which modify the basic operation of the processor.

  • CR1 − It is a reserved one. The CPU will throw a #UD exception whenever it is trying to access it.

  • CR2 − It contains a Page Fault Linear Address (PFLA). Whenever a page fault occurs, the address and the program attempted to access is stored in the CR2 register.

  • CR3 − It is used when virtual addressing is enabled, CR3 enables the processor to translate linear addresses into physical addresses by locating the page directory and page tables for the current task.

  • CR4 − It is used in protected mode to control operations like virtual-8086, enabling I/O breakpoints, page size extension and machine-check exceptions.

  • CR5-7 − Reserved, same case as CR1.

  • Additional Control Registers - CR8, Extended Feature Enable Register (EFER), XCR0 and XSS

Updated on: 26-Nov-2021


Kickstart Your Career

Get certified by completing the course

Get Started