THE 80286 INSTRUCTION SET

In Protected mode, INT also resets the Trap Flag. In Protected mode, the precise semantics of the INT instruction are given by the following:

INTERRUPT

Interrupt vector must be within lOT table limits else #GP (vector number X 8+2+EXT)

Descriptor AR byte must indicate interrupt gate, trap gate, or task gate else #GP(vector number X 8+2+ EXT)

If INT instruction then gate descriptor DPL must be 2:: CPL else #GP (vector number X 8+2+EXT) Gate must be PRESENT else #NP (vector number X 8+2+EXT)

If TRAP GATE or INTERRUPT GATE:

Examine CS selector and descriptor given in the gate descriptor: Selector must be non-null else #GP (EXT)

Selector must be within its descriptor table limits else #GP (selector+EXT) Descriptor AR byte must indicate code segment else #GP (selector + EXT) Segment must be PRESENT else #NP (selector+ EXT)

If code segment is non-conforming and DPL < CPL then

INTERRUPT TO INNER PRIVILEGE:

Check selector and descriptor for new stack in current Task State Segment: Selector must be non-null else #TS(EXT)

Selector index must be within its descriptor table limits else #TS (SS selector + EXT) Selector'sRPL must equal DPL of code segment else #TS (SS selector+EXT) Stack segment DPL must equal DPL of code segment else #TS (SS selector+EXT) Descriptor must indicate writable data segment else #TS (SS selector+ EXT) Segment must be PRESENT else #SS (SS selector+EXT)

New stack must have room for 10 bytes else #SS(O) IP must be in CS limit else #GP(O)

Load new SS and SP value from TSS Load new CS and IP value from gate Load CS descriptor

Load SS descriptor

Push long pointer to old stack onto new stack Push return address onto new stack

Set CPL to new code segment DPL Set RPL of CS to CPL

If INTERRUPT GATE then set the Interrupts Enabled Flag to 0 (disabled) Set the Trap Flag to 0

Set the Nested Task Flag to 0

If code segment is conforming or code segment DPL = CPL then

INTERRUPT TO SAME PRIVILEGE LEVEL:

Current stack limits must allow pushing 6 bytes else #SS(O) If interrupt was caused by fault with error code then

Stack limits must allow push of two more bytes else #SS(O) IP must be in CS limit else #GP(O)

Push flags onto stack

Push current CS selector onto stack Push return offset onto stack Load CS:IP from gate

Load CS descriptor

Set the RPL field of CS to CPL Push error code (if any) onto stack

If INTERRUPT GATE then set the Interrupts Enabled Flag to 0 (disabled) Set the Trap Flag to 0

Set the Nested Task Flag to 0

Else #GP (CS selector + EXT)

If TASK GATE:

Examine selector to TSS, given in Task Gate descriptor:

Must specify global in the local/global bit else #GP (TSS selector)

8-49

Page 259
Image 259
Intel 80286, 80287 manual Interrupt to Inner Privilege, Interrupt to Same Privilege Level