3-532
INSTRUCTION SET REFERENCE
POP—Pop a Value from the Stack (Continued)
The POP ESP instruction increments the stack pointer (ESP) before data at the old top of stack
is written into the destination.
A POP SS instruction inhibits all interrupts, including the NMI interrupt, until after execution
of the next instruction. This action allows sequential execution of POP SS and MOV ESP, EBP
instructions without the danger of having an invalid stack during an interrupt
1
. However, use of
the LSS instruction is the preferred method of loading the SS and ESP registers.
Operation
IF StackAddrSize = 32
THEN
IF OperandSize = 32
THEN
DEST
<
SS:ESP; (* copy a doubleword *)
ESP
<
ESP + 4;
ELSE (* OperandSize = 16*)
DEST
<
SS:ESP; (* copy a word *)
ESP
<
ESP + 2;
FI;
ELSE (* StackAddrSize = 16* )
IF OperandSize = 16
THEN
DEST
<
SS:SP; (* copy a word *)
SP
<
SP + 2;
ELSE (* OperandSize = 32 *)
DEST
<
SS:SP; (* copy a doubleword *)
SP
<
SP + 4;
FI;
FI;
Loading a segment register while in protected mode results in special checks and actions, as
described in the following listing. These checks are performed on the segment selector and the
segment descriptor it points to.
IF SS is loaded;
THEN
IF segment selector is null
THEN #GP(0);
1.Note that in a sequence of instructions that individually delay interrupts past the following instruction, only
the first instruction in the sequence is guaranteed to delay the interrupt, but subsequent interrupt-delaying
instructions may not delay the interrupt. Thus, in the following instruction sequence:
STI
POP SS
POP ESP
interrupts may be recognized before the POP ESP executes, because STI also delays interrupts for one
instruction.