Files
tinygo/src/runtime/asm_386.S
T
Jake Bailey 16eefc59eb runtime, testing: support Goexit, SkipNow, FailNow
Keep a pending Goexit separate from the active panic state so recovered
deferred panics do not cancel the original Goexit unwind. Goexit should
also ignore -panic=trap, since it is not a panic.

Wire testing.FailNow and SkipNow through runtime.Goexit, and run tests
and benchmarks in goroutines. This lets Goexit terminate the user
function without skipping test bookkeeping. Add Goexit/recover coverage
and enable crypto/ecdh in the Linux stdlib test list.
2026-07-11 11:53:33 +02:00

53 lines
1.3 KiB
ArmAsm

#ifdef _WIN32
.global _tinygo_scanCurrentStack
_tinygo_scanCurrentStack:
#else
.section .text.tinygo_scanCurrentStack
.global tinygo_scanCurrentStack
.type tinygo_scanCurrentStack, %function
tinygo_scanCurrentStack:
#endif
// Sources:
// * https://stackoverflow.com/questions/18024672/what-registers-are-preserved-through-a-linux-x86-64-function-call
// * https://godbolt.org/z/q7e8dn
// Save callee-saved registers.
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
// Scan the stack.
subl $8, %esp // adjust the stack before the call to maintain 16-byte alignment
pushl %esp
#ifdef _WIN32
calll _tinygo_scanstack
#else
calll tinygo_scanstack
#endif
// Restore the stack pointer. Registers do not need to be restored as they
// were only pushed to be discoverable by the GC.
addl $28, %esp
retl
#ifdef _WIN32
.global _tinygo_longjmp
_tinygo_longjmp:
#else
.section .text.tinygo_longjmp
.global tinygo_longjmp
tinygo_longjmp:
#endif
// Note: the code we jump to assumes eax is set to a non-zero value if we
// jump from here.
movl 4(%esp), %eax
movl 8(%eax), %ebx
movl 12(%eax), %esi
movl 16(%eax), %edi
movl 20(%eax), %ebp
movl 0(%eax), %esp // jumpSP
movl 4(%eax), %eax // jumpPC (stash in volatile register)
jmpl *%eax