summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
diff options
context:
space:
mode:
Diffstat (limited to 'dev/kernel/HALKit/AMD64/HalCommonAPI.asm')
-rw-r--r--dev/kernel/HALKit/AMD64/HalCommonAPI.asm59
1 files changed, 57 insertions, 2 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalCommonAPI.asm b/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
index c1dfc66a..be150dde 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,6 +79,59 @@ mp_system_call_handler:
pop r9
pop r8
- o64 sysret
+ pop rbp
-[bits 16]
+ o64 iret
+
+
+section .text
+
+global sched_jump_to_task
+
+sched_jump_to_task:
+ push rbp
+ mov rbp, rsp
+
+ 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:
+ jmp $
+ ret
+
+sched_recover_registers:
+ push rbp
+ mov rbp, rsp
+
+ mov r8, [rcx + 0x10]
+ mov r9, [rcx + 0x18]
+ mov r10, [rcx + 0x20]
+ mov r11, [rcx + 0x28]
+ mov r12, [rcx + 0x30]
+ mov r13, [rcx + 0x38]
+ mov r14, [rcx + 0x40]
+ mov r15, [rcx + 0x48]
+
+ pop rbp
+
+ ret \ No newline at end of file