Fix tasking_new_process overwrting address space argument

This commit is contained in:
pjht 2024-03-20 07:30:26 -05:00
parent 1c73092c2d
commit f62ace3fc5
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -44,6 +44,10 @@ tasking_new_process:
move.l #32, d0 ; Allocate space for the task data
jsr malloc
tnp_malloc_done:
move.l #0, (task.secondary_address_space,a0)
move.l #0, (task.secondary_address_space+4,a0)
move.l #0, (task.secondary_address_space+8,a0)
move.l #0, (task.secondary_address_space+12,a0)
movem.l (a7)+, a1/a2
move.w next_pid, d0 ; Get the next free PID
move.w d0, (task.pid,a0)
@ -87,15 +91,16 @@ tnp_malloc_done:
move.l d0, (task.stack_ptr,a0)
move.l #0, (task.next_ptr,a0)
; Unmap the temporary stack mapping
move.l a0, -(a7)
movem.l a0/a1, -(a7)
move.l a3, d0 ; Put the page number of the temporary page into a0
and.l #~($FFF), d0
move.l d0, a0
move.l #1, d0
move.l #0, d1
jsr vmem_unmap
move.l (a7)+, a0
movem.l (a7)+, a0/a1
move.l #15, d1 ; Put the address space size - 1 in d1
tnp_as_copy:
lea.l (task.address_space,a0), a2 ; Put the address of the task address space in a2
.1:
move.b (a1)+, (a2)+