[panic] Have panics stop all cores
Kernel panics previously only stopped the calling core. This commit re-implements the panic system to allow us to stop all cores on a panic. Changes include: - panic now sends an NMI to all cores. This means we can't control the contents of their registers, so panic information has been moved to a global struct, and the panicking cpu sets the pointer to that data in its cpu_data. - the panic_handler is now set up with mutexes to print appropriately and only initialize objects once. - copying _current_gsbase into the panic handler, and #including the cpprt.cpp file (so that we can define NDEBUG and not have it try to link the assert code back in) - making the symbol data pointer in kargs an actual pointer again, not an address - and carrying that through to the panic handler - the number of cpus is now saved globally in the kernel as g_num_cpus
This commit is contained in:
@@ -18,6 +18,20 @@ struct cpu_state
|
||||
uint64_t rip, cs, rflags, rsp, ss;
|
||||
};
|
||||
|
||||
/// Kernel-wide panic information
|
||||
struct panic_data
|
||||
{
|
||||
void const * symbol_data;
|
||||
char const * message;
|
||||
char const * function;
|
||||
char const * file;
|
||||
uint32_t line;
|
||||
uint16_t cpus;
|
||||
};
|
||||
|
||||
extern unsigned g_num_cpus;
|
||||
extern panic_data *g_panic_data_p;
|
||||
|
||||
/// Per-cpu state data. If you change this, remember to update the assembly
|
||||
/// version in 'tasking.inc'
|
||||
struct cpu_data
|
||||
@@ -39,6 +53,7 @@ struct cpu_data
|
||||
// Members beyond this point do not appear in
|
||||
// the assembly version
|
||||
lapic *apic;
|
||||
panic_data *panic;
|
||||
};
|
||||
|
||||
extern "C" cpu_data * _current_gsbase();
|
||||
|
||||
Reference in New Issue
Block a user