Add support for processes setting up an address space to spawn new processes

This commit is contained in:
pjht 2024-03-19 13:09:43 -05:00
parent 000ac6ad65
commit 4b67fd4695
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A
3 changed files with 22 additions and 0 deletions

View File

@ -62,6 +62,17 @@ syscall_vmem_set_flags:
move.l #0, d2 move.l #0, d2
jmp vmem_set_flags jmp vmem_set_flags
; Copies the range of page mappings at address a0 in the primary space with length d1 to the secondary space starting at address a1
syscall_vmem_copy_to_secondary:
movem.l a0/a1/d1, -(a7)
jsr tasking_get_secondary_addr_space
jsr vmem_set_secondary_addr_space
movem.l (a7)+, a0/a1/d1
move.l d1, d0
jsr vmem_copy_to_secondary
rts
section .data,data section .data,data
syscall_table: syscall_table:
align 1 align 1
@ -73,3 +84,4 @@ syscall_table:
dc.l syscall_vmem_map_free dc.l syscall_vmem_map_free
dc.l syscall_vmem_map_free_to dc.l syscall_vmem_map_free_to
dc.l syscall_vmem_set_flags dc.l syscall_vmem_set_flags
dc.l syscall_vmem_copy_to_secondary

View File

@ -4,6 +4,7 @@ task.stack_frame: so.l 1
task.stack_ptr: so.l 1 task.stack_ptr: so.l 1
task.next_ptr: so.l 1 task.next_ptr: so.l 1
task.address_space: so.l 4 task.address_space: so.l 4
task.secondary_address_space: so.l 4
task.sizeof equ __SO task.sizeof equ __SO
include term.i include term.i
@ -176,6 +177,13 @@ tasking_exit:
movem.l (a7)+, d2-d7/a2-a6 movem.l (a7)+, d2-d7/a2-a6
rts rts
; Gets the secondary address space of the current process in a0
public tasking_get_secondary_addr_space
tasking_get_secondary_addr_space:
move.l current_process, a0
lea.l (task.secondary_address_space,a0), a0
rts
; Push the process pointed to by a0 onto the head of the ready to run list ; Push the process pointed to by a0 onto the head of the ready to run list
rtr_push_head: rtr_push_head:
cmp.l #0, ready_to_run_head cmp.l #0, ready_to_run_head

View File

@ -10,4 +10,6 @@ TASKING_I equ 1
xref tasking_yield xref tasking_yield
; Exits the current process ; Exits the current process
xref tasking_exit xref tasking_exit
; Gets the secondary address space of the current process in a0
xref tasking_get_secondary_addr_space
endif endif