-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpp.sa
More file actions
43 lines (38 loc) · 956 Bytes
/
pp.sa
File metadata and controls
43 lines (38 loc) · 956 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* $begin pushtest-s 0 */
.text
.globl pushtest
pushtest:
movq %rsp, %rax # Copy stack pointer
pushq %rsp # Push stack pointer
popq %rdx # Pop it back
subq %rdx, %rax # Return 0 or 8
ret
/* $end pushtest-s 0 */
/* $begin poptest-s 0 */
.text
.globl poptest
poptest:
movq %rsp, %rdi # Save stack pointer
pushq $0xabcd # Push test value
popq %rsp # Pop to stack pointer
movq %rsp, %rax # Set popped value as return value
movq %rdi, %rsp # Restore stack pointer
ret
/* $end poptest-s 0 */
.text
.globl _pushtest
_pushtest:
movq %rsp, %rax # Copy stack pointer
pushq %rsp # Push stack pointer
popq %rdx # Pop it back
subq %rdx, %rax # Return 0 or 8
ret
.text
.globl _poptest
_poptest:
movq %rsp, %rdi # Save stack pointer
pushq $0xabcd # Push test value
popq %rsp # Pop to stack pointer
movq %rsp, %rax # Set popped value as return value
movq %rdi, %rsp # Restore stack pointer
ret