diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-21 10:19:07 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-21 10:19:07 +0200 |
| commit | 58d2af14429be02b580cde5b3e23978530d8ab74 (patch) | |
| tree | 0fef311e8922aed216303eece4a745d3674feb81 /dev/kernel/HALKit/AMD64/HalCommonAPI.asm | |
| parent | c85a99c2afdd4c9dfa9d8f0f212e4625b6adade7 (diff) | |
feat(kernel): Architectural changes, and introducing a kKernelVM.
see code for more details.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64/HalCommonAPI.asm')
| -rw-r--r-- | dev/kernel/HALKit/AMD64/HalCommonAPI.asm | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalCommonAPI.asm b/dev/kernel/HALKit/AMD64/HalCommonAPI.asm index 230f50ed..d0ce2418 100644 --- a/dev/kernel/HALKit/AMD64/HalCommonAPI.asm +++ b/dev/kernel/HALKit/AMD64/HalCommonAPI.asm @@ -56,6 +56,8 @@ extern hal_system_call_enter global mp_system_call_handler mp_system_call_handler: + push rbp + mov rbp, rsp push r8 push r9 @@ -77,7 +79,9 @@ mp_system_call_handler: pop r9 pop r8 - o64 sysret + pop rbp + + o64 iret section .text @@ -88,12 +92,40 @@ sched_jump_to_task: push rbp mov rbp, rsp - mov ax, 0x20 + mov ax, 0x30 mov ds, ax mov es, ax mov fs, ax mov gs, ax + mov ax, 0x18 + ltr ax + + push 0x30 + mov rdx, [rcx + 0x08] + push rdx + o64 pushf + push 0x28 + mov rdx, [rcx + 0x00] + push rdx + + call sched_recover_registers + + o64 iret + +global sched_idle_task + +sched_idle_task: + mov ax, cs + and ax, 3 + + jmp $ + ret + +sched_recover_registers: + push rbp + mov rbp, rsp + mov r8, [rcx + 0x10] mov r9, [rcx + 0x18] mov r10, [rcx + 0x20] @@ -103,14 +135,6 @@ sched_jump_to_task: mov r14, [rcx + 0x40] mov r15, [rcx + 0x48] - mov rax, [rcx + 0x00] - mov rsp, [rcx + 0x08] - - o64 sysret - int 3 ;; Never continue here. + pop rbp -global sched_idle_task - -sched_idle_task: - jmp $ - ret + ret
\ No newline at end of file |
