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:
; none
debug_print:
push r0
push r1
debug_print_loop:
mov r1, 0x00000000
@ -14,4 +15,5 @@ debug_print_loop:
cmp.8 [r0], 0x00
ifnz jmp debug_print_loop
pop r1
ret
pop r0
ret

View File

@ -1,6 +1,6 @@
; panic routines
; panic and hang
; panic invoke the monitor
; inputs:
; r0: pointer to null-terminated string, or zero for none
; outputs:
@ -10,8 +10,8 @@ panic:
cmp r0, 0
ifz mov r0, panic_string
call debug_print
panic_loop:
jmp panic_loop
halt
call print_string_to_monitor
call invoke_monitor
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