aboutsummaryrefslogtreecommitdiff
path: root/src/core/scheduler_asm.S
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-05-02 14:46:18 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-05-02 14:46:18 +0200
commite59104ffb55abe522c82d658f1f285149cca2cb1 (patch)
treeeb3cc1e46d0dd5b684864903b95ae32e245010da /src/core/scheduler_asm.S
parent4f08ba2b1d0ad7ea90d4d97a483b56b891b9c902 (diff)
Debug GDT enable multitasking
Diffstat (limited to 'src/core/scheduler_asm.S')
-rw-r--r--src/core/scheduler_asm.S27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/core/scheduler_asm.S b/src/core/scheduler_asm.S
index fc8bc50..8f417c4 100644
--- a/src/core/scheduler_asm.S
+++ b/src/core/scheduler_asm.S
@@ -2,26 +2,33 @@
-
+.extern kvar_stack_pma
switch:
-
- mov $0x23, %ax
+ # TODO: Check if we come from kernel mode (use kernel stack)
+ # TODO: restore all registers
+
+ mov 96(%rdi), %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
- push $0x23 #
- push $0x80
+ mov (%rdi), %rax
+ mov %rax, %cr3
+
+ push 96(%rdi)
+ push 64(%rdi)
pushf
pop %rax
- #orl $0x200, %%eax
- mov $0xffffbfff, %rbx
+ or $0x200, %rax # Enable interrupt
+ mov $0xffffffffbfff, %rbx # NT flag
and %rbx, %rax
push %rax
- push $0x1B
- push $0x0
-
+ push 40(%rdi)
+ push 48(%rdi)
+
+
+ # Perform task switching
iretq