[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:
Justin C. Miller
2022-01-15 09:33:38 -08:00
parent 421fe33dc0
commit 4d9b33ecd4
8 changed files with 32 additions and 19 deletions

View File

@@ -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