mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-11 15:09:32 +00:00
29b4c6723f
Modify the Unix signal handler to redirect execution to a Go sigpanic function instead of printing an error and re-raising the signal. The C signal handler modifies the ucontext to make the faulting instruction appear to have called tinygo_sigpanic, which then calls runtimePanic with the appropriate message. Supported on all architectures TinyGo targets on Linux and Darwin: x86_64, i386, aarch64, ARM, and MIPS. Also registers SIGFPE, which was previously not handled at all.
28 lines
545 B
Go
28 lines
545 B
Go
package runtime
|
|
|
|
const GOARCH = "mipsle"
|
|
|
|
// The bitness of the CPU (e.g. 8, 32, 64).
|
|
const TargetBits = 32
|
|
|
|
const deferExtraRegs = 0
|
|
|
|
const callInstSize = 8 // "jal someFunc" is 4 bytes, plus a MIPS delay slot
|
|
|
|
const (
|
|
linux_MAP_ANONYMOUS = 0x800
|
|
linux_SIGBUS = 10
|
|
linux_SIGFPE = 8
|
|
linux_SIGILL = 4
|
|
linux_SIGSEGV = 11
|
|
)
|
|
|
|
// It appears that MIPS has a maximum alignment of 8 bytes.
|
|
func align(ptr uintptr) uintptr {
|
|
return (ptr + 7) &^ 7
|
|
}
|
|
|
|
func getCurrentStackPointer() uintptr {
|
|
return uintptr(stacksave())
|
|
}
|