So when movl (in intel x84-64 machine code) is called and has a register as the destination, it sets the higher order bytes of the register to 0. So how can i use the movl instruction such that I preserve the original value of the register? In this situation, we cant use rsi / rdi for movl instructions (only esi and edi). For example, if I go
movq %rsp, %rax
and then call
movl %eax, %edx
is there a way to call movl / do something after movl such that rdx can then contain the original value that was in %rsp?
The reason I cant do something like movq %rax, %rdx is because I dont have those commands available to me. I'm doing a ROP attack where i only have movl instructions available to me in the gadget farm. I also have access to andb, orb, cmpb and testb instructions.