summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-20 13:46:07 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-20 13:46:07 +0200
commitbec0e457ad346783be7f84be71bb0eddc881847c (patch)
tree337f59719b2fc10d03b2253630bb88b28a6c6839 /dev/kernel/HALKit/AMD64/HalCommonAPI.asm
parent9978ec66ff0e5fc98892c089c47637f0d164bc46 (diff)
wip: feat(kernel): Add stub for ring-3 switch on the AP side of the
scheduling system. why? - To let the code run in user mode, as specified in the design. next: - Debug the #06 interrupt when switching to task. 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.asm11
1 files changed, 8 insertions, 3 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalCommonAPI.asm b/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
index a04aeb95..230f50ed 100644
--- a/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
+++ b/dev/kernel/HALKit/AMD64/HalCommonAPI.asm
@@ -84,11 +84,16 @@ section .text
global sched_jump_to_task
-;; Jump to the task from its stack frame.
sched_jump_to_task:
push rbp
mov rbp, rsp
+ mov ax, 0x20
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+
mov r8, [rcx + 0x10]
mov r9, [rcx + 0x18]
mov r10, [rcx + 0x20]
@@ -101,11 +106,11 @@ sched_jump_to_task:
mov rax, [rcx + 0x00]
mov rsp, [rcx + 0x08]
- jmp rax
+ o64 sysret
int 3 ;; Never continue here.
global sched_idle_task
sched_idle_task:
jmp $
- ret \ No newline at end of file
+ ret