tinygo/src/runtime/asm_amd64_windows.S
Ayke van Laethem 49e22fe678 runtime: load sp and pc inside tinygo_longjmp
This is a small change to make it easier to support architectures that
need to restore more than just the sp and pc registers. In particular,
it is needed for the AVR architecture that needs to restore the frame
pointer (Y register).
2022-06-19 11:51:12 +02:00

31 строка
880 Б
ArmAsm

.section .text.tinygo_scanCurrentStack,"ax"
.global tinygo_scanCurrentStack
tinygo_scanCurrentStack:
// Save callee-saved registers.
pushq %rbx
pushq %rbp
pushq %rdi
pushq %rsi
pushq %r12
pushq %r13
pushq %r14
pushq %r15
// Scan the stack.
subq $8, %rsp // adjust the stack before the call to maintain 16-byte alignment
movq %rsp, %rdi
callq tinygo_scanstack
// Restore the stack pointer. Registers do not need to be restored as they
// were only pushed to be discoverable by the GC.
addq $72, %rsp
retq
.section .text.tinygo_longjmp,"ax"
.global tinygo_longjmp
tinygo_longjmp:
// Note: the code we jump to assumes rax is set to a non-zero value if we
// jump from here, so we use rax as the temporary value for jumpPC.
movq 0(%rcx), %rsp // jumpSP
movq 8(%rcx), %rax // jumpPC
jmpq *%rax