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).
This commit is contained in:
Ayke van Laethem
2022-06-17 01:28:14 +02:00
committed by Ron Evans
parent c119721e3b
commit 49e22fe678
7 changed files with 24 additions and 19 deletions
+5 -5
View File
@@ -37,11 +37,11 @@ tinygo_longjmp:
.global _tinygo_longjmp
_tinygo_longjmp:
#endif
// Note: the code we jump to assumes rax is non-zero so we have to load it
// with some value here.
movq $1, %rax
movq %rdi, %rsp // jumpSP
jmpq *%rsi // jumpPC
// 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(%rdi), %rsp // jumpSP
movq 8(%rdi), %rax // jumpPC
jmpq *%rax
#ifdef __MACH__ // Darwin