summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-28 10:55:51 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-28 10:55:51 +0200
commit3870cac25e895dcca9535d03a79d5ae96b5b023e (patch)
tree112d718bead4c30f435ffa3a579b3e67f93f2ecc /Kernel/HALKit
parentd42e9fa42af70105346f14c8b48f60cd3f4ea845 (diff)
[IMP} Hal Utils API.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit')
-rw-r--r--Kernel/HALKit/AMD64/HalUtils.asm (renamed from Kernel/HALKit/AMD64/HalInstallTIB.asm)8
1 files changed, 7 insertions, 1 deletions
diff --git a/Kernel/HALKit/AMD64/HalInstallTIB.asm b/Kernel/HALKit/AMD64/HalUtils.asm
index 00fe2ad8..6681a692 100644
--- a/Kernel/HALKit/AMD64/HalInstallTIB.asm
+++ b/Kernel/HALKit/AMD64/HalUtils.asm
@@ -28,6 +28,9 @@ rt_install_tib:
;; @used rcx, address to jump on.
;; @note adjusted for long mode.
rt_jump_user_mode:
+ cmp rcx, 0
+ je rt_jump_user_mode_failed
+
mov ax, (6 * 8) | 3 ; user data segment with RPL 3
mov ds, ax
mov es, ax
@@ -38,6 +41,9 @@ rt_jump_user_mode:
push (6 * 8) | 3
push rax
pushf
- push (5 * 8) | 3
+ push (5 * 8) | 3 ; user code segment with RPL 3
push rcx
iretq
+ ;; we just failed to validate the rcx, fallback and return to previous pc.
+rt_jump_user_mode_failed:
+ ret \ No newline at end of file