Files
tinygo/src/runtime/arch_mips.go
T
Ayke van Laethem 194396d715 unix: print a message when a fatal signal happens
Print a message for SIGBUS, SIGSEGV, and SIGILL when they happen.
These signals are always fatal, but it's very useful to know which of
them happened.

Also, it prints the location in the binary which can then be parsed by
`tinygo run` (see https://github.com/tinygo-org/tinygo/pull/4383).

While this does add some extra binary size, it's for Linux and MacOS
(systems that typically have plenty of RAM/storage) and could be very
useful when debugging some low-level crash such as a runtime bug.
2024-08-15 02:00:28 +02:00

27 lines
518 B
Go

package runtime
const GOARCH = "mips"
// 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_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())
}