summaryrefslogtreecommitdiffhomepage
path: root/Kernel
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
parentd42e9fa42af70105346f14c8b48f60cd3f4ea845 (diff)
[IMP} Hal Utils API.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/HALKit/AMD64/HalUtils.asm (renamed from Kernel/HALKit/AMD64/HalInstallTIB.asm)8
-rw-r--r--Kernel/amd64-efi.make2
2 files changed, 8 insertions, 2 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
diff --git a/Kernel/amd64-efi.make b/Kernel/amd64-efi.make
index e59034c9..a6bd3772 100644
--- a/Kernel/amd64-efi.make
+++ b/Kernel/amd64-efi.make
@@ -60,7 +60,7 @@ newos-amd64-epm: clean
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalSMPCoreManager.asm
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalBoot.asm
- $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInstallTIB.asm
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalUtils.asm
$(MOVEALL)
OBJCOPY=x86_64-w64-mingw32-objcopy