diff --git a/syscalls.68k b/syscalls.68k index 80ca99b..eb2cafd 100644 --- a/syscalls.68k +++ b/syscalls.68k @@ -62,6 +62,17 @@ syscall_vmem_set_flags: move.l #0, d2 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 syscall_table: align 1 @@ -73,3 +84,4 @@ syscall_table: dc.l syscall_vmem_map_free dc.l syscall_vmem_map_free_to dc.l syscall_vmem_set_flags + dc.l syscall_vmem_copy_to_secondary diff --git a/tasking.68k b/tasking.68k index b01d704..a084206 100644 --- a/tasking.68k +++ b/tasking.68k @@ -4,6 +4,7 @@ task.stack_frame: so.l 1 task.stack_ptr: so.l 1 task.next_ptr: so.l 1 task.address_space: so.l 4 +task.secondary_address_space: so.l 4 task.sizeof equ __SO include term.i @@ -176,6 +177,13 @@ tasking_exit: movem.l (a7)+, d2-d7/a2-a6 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 rtr_push_head: cmp.l #0, ready_to_run_head diff --git a/tasking.i b/tasking.i index f0373aa..fa9ab14 100644 --- a/tasking.i +++ b/tasking.i @@ -10,4 +10,6 @@ TASKING_I equ 1 xref tasking_yield ; Exits the current process xref tasking_exit +; Gets the secondary address space of the current process in a0 + xref tasking_get_secondary_addr_space endif