diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-24 16:48:53 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-24 16:48:53 +0000 |
| commit | 9fcd505ab3106e9fbf586e6d16e53e3e44936215 (patch) | |
| tree | add54829625e90c27a1c11a160e9deb5e5877ae1 /kc/core/memory | |
| parent | 1923e47fd296399180eaf19b990d5e951d71ccd2 (diff) | |
context struct for ISRs rather than using param registers; second-stage handlers should deal with that i think
Diffstat (limited to 'kc/core/memory')
| -rw-r--r-- | kc/core/memory/memory.c | 19 |
1 files changed, 7 insertions, 12 deletions
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 <stdint.h> @@ -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; } |
