<<<    Index    >>>
3-312
INSTRUCTION SET REFERENCE
INT n/INTO/INT 3—Call to Interrupt Procedure (Continued)
ELSE(* 16-bit gate *)
Push(far pointer to old stack); (* old SS and SP, 2 words *);
Push(EFLAGS(15..0));
Push(far pointer to return instruction); (* old CS and IP, 2 words *);
Push(ErrorCode); (* if needed, 2 bytes *)
FI;
CPL 
<
 CodeSegmentDescriptor(DPL);
CS(RPL) 
<
 CPL;
IF interrupt gate 
THEN IF 
<
 0 (* interrupt flag to 0 (disabled) *); FI;
TF 
<
 0;
VM 
<
 0;
RF 
<
 0;
NT 
<
 0;
END;
INTERRUPT-FROM-VIRTUAL-8086-MODE:
(* Check segment selector and descriptor for privilege level 0 stack in current TSS *)
IF current TSS is 32-bit TSS
THEN 
TSSstackAddress 
<
 (new code segment DPL 
?
 8) + 4
IF (TSSstackAddress + 7) 
>
 TSS limit
THEN #TS(current TSS selector); FI;
NewSS 
<
 TSSstackAddress + 4;
NewESP 
<
 stack address;
ELSE (* TSS is 16-bit *)
TSSstackAddress 
<
 (new code segment DPL 
?
 4) + 2
IF (TSSstackAddress + 4) 
>
 TSS limit
THEN #TS(current TSS selector); FI;
NewESP 
<
 TSSstackAddress;
NewSS 
<
 TSSstackAddress + 2;
FI;
IF segment selector is null THEN #TS(EXT); FI;
IF segment selector index is not within its descriptor table limits
OR segment selector’s RPL 
?
 DPL of code segment, 
THEN #TS(SS selector + EXT);
FI;
Access segment descriptor for stack segment in GDT or LDT;
IF stack segment DPL 
?
 DPL of code segment, 
OR stack segment does not indicate writable data segment, 
THEN #TS(SS selector + EXT);
FI;
IF stack segment not present THEN #SS(SS selector+EXT); FI;
<<<    Index    >>>