80386dx_basics.microprocessor
80386dx_basics.microprocessor
General
Purpose Pointer
Register Register
Segment
Register
Flag Register of 80386: The Flag register of 80386 is a
32 bit register. Out of the 32 bits, Intel has reserved bits
D18 to D31, D5 and D3, while D1 is always set at 1.Two
extra new flags are added to the 80286 flag to derive the
flag register of 80386. They are VM and RF flags.
Six Conditional Flags
◦ Carry Flag (CF)
◦ Parity Flag (PF)
◦ Auxiliary Flag( AF)
◦ Zero Flag (ZF)
◦ Sign Flag (SF)
◦ Overflow Flag (OF)
Three Control Flags
◦ Interrupt Flag (IF)
◦ Trap Flag (TF)
◦ Direction Flag (DF)
Four System Flags
◦ Input/output privilege level (IOPL)
◦ Nested Task (NT)
◦ Resume Flag (RF)
◦ Virtual Mode Flag (VM)
VM - Virtual Mode Flag:
Indicates operating mode of 80386.
When VM flag is set, 80386 switches from protected mode
to virtual 8086 mode.
RF- Resume Flag: This flag is used with the debug register
breakpoints. It is checked at the starting of every instruction
cycle and if it is set, any debug fault is ignored during the
instruction cycle. The RF is automatically reset after
successful execution of every instruction, except for IRET
and POPF instructions.
NT (Nested flag) :
◦ This flag is set when one system task invokes another
task.(i.e. nested task).
IOPL (l/O Privilege level) :
◦ The two bits in the IOPL are used by the processor and
the operating system to determine your application's
access to I/O facilities.
The 386 supports four types of descriptor table:
• Global descriptor table (GDT),
• Local descriptor table (LDT),
• Interrupt descriptor table (IDT), and
• Task state segment descriptor (TSS).
Four special registers are defined to hold the base address of
these tables
• Global descriptor table Register (GDTR),
• Local descriptor table Register (LDTR),
• Interrupt descriptor table Register (IDTR), and
• Task state segment descriptor Register (TR).
Control Register(32- bit)
Control Register 0 (CR0)
CR0 contains system control flags, which control or indicate
conditions that apply to the system as a whole, not to an
individual task (Also know as MSW).
PE (Protection Enable bit 0)
Read only register. The 80386 itself writes the last 32 bit
linear address of page fault routine in this register. When
page fault occurs , porcessor generates exception 14 (page
fault) .
This address is important for writing page fault routine.
S=1
Non System
System Descriptor
S=0
Type Defines Type Defines
System 0 Reserved by Intel 8 Reserved by Intel
Descripors 1 Available 80286 TSS 9 Available Intel 80286
TSS
2 LDT A Undefined
3 Busy 80286 TSS B Busy Intel 80386DX
4 80286 Call Gate C Intel 80386DX Call
gate
5 Task Gate D Undefined
6 80286 Interrupt Gate E 80386DX Interrupt
Gate
7 80286 Trap Gate F 80386DX Trap Gate
Descriptor Tables
U bit: