I am trying to load a pointer into the %rdi register. The memory address I want is stored 10 bytes past the memory location of $rsp.
How would I write the assembly code for this? This is what I have so far
movq 10(%rsp),%rdi
ret
I am trying to load a pointer into the %rdi register. The memory address I want is stored 10 bytes past the memory location of $rsp.
How would I write the assembly code for this? This is what I have so far
movq 10(%rsp),%rdi
ret
Try leaq instruction, it is often used to compute address offset, or a simple multiply–add computation like this:
leaq 4(%rsi,%rdi,2), %rdx # rdx = 4 + rsi + (rdi << 1)
So what you need would be
leaq 0xa(%rsp),%rdi # assume you need an offset of decimal number 10
ret