refactor(architecture): adopt canonical Linux enterprise directory layout (arch, drivers, fs, mm, kernel, lib, security, scripts, tools)

This commit is contained in:
Adam Eehan committed 2026-10-23 18:23:16 +05:30
1 parent 67ed4de23f
commit 2bbeb3f345
17 files changed
+217 -9

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#include <airlys/vmm.h>
#include <airlys/vga.h>
#include <airlys/kernel.h>
static void page_fault_handler(registers_t* regs) {
uintptr_t faulting_addr = read_cr2();
bool present = (regs->err_code & 0x1) != 0;
bool write = (regs->err_code & 0x2) != 0;
bool user = (regs->err_code & 0x4) != 0;
bool reserved = (regs->err_code & 0x8) != 0;
bool ifetch = (regs->err_code & 0x10) != 0;
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("\n\n [FATAL] PAGE FAULT (#PF) DETECTED!\n");
vga_puts(" ----------------------------------------------------\n");
vga_puts(" Faulting Virtual Address (CR2) : ");
vga_puthex(faulting_addr);
vga_puts("\n Error Code : ");
vga_puthex(regs->err_code);
vga_puts("\n Flags: ");
if (!present) vga_puts("[Not Present] ");
else vga_puts("[Protection Violation] ");
if (write) vga_puts("[Write] ");
else vga_puts("[Read] ");
if (user) vga_puts("[User Ring3] ");
else vga_puts("[Kernel Ring0] ");
if (reserved) vga_puts("[Reserved Bit] ");
if (ifetch) vga_puts("[Instruction Fetch] ");
vga_puts("\n ----------------------------------------------------\n");
kernel_panic("Kernel unhandled page fault access violation");
}
void vmm_init(void) {
/* Register Page Fault handler on CPU Exception Vector 14 */
register_interrupt_handler(14, page_fault_handler);
}