1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Redirect runtime.throw to kernel.Panic via kernel.panicString

This commit is contained in:
Achilleas Anagnostopoulos 2017-06-26 08:09:21 +01:00
parent ce34763e23
commit 5e5e9f1c0b

View File

@ -23,8 +23,8 @@ func Panic(e interface{}) {
case *Error:
err = t
case string:
errRuntimePanic.Message = t
err = errRuntimePanic
panicString(t)
return
case error:
errRuntimePanic.Message = t.Error()
err = errRuntimePanic
@ -39,3 +39,10 @@ func Panic(e interface{}) {
cpuHaltFn()
}
// panicString serves as a redirect target for runtime.throw
//go:redirect-from runtime.throw
func panicString(msg string) {
errRuntimePanic.Message = msg
Panic(errRuntimePanic)
}