From 1899ed0f6719cd7b9b778cb5dd95821b6cff8f4e Mon Sep 17 00:00:00 2001 From: Ry Date: Sun, 22 Jan 2023 16:32:05 -0800 Subject: [PATCH] Show the actual rip value in the monitor when an exception occurs --- exception.asm | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/exception.asm b/exception.asm index 3b6c97a..628534f 100644 --- a/exception.asm +++ b/exception.asm @@ -3,23 +3,41 @@ ; called if a divide by zero occurs ; does not return, calls panic system_div_zero_handler: + push r0 + mov r0, system_div_zero_str - jmp panic + call debug_print + call print_string_to_monitor + + pop r0 + jmp system_breakpoint_handler system_div_zero_str: data.str "Divide by zero" data.8 10 data.8 0 ; called if an invalid opcode is executed ; does not return, calls panic system_invalid_op_handler: + push r0 + mov r0, system_invalid_op_str - jmp panic + call debug_print + call print_string_to_monitor + + pop r0 + jmp system_breakpoint_handler system_invalid_op_str: data.str "Invalid opcode" data.8 10 data.8 0 ; called if a page fault occurs ; does not return, calls panic system_page_fault_handler: + push r0 + mov r0, system_page_fault_str + call debug_print + call print_string_to_monitor + + pop r0 pop r1 - jmp panic + jmp system_breakpoint_handler system_page_fault_str: data.str "Page fault at virtual address r1" data.8 10 data.8 0 ; called upon execution of a `brk` instruction