3-326
INSTRUCTION SET REFERENCE
IRET/IRETDInterrupt Return (Continued)
THEN #GP(SSselector); FI;
Read segment descriptor pointed to by return segment selector;
IF stack segment selector RPL
?
RPL of the return code segment selector
IF stack segment selector RPL
?
RPL of the return code segment selector
OR the stack segment descriptor does not indicate a a writable data segment;
OR stack segment DPL
?
RPL of the return code segment selector
THEN #GP(SS selector);
FI;
IF stack segment is not present THEN #SS(SS selector); FI;
IF tempEIP is not within code segment limit THEN #GP(0); FI;
EIP
<
tempEIP;
CS
<
tempCS;
EFLAGS (CF, PF, AF, ZF, SF, TF, DF, OF, NT)
<
tempEFLAGS;
IF OperandSize=32
THEN
EFLAGS(RF, AC, ID)
<
tempEFLAGS;
FI;
IF CPL
?
IOPL
THEN
EFLAGS(IF)
<
tempEFLAGS;
FI;
IF CPL = 0
THEN
EFLAGS(IOPL)
<
tempEFLAGS;
IF OperandSize=32
THEN EFLAGS(VM, VIF, VIP)
<
tempEFLAGS;
FI;
FI;
CPL
<
RPL of the return code segment selector;
FOR each of segment register (ES, FS, GS, and DS)
DO;
IF segment register points to data or non-conforming code segment
AND CPL > segment descriptor DPL (* stored in hidden part of segment register *)
THEN (* segment register invalid *)
SegmentSelector
<
0; (* null segment selector *)
FI;
OD;
END:
Flags Affected
All the flags and fields in the EFLAGS register are potentially modified, depending on the mode
of operation of the processor. If performing a return from a nested task to a previous task, the
EFLAGS register will be modified according to the EFLAGS image stored in the previous tasks
TSS.