4 ms·
lods and stos do load/store + increment of `rsi` or `rdi` respectively. There's also movs to copy between two memory addresses + increment Usually seen in conj
by sph 2y ago
lods and stos do load/store + increment of `rsi` or `rdi` respectively. There's also movs to copy between two memory addresses + increment
Usually seen in conjunction with rep, which repeats the above instruction `rcx` times.
A simple memset of 10 bytes:
mov rcx, 10
mov rdi, dest
mov rax, 0
rep stosb
You can use the w, d or q suffixes to advance by 2, 4 or 8 bytes.
- jcul 2y agoOh cool, and it looks like it can also decrement by 1/2/4/8. > After the byte, word, or doubleword is transferred from the memory location into the AL, AX, or EAX register, the (E)SI register is incremented or decremented automatically according to the setting of the DF flag in the EFLAGS register. (If the DF flag is 0, the (E)SI register is incremented; if the DF flag is 1, the ESI register is decremented.) The (E)SI register is incremented or decremented by 1 for byte operations, by 2 for word operations, or by 4 for doubleword operations. https://www.felixcloutier.com/x86/lods:lodsb:lodsw:lodsd:lodsq https://www.felixcloutier.com/x86/lods:lodsb:lodsw:lodsd:lod...