mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
compiler: implement recover() built-in function
This commit is contained in:
committed by
Ron Evans
parent
79ba6a50c3
commit
8d6b210c09
@@ -0,0 +1,46 @@
|
||||
// Only generate .debug_frame, don't generate .eh_frame.
|
||||
.cfi_sections .debug_frame
|
||||
|
||||
.section .text.tinygo_scanCurrentStack
|
||||
.global tinygo_scanCurrentStack
|
||||
.type tinygo_scanCurrentStack, %function
|
||||
tinygo_scanCurrentStack:
|
||||
.cfi_startproc
|
||||
// Save callee-saved registers onto the stack.
|
||||
#if defined(__thumb2__)
|
||||
push {r4-r11, lr}
|
||||
.cfi_def_cfa_offset 9*4
|
||||
#else
|
||||
mov r0, r8
|
||||
mov r1, r9
|
||||
mov r2, r10
|
||||
mov r3, r11
|
||||
push {r0-r3, lr}
|
||||
.cfi_def_cfa_offset 5*4
|
||||
push {r4-r7}
|
||||
.cfi_def_cfa_offset 4*4
|
||||
#endif
|
||||
|
||||
// Scan the stack.
|
||||
mov r0, sp
|
||||
bl tinygo_scanstack
|
||||
|
||||
// Restore stack state and return.
|
||||
add sp, #32
|
||||
.cfi_def_cfa_offset 1*4
|
||||
pop {pc}
|
||||
.cfi_endproc
|
||||
.size tinygo_scanCurrentStack, .-tinygo_scanCurrentStack
|
||||
|
||||
|
||||
.section .text.tinygo_longjmp
|
||||
.global tinygo_longjmp
|
||||
.type tinygo_longjmp, %function
|
||||
tinygo_longjmp:
|
||||
.cfi_startproc
|
||||
// Note: the code we jump to assumes r0 is set to a non-zero value if we
|
||||
// jump from here (which is conveniently already the case).
|
||||
mov sp, r0 // jumpSP
|
||||
mov pc, r1 // jumpPC
|
||||
.cfi_endproc
|
||||
.size tinygo_longjmp, .-tinygo_longjmp
|
||||
Reference in New Issue
Block a user