POPF            Pop Flags from Stack                 Flags: O D I T S Z A P C
* * * * * * * * *
POPF IOv86
POPFD (CPU: 386+) IOv86

Logic POP eFLAGS

POPF/POPFD pops the word or doubleword on the top of the stack and
stores the value in the flags register. If the operand-size
attribute of the instruction is 16 bits, then a word is popped and
the value stored in FLAGS. If the operand-size attribute is 32
bits, then a doubleword is popped and the value stored in EFLAGS.

The RF and VM flags (bits 16 and 17 of EFLAGS) cannot be changed
by the POPFD instruction.


Protected mode
The I/O privilege level (IOPL -- bits 12,13 of FLAGS) is changed
only when executing at privilege level zero (CPL=0). The interrupt
flag (IF) is changed only when executing at a level at least as
privileged as the IOPL (real-address mode is equivalent to CPL=0).
If a POPF instruction is executed with insufficient privilege, an
exception does not occur, but the privileged bits are not altered.
This instruction is IOPL-sensitive in V86 mode.


Note
Some assemblers support a POPF extension (POPFW) that forces a
16-bit word-style pop regardless of the code segment's size
attribute (80386+).


Opcode Format
9D POPF
9D POPFD


Length and timing
Variations Bytes 8088 186 286 386 486 Pentium
popf 1 12 8 5 5 9 6 NP
popfd 1 - - - 5 9 6 NP

Protected Mode

Bytes 286 386 486 Pentium
popf 1 5 5 6 4 NP
popfd 1 - 5 6 4 NP