summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
diff options
context:
space:
mode:
authorAmlal <amlal@el-mahrouss-logic.com>2024-09-07 09:18:35 +0200
committerAmlal <amlal@el-mahrouss-logic.com>2024-09-07 09:18:35 +0200
commit1003d7a20bab6885b4edde7d11103a199de30d21 (patch)
treea1992f26fd9afeb802bbb1829dec8ebe02ce5cd9 /dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
parent4019b870041d1ac50a48ba9e7a981df1afde96e6 (diff)
Daily bump.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm')
-rw-r--r--dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm46
1 files changed, 46 insertions, 0 deletions
diff --git a/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm b/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
index 28f86b34..56853441 100644
--- a/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
+++ b/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
@@ -237,12 +237,58 @@ extern hal_real_init
hal_reload_segments:
sti
+ ;; Write address of syscall handler.
+
+ mov rdx, [mp_system_call_handler]
+ shr rdx, 32
+ mov rcx, 0xC0000082
+ wrmsr
+
+ ;; Set segments of syscall handler.
+
+ xor rax, rax
+ mov rdx, 0x230008
+ mov rcx, 0xC0000081
+ wrmsr
+
+ mov ecx, 0xC0000080
+ rdmsr
+ or eax, 1
+ wrmsr
+
jmp hal_real_init
ret
global hal_load_idt
global hal_user_code_start
+extern hal_system_call_enter
+global mp_system_call_handler
+
+mp_system_call_handler:
+
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+
+ jmp hal_system_call_enter
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+
+ o64 sysret
+
hal_load_idt:
cli
lidt [rcx]