popfw

Pop flags, 16-bit

Consumes a 2-byte stack value to restore writable low flags, subject to privilege restrictions.

8086 and later

CFPFAFZFSFTFIFDFOF ●●●●●●●●●
  • ● set from the result
  • CF Loaded from the stack.
  • PF Loaded from the stack.
  • AF Loaded from the stack.
  • ZF Loaded from the stack.
  • SF Loaded from the stack.
  • TF Loaded from the stack.
  • IF Loaded from the stack only with the privilege to change it, which a Linux program lacks.
  • DF Loaded from the stack.
  • OF Loaded from the stack.

Forms

  • popfw

In 64-bit mode, popf / popfq consume 8 bytes using rsp; popfw consumes 2 and supplies the low 16 bits. popfd is unavailable in this mode.

Privilege and architectural rules limit which flags can change. In particular, ordinary user code cannot use this instruction to freely change IOPL or IF, and some flags retain their old values. Do not treat the operation as an unrestricted assignment to rflags.