feature (kernel): Extended panic screen page fault information

This commit is contained in:
antifallobst 2023-02-25 00:12:42 +01:00
parent f3c73f5e52
commit 22d0c9e90c
1 changed files with 14 additions and 1 deletions

View File

@ -16,10 +16,23 @@
#include "utils/panic.h"
#include "utils/logger.h"
#include "utils/core.h"
#include "platform/exceptions.h"
void panic_log_paging_info(cpu_state_T* state) {
log(LOG_NONE, "Paging Info:");
log(LOG_NONE, " Page Map: 0x%x\n", state->cr3);
log(LOG_NONE, " Page Map: 0x%x", state->cr3);
if (state->interrupt_id == EXCEPTION_PAGE_FAULT) {
uint64_t cr2;
asm("mov %%cr2, %0" : "=r" (cr2));
log(LOG_NONE, " Page Fault Info:");
log(LOG_NONE, " %s", state->error_code & (1 << 0) ? "Page protection violation" : "Non present page access");
log(LOG_NONE, " %s", state->error_code & (1 << 1) ? "Write" : "Read");
log(LOG_NONE, " Address: 0x%x", cr2);
}
log(LOG_NONE, ""); // newline
}
void panic_log_eflags(cpu_state_T* state) {