std

Set direction flag

Sets the direction flag (DF), so string instructions step downward through memory.

8086 and later

Intel's reference: STD

CFPFAFZFSFDFOF –––––1–
  • 1 always 1
  • – not changed

Forms

  • std

cld clears it, which has to happen before the next call or return: the Linux calling convention expects DF to be clear at both.

global _start

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

        std

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