Intel 253666-024US User Manual
Page 539

Vol. 2A 3-493
INSTRUCTION SET REFERENCE, A-M
IRET/IRETD—Interrupt Return
ELSE IF OperandSize
=
32
THEN
IF top 12 bytes of stack not within stack limits
THEN #SS(0); FI;
tempEIP
← Pop();
tempCS
← Pop();
tempEFLAGS
← Pop();
ELSE IF OperandSize
=
16
THEN
IF top 6 bytes of stack are not within stack limits
THEN #SS(0); FI;
tempEIP
← Pop();
tempCS
← Pop();
tempEFLAGS
← Pop();
tempEIP
← tempEIP AND FFFFH;
tempEFLAGS
← tempEFLAGS AND FFFFH;
FI;
ELSE (* OperandSize
=
64 *)
THEN
tempRIP
← Pop();
tempCS
← Pop();
tempEFLAGS
← Pop();
tempRSP
← Pop();
tempSS
← Pop();
FI;
GOTO IA-32e-MODE-RETURN;
RETURN-FROM-VIRTUAL-8086-MODE:
(* Processor is in virtual-8086 mode when IRET is executed and stays in virtual-8086 mode *)
IF IOPL
=
3 (* Virtual mode: PE
=
1, VM
=
1, IOPL
=
3 *)
THEN IF OperandSize
=
32
THEN
IF top 12 bytes of stack not within stack limits
THEN #SS(0); FI;
IF instruction pointer not within code segment limits
THEN #GP(0); FI;
EIP
← Pop();
CS
← Pop(); (* 32-bit pop, high-order 16 bits discarded *)
EFLAGS
← Pop();
(* VM, IOPL,VIP and VIF EFLAG bits not modified by pop *)
ELSE (* OperandSize
=
16 *)
IF top 6 bytes of stack are not within stack limits
THEN #SS(0); FI;
IF instruction pointer not within code segment limits