mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-10 06:29:32 +00:00
runtime: support panic recovery on Xtensa
Use picolibc setjmp and longjmp to save and restore the complete Xtensa register-window state at TinyGo panic checkpoints. Provide the target configuration and window spill helper required by picolibc. Increment its cache version because Xtensa archives now include another source file.
This commit is contained in:
@@ -11,7 +11,9 @@ const zeroSizeAllocPtr uintptr = 16 // part of early flash: partition table, etc
|
||||
// The bitness of the CPU (e.g. 8, 32, 64).
|
||||
const TargetBits = 32
|
||||
|
||||
const deferExtraRegs = 0
|
||||
// Xtensa's windowed ABI uses a 17-word jmp_buf. JumpSP and JumpPC provide the
|
||||
// first two words.
|
||||
const deferExtraRegs = 15
|
||||
|
||||
const callInstSize = 3 // "callx0 someFunction" (and similar) is 3 bytes
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifdef __XTENSA_WINDOWED_ABI__
|
||||
.section .text.__xtensa_libgcc_window_spill,"ax",@progbits
|
||||
.global __xtensa_libgcc_window_spill
|
||||
.type __xtensa_libgcc_window_spill, %function
|
||||
__xtensa_libgcc_window_spill:
|
||||
entry sp, 16
|
||||
movi a6, 15
|
||||
call4 .Lspill_windows
|
||||
retw
|
||||
.size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill
|
||||
|
||||
.balign 4
|
||||
.Lspill_windows:
|
||||
entry sp, 16
|
||||
beqz a2, .Lspill_done
|
||||
addi a2, a2, -1
|
||||
mov a6, a2
|
||||
call4 .Lspill_windows
|
||||
.Lspill_done:
|
||||
retw
|
||||
#endif
|
||||
|
||||
.section .text.tinygo_longjmp,"ax",@progbits
|
||||
.global tinygo_longjmp
|
||||
.type tinygo_longjmp, %function
|
||||
tinygo_longjmp:
|
||||
#ifdef __XTENSA_WINDOWED_ABI__
|
||||
// longjmp's entry rotates a10/a11 into its a2/a3 arguments.
|
||||
movi a11, 1
|
||||
#else
|
||||
movi a3, 1
|
||||
#endif
|
||||
j longjmp
|
||||
.size tinygo_longjmp, .-tinygo_longjmp
|
||||
Reference in New Issue
Block a user