THE 80286 INSTRUCTION SET

CALL GATE TO MORE PRIVILEGE:

Get new SS selector for new privilege level from TSS Check selector and descriptor for new SS:

Selector must not be null else #TS(O)

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

New stack must have room for parameters plus 8 bytes else #SS(O) IP must be in code segment limit else #GP(O)

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

Load SS descriptor

Push long pOinter of old stack onto new stack Get word count from call gate, mask to 5 bits Copy parameters from old stack onto new stack Push return address onto new stack

Set CPL to stack segment DPL Set RPL of CS to CPL

Else

CALL GATE TO SAME PRIVILEGE:

Stack must have room for 4-byte return address else #SS(O) IP must be in code segment limit else #GP(O)

Load CS:IP from gate

Push return address onto stack

Load code segment descriptor into CS-cache Set RPL of CS to CPL

CALL TASK GATE:

Task gate DPL must be ~ CPL else #GP (gate selector) Task gate DPL must be ~ RPL else #GP (gate selector) Task Gate must be PRESENT else #NP (gate selector)

Examine selector to TSS, given in Task Gate descriptor:

Must specify global In the local/global bit else #GP (TSS selector) Index must be within GOT limits else #GP (TSS selector)

TSS descriptor AR byte must specify available TSS (bottom bits 00001) else #GP (TSS selector)

Task State Segment mUllt be PRESENT else #NP (TSS selector) SWITCH_TASKS with nesting to TSS

IP must be In code segment limit else #GP(O)

TASK STATE SEGMENT:

TSS DPL must be ~ CPL else #GP (TSS selector)

TSS DPL must be ~ RPL else #GP (TSS selector)

TSS descriptor AR byte must specify available TSS else #GP (TSS selector)

Task State Segment must be PRESENT else #NP (TSS selector)

SWITCH3ASKS with nesting to TSS

IP must be in code segment limit else #GP(O)

ELSE #GP (code segment selector)

PROTECTED MODE EXCEPTIONS

FAR calls: #GP, #NP, #SS, and #TS, as indicated in the list above.

NEAR direct calls: #GP(O) if procedure location is beyond the code segment limits.

8-25

Page 235
Image 235
Intel 80286 Instruction SET Call Gate to More Privilege, Call Gate to Same Privilege, Call Task Gate, Task State Segment