IRET/IRETD—Interrupt Return (Continued)
IF CPL = 0
THEN
FI;
END;
RETURN-TO-OUTER-PRIVILGE-LEVEL:
IF OperandSize=32
THEN
ELSE (* OperandSize=16 *)
FI;
Read return segment selector;
IF stack segment selector is null THEN #GP(0); FI;
IF return stack segment selector index is not within its descriptor table limits
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
FI;
IF stack segment is not present THEN #NP(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
FI;
IF CPO IOPL
THEN
FI;
IF CPL = 0
THEN
FI;
CPL RPL of the return code segment selector;
FOR each of segment register (ES, FS, GS, and DS)
DO;
4:236
EFLAGS(IOPL) tempEFLAGS;
IF OperandSize=32
THEN EFLAGS(VM, VIF, VIP) tempEFLAGS;
FI;
IF top 8 bytes on stack are not within limits THEN #SS(0); FI;
IF top 4 bytes on stack are not within limits THEN #SS(0); FI;
THEN #GP(SSselector); FI;
THEN #GP(SS selector);
EFLAGS(RF, AC, ID) tempEFLAGS;
EFLAGS(IF) tempEFLAGS;
EFLAGS(IOPL) tempEFLAGS;
IF OperandSize=32
THEN EFLAGS(VM, VIF, VIP) tempEFLAGS;
FI;
IF segment register points to data or non-conforming code segment
Volume 4: Base IA-32 Instruction Reference