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
+4 -3
View File
@@ -46,6 +46,7 @@ tinygo_scanCurrentStack:
.global tinygo_longjmp
tinygo_longjmp:
// Note: the code we jump to assumes a0 is non-zero, which is already the
// case because that's jumpSP (the stack pointer).
mv sp, a0 // jumpSP
jr a1 // jumpPC
// case because that's the defer frame pointer.
lw sp, 0(a0) // jumpSP
lw a1, REGSIZE(a0) // jumpPC
jr a1