mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Defer kernel panic when Kmain returns
This commit is contained in:
parent
ccba8877ce
commit
66d471f442
@ -39,10 +39,13 @@ func Kmain(multibootInfoPtr, kernelStart, kernelEnd, kernelPageOffset uintptr) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Detect and initialize hardware
|
||||
hal.DetectHardware()
|
||||
|
||||
// After goruntime.Init returns we can safely use defer
|
||||
defer func() {
|
||||
// Use kfmt.Panic instead of panic to prevent the compiler from
|
||||
// treating kernel.Panic as dead-code and eliminating it.
|
||||
kfmt.Panic(errKmainReturned)
|
||||
}()
|
||||
|
||||
// Detect and initialize hardware
|
||||
hal.DetectHardware()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user