mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[panic] Allow assert/panic to take optional user cpu_state
In places where the "user" state is available, like interrupt handlers, panic() and kassert() can now take an optional pointer to that user cpu_state structure, and the panic handler will print that out as well.
This commit is contained in:
@@ -22,13 +22,7 @@ panicking::symbol_table &syms = __syms_storage.value;
|
||||
constexpr int order = __ATOMIC_ACQ_REL;
|
||||
|
||||
extern "C"
|
||||
void panic_handler(
|
||||
const void *symbol_data,
|
||||
const char *message,
|
||||
const char *function,
|
||||
const char *file,
|
||||
uint64_t line,
|
||||
const cpu_state *regs)
|
||||
void panic_handler(const cpu_state *regs)
|
||||
{
|
||||
cpu_data &cpu = current_cpu();
|
||||
panic_data *panic = cpu.panic;
|
||||
@@ -57,6 +51,9 @@ void panic_handler(
|
||||
print_callstack(com1, syms, fp);
|
||||
print_cpu_state(com1, *regs);
|
||||
|
||||
if (panic && panic->user_state)
|
||||
print_user_state(com1, *panic->user_state);
|
||||
|
||||
__atomic_clear(&asserting_locked, order);
|
||||
|
||||
// If we're running on the CPU that panicked, tell the
|
||||
|
||||
Reference in New Issue
Block a user