Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z
4-258 Vol. 2B
INSTRUCTION SET REFERENCE, N-Z
FI;
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 (* DPL in hidden part of segment register *)
THEN SegmentSelector ← 0; (* Segment selector invalid *)
FI;
OD;
For each of ES, FS, GS, and DS
DO
IF segment selector index is not within descriptor table limits
or segment descriptor indicates the segment is not a data or
readable code segment
or if the segment is a data or non-conforming code segment
and the segment descriptor’s DPL < CPL or RPL of code segment’s
segment selector
THEN SegmentSelector ← 0; (* Segment selector invalid *)
OD;
ESP ← ESP + SRC; (* Release parameters from calling procedure’s stack *)
(* IA-32e Mode *)
IF (PE
= 1 and VM = 0 and IA32_EFER.LMA = 1) and instruction = far RET
THEN
IF OperandSize
= 32
THEN
IF second doubleword on stack is not within stack limits
THEN #SS(0); FI;
IF first or second doubleword on stack is not in canonical space
THEN #SS(0); FI;
ELSE
IF OperandSize = 16
THEN
IF second word on stack is not within stack limits
THEN #SS(0); FI;
IF first or second word on stack is not in canonical space
THEN #SS(0); FI;
ELSE (* OperandSize
= 64 *)
IF first or second quadword on stack is not in canonical space
THEN #SS(0); FI;
FI
FI;
IF return code segment selector is NULL