The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
panic.h File Reference
#include "common/stdint.h"

Go to the source code of this file.

Functions

bool panic_in_progress (void)
 check whether a core has started a panic.
void kernel_panic (const char *message) __attribute__((noreturn))
 trigger a kernel panic, display error message and halt the system.
void kernel_panic_at (const char *message, uintptr_t pc, uintptr_t caller, uintptr_t frame) __attribute__((noreturn))
 panic on behalf of a trapped context (cpu exception, page fault).

Function Documentation

◆ panic_in_progress()

bool panic_in_progress ( void )

check whether a core has started a panic.

the other cores then get an NMI (ARCH_IPI_STOP), and their NMI handler halts.

Returns
true from the start of the first panic.

◆ kernel_panic()

void kernel_panic ( const char * message)

trigger a kernel panic, display error message and halt the system.

prints a backtrace of the caller.

Parameters
messagedescription of the panic condition.

◆ kernel_panic_at()

void kernel_panic_at ( const char * message,
uintptr_t pc,
uintptr_t caller,
uintptr_t frame )

panic on behalf of a trapped context (cpu exception, page fault).

prints the faulting pc and a backtrace from the trapped frame instead of the handler's own stack.

Parameters
messagedescription of the panic condition.
pcthe faulting instruction address.
callera probable return address into the faulting function's caller, printed as an uncertain "?" entry, or 0. this recovers the caller when the fault hit a function without a frame of its own (a frameless leaf or a prologue).
framethe frame pointer at the fault, or 0 to skip the backtrace (e.g. the fault came from user mode).