blob: 043a6924a813a603b1871489a324d2e6803e2273 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/*
pushtest:
movq %rsp, %rax Copy stack pointer
pushq %rsp Push stack pointer, original or after incrementing
popq %rdx Pop the value back
subq %rdx, %rax Always 0 on this machine
It must first push the original rsp decremented address and then decrement rsp itself, otherwise a difference is expected after pushing and popping.
*/
/*
poptest:
movq %rsp, %rdi Save the original sp
pushq $0xabcd Push test value
popq %rsp Pop test value to rsp
movq %rsp, %rax Set popped value as return value
movq %rdi, %rsp
ret
Rsp gets set the value in memory at rsp.
From solutions:
mrmovq (%rsp), %rsp
I guess it just reads the stack value and overwrites it into rsp
*/
|