mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Improve syscalls for new task switching
There are a lot of under the hood changes here: - Move syscalls to be a dispatch table, defined by syscalls.inc - Don't need a full process state (push_all) in syscalls now - In push_all, define REGS instead of using offsets - Save TWO stack pointers as well as current saved stack pointer in TCB: - rsp0 is the base of the kernel stack for interrupts - rsp3 is the saved user stack from cpu_data - Update syscall numbers in nulldrv - Some asm-debugging enhancements to the gdb script - fork() still not working
This commit is contained in:
@@ -1,30 +1,22 @@
|
||||
%include "push_all.inc"
|
||||
|
||||
extern load_process
|
||||
extern load_process_image
|
||||
|
||||
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
|
||||
; acts both as the cpu_state parameter to load_process_image, and the
|
||||
; saved state for the following iretq
|
||||
|
||||
pop rdi ; the address of the program image
|
||||
pop rsi ; the size of the program image
|
||||
pop rdx ; the address of this process' process structure
|
||||
pop rcx ; the cpu_state
|
||||
call load_process
|
||||
|
||||
call load_process_image
|
||||
|
||||
push rax ; load_process_image returns the process entrypoint
|
||||
|
||||
swapgs
|
||||
|
||||
xor rax, rax
|
||||
mov ax, ss
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
pop_all
|
||||
add rsp, 16 ; because the ISRs add err/num
|
||||
iretq
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user