fix (kernel): Added cpu_state NULL check in panic screen

This commit is contained in:
antifallobst 2023-02-12 09:51:32 +01:00
parent 2d9b9144e2
commit 5eab21e98a
1 changed files with 8 additions and 2 deletions

View File

@ -57,9 +57,15 @@ void panic_log_registers(cpu_state_T* state) {
void panic(cpu_state_T* state, string_t message) { void panic(cpu_state_T* state, string_t message) {
log(LOG_ERROR, "!=====[ KERNEL PANIC ]=====!"); log(LOG_ERROR, "!=====[ KERNEL PANIC ]=====!");
log(LOG_NONE, "Error Message: %s", message);
if (state == NULL) {
log(LOG_WARNING, "No detailed Information available (cpu_state null reference)");
CORE_HALT_FOREVER
}
log(LOG_NONE, "Interrupt ID: 0x%xb", state->interrupt_id); log(LOG_NONE, "Interrupt ID: 0x%xb", state->interrupt_id);
log(LOG_NONE, "Error Code: 0b%.32b", state->error_code); log(LOG_NONE, "Error Code: 0b%.32b\n", state->error_code);
log(LOG_NONE, "Error Message: %s\n", message);
panic_log_paging_info(state); panic_log_paging_info(state);