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
+2 -2
View File
@@ -13,7 +13,7 @@ func trap()
// Inline assembly stub. It is essentially C longjmp but modified a bit for the
// purposes of TinyGo. It restores the stack pointer and jumps to the given pc.
//export tinygo_longjmp
func tinygo_longjmp(sp, pc unsafe.Pointer)
func tinygo_longjmp(frame *task.DeferFrame)
// Compiler intrinsic.
// Returns whether recover is supported on the current architecture.
@@ -26,7 +26,7 @@ func _panic(message interface{}) {
if frame != nil {
frame.PanicValue = message
frame.Panicking = true
tinygo_longjmp(frame.JumpSP, frame.JumpPC)
tinygo_longjmp(frame)
// unreachable
}
}