File tree 1 file changed +24
-18
lines changed
1 file changed +24
-18
lines changed Original file line number Diff line number Diff line change 13
13
.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer)
14
14
PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer):
15
15
16
- # Save caller state
17
- pushq %rbp
18
- pushq %rbx
19
- pushq %r12
20
- pushq %r13
21
- pushq %r14
22
- pushq %r15
23
-
24
- # Save caller stack pointer
16
+ # Make space on the stack for 6 registers:
17
+ subq $48 , %rsp
18
+
19
+ # Save caller state:
20
+ movq %rbp , 40 (%rsp )
21
+ movq %rbx , 32 (%rsp )
22
+ movq %r12 , 24 (%rsp )
23
+ movq %r13 , 16 (%rsp )
24
+ movq %r14 , 8 (%rsp )
25
+ movq %r15 , (%rsp )
26
+
27
+ # Save caller stack pointer:
25
28
movq %rsp , (%rdi )
26
29
27
- # Restore callee stack pointer
30
+ # Restore callee stack pointer:
28
31
movq (%rsi ), %rsp
29
32
30
33
# Restore callee state
31
- popq %r15
32
- popq %r14
33
- popq %r13
34
- popq %r12
35
- popq %rbx
36
- popq %rbp
37
-
38
- # Put the first argument into the return value
34
+ movq 40 (%rsp ), %rbp
35
+ movq 32 (%rsp ), %rbx
36
+ movq 24 (%rsp ), %r12
37
+ movq 16 (%rsp ), %r13
38
+ movq 8 (%rsp ), %r14
39
+ movq (%rsp ), %r15
40
+
41
+ # Adjust stack pointer back:
42
+ addq $48 , %rsp
43
+
44
+ # Put the first argument into the return value:
39
45
movq %rdi , %rax
40
46
41
47
# We pop the return address and jump to it
You can’t perform that action at this time.
0 commit comments