Skip to content

Commit b387340

Browse files
author
Noam Preil
committed
Panic if launchProgram("/bin/init") fails at boot
1 parent e257f54 commit b387340

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/defines.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ panic_init_not_found .equ 0
3838
panic_no_threads .equ 1
3939
panic_no_active_threads .equ 2
4040
panic_library_not_found .equ 3
41+
panic_failed_init .equ 4
4142

4243
; KEXC headers
4344
; 0x00-0x7F reserved for kernel use

src/00/boot.asm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,14 @@ reboot:
120120
ld a, panic_init_not_found
121121
jp nz, panic
122122
call launchProgram
123+
jr nz, init_failed
123124
ld h, 0
124125
call setInitialA
125126
jp contextSwitch_manual
126127

128+
init_failed:
129+
ld a, panic_failed_init
130+
jp panic
131+
127132
init:
128133
.db "/bin/init", 0

src/00/panic.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ errorTable:
123123
.dw no_threads_text
124124
.dw no_active_threads_text
125125
.dw library_not_found_text
126+
.dw init_failed_text
126127

127128
init_not_found_text:
128129
.db "/bin/init not found", 0
@@ -132,6 +133,8 @@ no_active_threads_text:
132133
.db "No active threads", 0
133134
library_not_found_text:
134135
.db "Library not loaded", 0
136+
init_failed_text:
137+
.db "Error launching /bin/init", 0
135138

136139
sad_calc:
137140
.db 0x7f,0xc0

0 commit comments

Comments
 (0)