kernel/fxf and launcher: Add and use launch_fxf_from_disk syscall

This commit is contained in:
Ry 2023-03-22 22:18:33 -07:00
parent 22c8e1f820
commit 8103ec8bcd
5 changed files with 31 additions and 7 deletions

View File

@ -65,7 +65,12 @@ button_click_event:
; terminal ; terminal
cmp r1, 0 cmp r1, 0
ifz mov r0, terminal_button_fxf ifz mov r0, terminal_button_fxf
ifz call launch_fxf ifz mov r1, 0
ifz mov r2, 0
ifz mov r3, 0
ifz mov r4, 0
ifz mov r5, 0
ifz call launch_fxf_from_disk
ret ret
@ -101,7 +106,5 @@ button_text: data.strz " "
icons: icons:
#include "icons.inc" #include "icons.inc"
#include "launch.asm"
#include "../../../fox32rom/fox32rom.def" #include "../../../fox32rom/fox32rom.def"
#include "../../fox32os.def" #include "../../fox32os.def"

View File

@ -8,6 +8,7 @@ set_current_disk_id: jmp [0x0000081C]
; FXF jump table ; FXF jump table
parse_fxf_binary: jmp [0x00000910] parse_fxf_binary: jmp [0x00000910]
launch_fxf_from_disk: jmp [0x00000914]
; task jump table ; task jump table
new_task: jmp [0x00000A10] new_task: jmp [0x00000A10]

View File

@ -20,6 +20,7 @@ parse_fxf_binary:
fxf_magic: data.strz "FXF" fxf_magic: data.strz "FXF"
#include "fxf/launch.asm"
#include "fxf/reloc.asm" #include "fxf/reloc.asm"
const FXF_CODE_SIZE: 0x00000004 const FXF_CODE_SIZE: 0x00000004

View File

@ -1,11 +1,16 @@
; FXF launcher helper routines ; FXF launching routines
; launch an FXF binary from a file name ; launch an FXF binary from a file on disk
; inputs: ; inputs:
; r0: pointer to FXF binary name ; r0: pointer to FXF binary name (8.3 format, for example "testfile.fxf" or "test.fxf")
; r1: argument 0
; r2: argument 1
; r3: argument 2
; r4: argument 3
; r5: argument 4
; outputs: ; outputs:
; none ; none
launch_fxf: launch_fxf_from_disk:
push r0 push r0
push r1 push r1
push r2 push r2
@ -39,6 +44,19 @@ launch_fxf:
ifz jmp allocate_error ifz jmp allocate_error
mov [launch_fxf_stack_ptr], r0 mov [launch_fxf_stack_ptr], r0
; push the arguments to the task's stack
mov r4, rsp
mov rsp, [launch_fxf_stack_ptr]
add rsp, 65536 ; point to the end of the stack (stack grows down!!)
push r5
push r4
push r3
push r2
push r1
sub rsp, 65516
mov [launch_fxf_stack_ptr], rsp
mov rsp, r4
; relocate the binary ; relocate the binary
mov r0, [launch_fxf_binary_ptr] mov r0, [launch_fxf_binary_ptr]
call parse_fxf_binary call parse_fxf_binary

View File

@ -27,6 +27,7 @@ jump_table:
; FXF jump table ; FXF jump table
org.pad 0x00000110 org.pad 0x00000110
data.32 parse_fxf_binary data.32 parse_fxf_binary
data.32 launch_fxf_from_disk
; task jump table ; task jump table
org.pad 0x00000210 org.pad 0x00000210