Skip to content

Commit

Permalink
Panic if launchProgram("/bin/init") fails at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
Noam Preil committed Jan 29, 2020
1 parent e257f54 commit b387340
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/defines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ panic_init_not_found .equ 0
panic_no_threads .equ 1
panic_no_active_threads .equ 2
panic_library_not_found .equ 3
panic_failed_init .equ 4

; KEXC headers
; 0x00-0x7F reserved for kernel use
Expand Down
5 changes: 5 additions & 0 deletions src/00/boot.asm
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,14 @@ reboot:
ld a, panic_init_not_found
jp nz, panic
call launchProgram
jr nz, init_failed
ld h, 0
call setInitialA
jp contextSwitch_manual

init_failed:
ld a, panic_failed_init
jp panic

init:
.db "/bin/init", 0
3 changes: 3 additions & 0 deletions src/00/panic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ errorTable:
.dw no_threads_text
.dw no_active_threads_text
.dw library_not_found_text
.dw init_failed_text

init_not_found_text:
.db "/bin/init not found", 0
Expand All @@ -132,6 +133,8 @@ no_active_threads_text:
.db "No active threads", 0
library_not_found_text:
.db "Library not loaded", 0
init_failed_text:
.db "Error launching /bin/init", 0

sad_calc:
.db 0x7f,0xc0
Expand Down

0 comments on commit b387340

Please sign in to comment.