Loading processes from within their memory space

The scheduler's create_process now sets up the stack to iretq into a
load_process function, which will load the process image into memory
from within the process' own virtual memory space. Currently this
loading is just copying the old 'taskA' function from kernel space.
This commit is contained in:
Justin C. Miller
2018-09-05 10:09:00 -07:00
parent f1b84ab370
commit 5d861d243a
2 changed files with 86 additions and 28 deletions

View File

@@ -192,9 +192,24 @@ syscall_enable:
mov rdx, 0
wrmsr
ret
extern load_process
global ramdisk_process_loader
ramdisk_process_loader:
; create_process already pushed a cpu_state onto the stack for us, this
; acts both as the cpu_state parameter to load_process, and the saved
; state for the following iretq
mov rdi, rax
mov rsi, rbx
call load_process
pop_all_and_segments
add rsp, 16 ; because the ISRs add err/num
iretq
global taskA
taskA:
push rbp
@@ -205,12 +220,5 @@ taskA:
syscall
jmp .loop
global taskB
taskB:
push rbp
mov rbp, rsp
mov rax, 0xbbbbbbbbbbbbbbbb
.loop:
syscall
jmp .loop
global taskAend
taskAend: