From 9fcd505ab3106e9fbf586e6d16e53e3e44936215 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Thu, 24 Feb 2022 16:48:53 +0000 Subject: context struct for ISRs rather than using param registers; second-stage handlers should deal with that i think --- kc/core/memory/memory.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'kc/core/memory') diff --git a/kc/core/memory/memory.c b/kc/core/memory/memory.c index 1a33629..0fbc941 100644 --- a/kc/core/memory/memory.c +++ b/kc/core/memory/memory.c @@ -15,6 +15,7 @@ #include "panic.h" #include "vm_object.h" #include "cpu/mmu.h" +#include "cpu/exceptions.h" #include @@ -589,10 +590,8 @@ int anonymous_page_handler( return 0; } -int page_fault_handler(uint8_t vector, uint32_t code) +void page_fault_handler(struct isr_context *context) { - (void)vector; - void *address; __asm__ volatile ("movq %%cr2, %0" : "=r"(address)); @@ -601,28 +600,24 @@ int page_fault_handler(uint8_t vector, uint32_t code) if (!node) { - kprintf("error: page fault in unmanaged address %#lx\n", - address); + print_exception_context(context); + kprintf("error: page fault in unmanaged address %#lx\n", address); PANIC(UNHANDLED_FAULT); } if (!node->object->handler) { + print_exception_context(context); kprintf("error: vm object at %p has no fault handler\n"); PANIC(UNHANDLED_FAULT); } - - return node->object->handler(node, code, address); } -int general_protection_handler(uint8_t vector, uint32_t code) +void general_protection_handler(struct isr_context *context) { //TODO: implement #gp handler - (void)vector; - (void)code; - kputs("general protection violation\n"); + print_exception_context(context); PANIC(UNHANDLED_FAULT); - return 0; } -- cgit v1.3.1-1-g115d