Invoke the monitor on panic

This commit is contained in:
Ry 2022-06-23 15:42:56 -07:00
parent ad0571d420
commit ac337bc340
2 changed files with 8 additions and 6 deletions

View File

@ -6,6 +6,7 @@
; outputs: ; outputs:
; none ; none
debug_print: debug_print:
push r0
push r1 push r1
debug_print_loop: debug_print_loop:
mov r1, 0x00000000 mov r1, 0x00000000
@ -14,4 +15,5 @@ debug_print_loop:
cmp.8 [r0], 0x00 cmp.8 [r0], 0x00
ifnz jmp debug_print_loop ifnz jmp debug_print_loop
pop r1 pop r1
ret pop r0
ret

View File

@ -1,6 +1,6 @@
; panic routines ; panic routines
; panic and hang ; panic invoke the monitor
; inputs: ; inputs:
; r0: pointer to null-terminated string, or zero for none ; r0: pointer to null-terminated string, or zero for none
; outputs: ; outputs:
@ -10,8 +10,8 @@ panic:
cmp r0, 0 cmp r0, 0
ifz mov r0, panic_string ifz mov r0, panic_string
call debug_print call debug_print
panic_loop: call print_string_to_monitor
jmp panic_loop call invoke_monitor
halt rjmp 0
panic_string: data.str "Panic occurred!" data.8 10 data.8 0 panic_string: data.str "Unspecified panic occurred!" data.8 10 data.8 0