I'm trying to access a second local variable on the current stack frame, located at (I think?) %rsp-8, since the first is located at %rsp. What I'd like to do is load the address at %rsp-8 into another register. Note that this means the address that's currently stored at rsp, and not the data at that address in memory. Is it possible to do this without having to declare a separate register that stores the offset (or increments the current rsp)?
What I currently have:
...
movq %rsp, %rsi # Move the first address at rsp into rsi.
leaq infmt, %rdi # Load the input format string into rdi.
movq $0, %rax # Clear rax since it is a var-args procedure.
call scanf
movq %rsp, %rbx
addq $8, %rbx
movq %rbx, %rsi # Move the next address at rsp into rsi.
leaq infmt, %rdi # Reload the input format.
call scanf
...
What would be nice to have:
...
movq %rsp, %rsi # Move the first address at rsp into rsi.
leaq infmt, %rdi # Load the input format string into rdi.
movq $0, %rax # Clear rax since it is a var-args procedure.
call scanf
movq %rbx-8, %rsi # Move the next address at rsp into rsi.
leaq infmt, %rdi # Reload the input format.
call scanf
...