summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-29 10:51:53 +0200
committerGitHub <noreply@github.com>2025-05-29 10:51:53 +0200
commit5c0bb7ee7b1b0fee02cc179fb21f4c57a61d6c2d (patch)
treecb17577bcdc9714c97a84ce417a075117097f146 /dev/kernel/HALKit/AMD64/HalCommonAPI.asm
parentd608230b1350b064ceb01e6572519b108f6139b0 (diff)
parent3167f59dbb401d6a79b1524537e04218baf49ee3 (diff)
Merge pull request #32 from nekernel-org/dev
0.0.2e3
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