3-324
INSTRUCTION SET REFERENCE
IRET/IRETDĀInterrupt Return (Continued)
END;
RETURN-TO-VIRTUAL-8086-MODE:
(* Interrupted procedure was in virtual-8086 mode: PE=1, VM=1 in flags 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;
(* 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 #GP(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 #GP(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;
IF EIP is not within code segment limit
THEN #GP(0);
FI;
END;
PROTECTED-MODE-RETURN: (* PE=1, VM=0 in flags image *)
IF return code segment selector is null THEN GP(0); FI;
IF return code segment selector addrsses descriptor beyond descriptor table limit