lodsd

Load doubleword from string

Loads the doubleword at [rsi] into eax, then advances rsi by 4, backward when DF is set.

386 and later

Intel's reference: LODS/LODSB/LODSW/LODSD/LODSQ

CFPFAFZFSFDFOF –––––––
  • Changes no flag
  • Reads DF

Forms

  • lodsd

The d suffix selects an element of 4 bytes. After each element, the instruction increases rsi by 4 when DF = 0, or decreases rsi by 4 when DF = 1. In 64-bit mode the default addresses use rsi. The a32 address-size prefix instead uses esi; 16-bit string addressing is unavailable.

rep repeats until the counter reaches zero. The counter is rcx by default or ecx with a32. If it starts at zero, a repeated instruction accesses no element. The data width is independent of this address and counter width.

global _start

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

        lodsd

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