1 #ifdef __ELF__
2 .section .text.moxie_scanCurrentStack
3 .global moxie_scanCurrentStack
4 moxie_scanCurrentStack:
5 #else // Darwin
6 .global _moxie_scanCurrentStack
7 _moxie_scanCurrentStack:
8 #endif
9 // Save callee-saved registers.
10 pushq %rbx
11 pushq %rbp
12 pushq %r12
13 pushq %r13
14 pushq %r14
15 pushq %r15
16 17 // Scan the stack.
18 subq $8, %rsp // adjust the stack before the call to maintain 16-byte alignment
19 movq %rsp, %rdi
20 #ifdef __ELF__
21 callq moxie_scanstack
22 #else
23 callq _moxie_scanstack // Darwin
24 #endif
25 26 // Restore the stack pointer. Registers do not need to be restored as they
27 // were only pushed to be discoverable by the GC.
28 addq $56, %rsp
29 retq
30 31 32 #ifdef __ELF__
33 .section .text.moxie_longjmp
34 .global moxie_longjmp
35 moxie_longjmp:
36 #else // Darwin
37 .global _moxie_longjmp
38 _moxie_longjmp:
39 #endif
40 // Note: the code we jump to assumes rax is set to a non-zero value if we
41 // jump from here, so we use rax as the temporary value for jumpPC.
42 movq 0(%rdi), %rsp // jumpSP
43 movq 8(%rdi), %rax // jumpPC
44 jmpq *%rax
45 46 47 #ifdef __MACH__ // Darwin
48 // allow these symbols to stripped as dead code
49 .subsections_via_symbols
50 #endif
51