mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user