kernel/main: Detect if disk 1 is a valid FXF binary before running it
This commit is contained in:
parent
e1da81f314
commit
5708227a61
|
@ -153,14 +153,14 @@ draw_bottom_bar_loop:
|
||||||
in r31, 0x80001001
|
in r31, 0x80001001
|
||||||
cmp r31, 0
|
cmp r31, 0
|
||||||
ifnz jmp boot_disk_1
|
ifnz jmp boot_disk_1
|
||||||
|
try_startup:
|
||||||
; open startup.cfg
|
; open startup.cfg
|
||||||
mov r0, startup_cfg
|
mov r0, startup_cfg
|
||||||
mov r1, 0
|
mov r1, 0
|
||||||
mov r2, startup_cfg_struct
|
mov r2, startup_cfg_struct
|
||||||
call ryfs_open
|
call ryfs_open
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
ifz jmp boot_disk_1
|
ifz jmp startup_error
|
||||||
|
|
||||||
; load a startup task
|
; load a startup task
|
||||||
load_startup_task:
|
load_startup_task:
|
||||||
|
@ -242,7 +242,7 @@ no_other_tasks:
|
||||||
; this does not return.
|
; this does not return.
|
||||||
call end_current_task_no_mark_no_free
|
call end_current_task_no_mark_no_free
|
||||||
|
|
||||||
; if startup.cfg is invalid, try loading the raw contents of disk 1 as an FXF binary
|
; try loading the raw contents of disk 1 as an FXF binary
|
||||||
; if disk 1 is not inserted, then fail
|
; if disk 1 is not inserted, then fail
|
||||||
boot_disk_1:
|
boot_disk_1:
|
||||||
; check if a disk is inserted as disk 1
|
; check if a disk is inserted as disk 1
|
||||||
|
@ -277,6 +277,8 @@ boot_disk_1_loop:
|
||||||
mov r1, r5
|
mov r1, r5
|
||||||
mov r0, r5
|
mov r0, r5
|
||||||
call parse_fxf_binary
|
call parse_fxf_binary
|
||||||
|
cmp r0, 0
|
||||||
|
ifz jmp disk_1_is_not_fxf
|
||||||
mov r3, r1
|
mov r3, r1
|
||||||
mov r1, r0
|
mov r1, r0
|
||||||
movz.8 r0, [next_task_id]
|
movz.8 r0, [next_task_id]
|
||||||
|
@ -286,6 +288,13 @@ boot_disk_1_loop:
|
||||||
call new_task
|
call new_task
|
||||||
jmp no_other_tasks
|
jmp no_other_tasks
|
||||||
|
|
||||||
|
; disk 1 was found to not be a valid FXF binary
|
||||||
|
; free the memory allocated for it and instead just keep it mounted as a disk
|
||||||
|
disk_1_is_not_fxf:
|
||||||
|
mov r0, r5
|
||||||
|
call free_memory
|
||||||
|
jmp try_startup
|
||||||
|
|
||||||
startup_error:
|
startup_error:
|
||||||
mov r0, BACKGROUND_COLOR
|
mov r0, BACKGROUND_COLOR
|
||||||
call fill_background
|
call fill_background
|
||||||
|
|
Loading…
Reference in New Issue
Block a user