3-494 Vol. 2A IRET/IRETD—Interrupt Return
INSTRUCTION SET REFERENCE, A-M
THEN #GP(0); FI;
EIP ← Pop();
EIP
← EIP AND 0000FFFFH;
CS
← Pop(); (* 16-bit pop *)
EFLAGS[15:0]
← Pop(); (* IOPL in EFLAGS not modified by pop *)
FI;
ELSE
#GP(0); (* Trap to virtual-8086 monitor: PE = 1, VM = 1, IOPL < 3 *)
FI;
END;
RETURN-TO-VIRTUAL-8086-MODE:
(* Interrupted procedure was in virtual-8086 mode: PE = 1, CPL=0, VM = 1 in flag image *)
IF top 24 bytes of stack are not within stack segment limits
THEN #SS(0); FI;
IF instruction pointer not within code segment limits
THEN #GP(0); FI;
CS ← tempCS;
EIP
← tempEIP;
EFLAGS
← tempEFLAGS;
TempESP
← Pop();
TempSS
← Pop();
ES
← Pop(); (* Pop 2 words; throw away high-order word *)
DS
← Pop(); (* Pop 2 words; throw away high-order word *)
FS
← Pop(); (* Pop 2 words; throw away high-order word *)
GS
← Pop(); (* Pop 2 words; throw away high-order word *)
SS:ESP
← TempSS:TempESP;
CPL
← 3;
(* Resume execution in Virtual-8086 mode *)
END;
TASK-RETURN: (* PE = 1, VM = 0, NT = 1 *)
Read segment selector in link field of current TSS;
IF local/global bit is set to local
or index not within GDT limits
THEN #TS (TSS selector); FI;
Access TSS for task specified in link field of current TSS;
IF TSS descriptor type is not TSS or if the TSS is marked not busy
THEN #TS (TSS selector); FI;
IF TSS not present
THEN #NP(TSS selector); FI;
SWITCH-TASKS (without nesting) to TSS specified in link field of current TSS;
Mark the task just abandoned as NOT BUSY;