pushfw

Push flags, 16-bit

Pushes the low 16 bits of rflags onto the stack as a word and decrements rsp by 2.

8086 and later

Intel's reference: PUSHF/PUSHFD/PUSHFQ

CFPFAFZFSFDFOF –––––––
  • Changes no flag
  • Reads CF PF AF ZF SF TF IF DF OF

Forms

  • pushfw

In 64-bit mode, pushf / pushfq subtract 8 from rsp and store a 64-bit image; pushfw subtracts 2 and stores the low 16 bits. pushfd is unavailable in this mode. The pushed 64-bit image has RF and VM cleared; it is not an exact copy of every bit of rflags.

global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        pushfw

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall