Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z

Vol. 2B 4-255
INSTRUCTION SET REFERENCE, N-Z
IF instruction has immediate operand
THEN IF StackAddressSize
= 32
THEN
ESP ESP + SRC; (* Release parameters from stack *)
ELSE
IF StackAddressSize
= 64
THEN
RSP RSP + SRC; (* Release parameters from stack *)
ELSE (* StackAddressSize
= 16 *)
SP SP + SRC; (* Release parameters from stack *)
FI;
FI;
FI;
FI;
(* Real-address mode or virtual-8086 mode *)
IF ((PE
= 0) or (PE = 1 AND VM = 1)) and instruction = far return
THEN
IF OperandSize
= 32
THEN
IF top 12 bytes of stack not within stack limits
THEN #SS(0); FI;
EIP Pop();
CS Pop(); (* 32-bit pop, high-order 16 bits discarded *)
ELSE (* OperandSize
= 16 *)
IF top 6 bytes of stack not within stack limits
THEN #SS(0); FI;
tempEIP Pop();
tempEIP tempEIP AND 0000FFFFH;
IF tempEIP not within code segment limits
THEN #GP(0); FI;
EIP tempEIP;
CS Pop(); (* 16-bit pop *)
FI;
IF instruction has immediate operand
THEN
SP SP + (SRC AND FFFFH); (* Release parameters from stack *)
FI;
FI;
(* Protected mode, not virtual-8086 mode *)
IF (PE
= 1 and VM = 0 and IA32_EFER.LMA = 0) and instruction = far RET
THEN