CSC167 · 2078 · 5 marks
Explain Register Organization in 80386 microprocessor.
Explain Register Organization in 80386 microprocessor. [5]
Quick answer
The 80386 is a 32-bit microprocessor.
Register Organization in 80386 Microprocessor
Register Organization of 80386
The 80386 is a 32-bit microprocessor. Its registers are organized into the following groups:
1. General Purpose Registers (32-bit)
These are 32-bit registers used for arithmetic, logical, and data transfer operations. They are extensions of the 16-bit 8086 registers.
| Register | Full Name | Description |
|---|---|---|
| EAX | Extended Accumulator | Used for arithmetic and I/O operations |
| EBX | Extended Base Register | Used as base address in memory addressing |
| ECX | Extended Count Register | Used as loop counter |
| EDX | Extended Data Register | Used in I/O and multiply/divide operations |
| ESI | Extended Source Index | Source pointer for string operations |
| EDI | Extended Destination Index | Destination pointer for string operations |
| EBP | Extended Base Pointer | Points to base of stack frame |
| ESP | Extended Stack Pointer | Points to top of stack |
- The lower 16 bits of each register can be accessed as AX, BX, CX, DX, SI, DI, BP, SP.
- The lower 8 bits of AX, BX, CX, DX can be accessed as AL, AH, BL, BH, CL, CH, DL, DH.
2. Segment Registers (16-bit)
The 80386 has six 16-bit segment registers used to hold segment selectors in protected mode or segment base addresses in real mode.
| Register | Name | Purpose |
|---|---|---|
| CS | Code Segment | Points to the segment containing program code |
| DS | Data Segment | Points to the default data segment |
| SS | Stack Segment | Points to the stack segment |
| ES | Extra Segment | Extra segment for string operations |
| FS | F Segment | Additional general-purpose segment |
| GS | G Segment | Additional general-purpose segment |
3. Instruction Pointer (EIP) - 32-bit
- EIP holds the offset address of the next instruction to be executed within the code segment.
- It is automatically incremented after each instruction fetch.
- Equivalent to the Program Counter (PC) in other architectures.
4. Flag Register (EFLAGS) - 32-bit
The EFLAGS register contains status, control, and system flags.
Key flags include:
| Flag | Symbol | Description |
|---|---|---|
| Carry Flag | CF | Set on unsigned overflow |
| Zero Flag | ZF | Set when result is zero |
| Sign Flag | SF | Set when result is negative |
| Overflow Flag | OF | Set on signed overflow |
| Parity Flag | PF | Set when result has even parity |
| Trap Flag | TF | Enables single-step mode |
| Interrupt Flag | IF | Enables/disables maskable interrupts |
| Direction Flag | DF | Controls direction of string operations |
5. Control Registers (CR0 - CR3)
Used to control operating modes and memory management:
| Register | Purpose |
|---|---|
| CR0 | Contains system control flags (e.g., PE bit to enable protected mode) |
| CR1 | Reserved |
| CR2 | Holds the linear address that caused a page fault |
| CR3 | Holds the base address of the page directory (used in paging) |
6. System Address Registers
| Register | Size | Purpose |
|---|---|---|
| GDTR | 48-bit | Global Descriptor Table Register |
| IDTR | 48-bit | Interrupt Descriptor Table Register |
| LDTR | 16-bit | Local Descriptor Table Register |
| TR | 16-bit | Task Register |
7. Debug and Test Registers
- DR0 - DR7: Debug registers used to set hardware breakpoints.
- TR6, TR7: Test registers used for testing the Translation Lookaside Buffer (TLB).
Summary Diagram
80386 Registers
├── General Purpose: EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP (32-bit)
├── Segment Registers: CS, DS, SS, ES, FS, GS (16-bit)
├── Instruction Pointer: EIP (32-bit)
├── Flags Register: EFLAGS (32-bit)
├── Control Registers: CR0 - CR3
├── System Address Registers: GDTR, IDTR, LDTR, TR
└── Debug Registers: DR0 - DR7
The rich register organization of the 80386 allows it to support real mode, protected mode, and virtual 8086 mode, making it a powerful and flexible 32-bit processor.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.