IRET/IRETD—Interrupt Return (Continued)
ELSE (*IOPL < 3*)
FI;
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;
4:234
THEN
EIP Pop();
CS Pop(); (* 32-bit pop, high-order 16-bits discarded *)
TempEFlags Pop();
FLAGS = (EFLAGS AND 1B3000H) OR (TempEFlags AND 244FD7H)
(*VM,IOPL,RF,VIP,and VIF EFLAGS bits are not modified by pop *)
ELSE (* OperandSize = 16 *)
EIP Pop();
EIP EIP AND 0000FFFFH;
CS Pop(); (* 16-bit pop *)
TempFlags <- Pop();
FLAGS = (FLAGS AND 3000H) OR (TempFLags AND 4FD5H)
(*IOPL unmodified*)
FI;
IF OperandSize = 16
THEN
IF ((STACK.TF !-0) OR (EFLAGS.VIP=1 AND STACK.IF=1))
THEN #GP(0);
ELSE
IP <- Pop();
CS <- Pop(0);
TempFlags <- Pop();
(*FLAGS IOPL, IF and TF are not modified*)
FLAGS = (FLAGS AND 3302H) OR (TempFlags AND 4CD5H)
EFLAGS.VIF <- TempFlags.IF;
FI;
ELSE (*OperandSize = 32 *)
#GP(0);
FI;
(*Word Pops*)
Volume 4: Base IA-32 Instruction Reference