summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-27 10:26:31 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-27 10:26:31 +0100
commit70e95128b11dbb535e4679cbacb1cbeaa414c822 (patch)
tree42fd94536a54058a39f0c85be99431c6ad1a0cf8 /Private/HALKit
parent44a081a4442181b208c09c6f748124c9d23b61fd (diff)
Kernel: Improving AMD64 HAL, Add TIBInstall.asm, currently Working on
SMPManager and Bootloader. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
-rw-r--r--Private/HALKit/AMD64/DebugManager.asm7
-rw-r--r--Private/HALKit/AMD64/HalPageAlloc.cpp2
-rw-r--r--Private/HALKit/AMD64/HalPageAlloc.hpp2
-rw-r--r--Private/HALKit/AMD64/SMPCoreManager.asm23
-rw-r--r--Private/HALKit/AMD64/TIBInstall.asm18
5 files changed, 41 insertions, 11 deletions
diff --git a/Private/HALKit/AMD64/DebugManager.asm b/Private/HALKit/AMD64/DebugManager.asm
index 6c0bf149..0c717039 100644
--- a/Private/HALKit/AMD64/DebugManager.asm
+++ b/Private/HALKit/AMD64/DebugManager.asm
@@ -8,7 +8,6 @@
;; */
[global rt_debug_fence]
-[global rt_debug_fence_end]
[global __rt_debug_int_3]
;; //////////////////////////////////////////////////// ;;
@@ -25,8 +24,10 @@ L0:
jmp $
rt_debug_fence:
- push __rt_debug_record_table
+ mov [__rt_debug_record_table], rsi
+ push rsi
jmp [rbx]
-rt_debug_fence_end:
+ pop rsi
+ ret
;; //////////////////////////////////////////////////// ;; \ No newline at end of file
diff --git a/Private/HALKit/AMD64/HalPageAlloc.cpp b/Private/HALKit/AMD64/HalPageAlloc.cpp
index ccdfa8b6..07cfbecf 100644
--- a/Private/HALKit/AMD64/HalPageAlloc.cpp
+++ b/Private/HALKit/AMD64/HalPageAlloc.cpp
@@ -13,7 +13,7 @@
// this files handles paging.
-static hCore::UIntPtr kPagePtr = 0x0900000;
+static hCore::UIntPtr kPagePtr = kPagePtrAddress;
static hCore::SizeT kPageCnt = 0UL;
namespace hCore
diff --git a/Private/HALKit/AMD64/HalPageAlloc.hpp b/Private/HALKit/AMD64/HalPageAlloc.hpp
index 4f5f8592..06a883bf 100644
--- a/Private/HALKit/AMD64/HalPageAlloc.hpp
+++ b/Private/HALKit/AMD64/HalPageAlloc.hpp
@@ -19,6 +19,8 @@
#define PTE_ALIGN (4096)
#endif //! PTE_ALIGN
+#define kPagePtrAddress 0x0900000
+
extern "C" void flush_tlb(hCore::UIntPtr VirtualAddr);
extern "C" void write_cr3(hCore::UIntPtr pde);
extern "C" void write_cr0(hCore::UIntPtr bit);
diff --git a/Private/HALKit/AMD64/SMPCoreManager.asm b/Private/HALKit/AMD64/SMPCoreManager.asm
index a528f847..ed56d7db 100644
--- a/Private/HALKit/AMD64/SMPCoreManager.asm
+++ b/Private/HALKit/AMD64/SMPCoreManager.asm
@@ -1,16 +1,25 @@
+;; /*
+;; * ========================================================
+;; *
+;; * hCore
+;; * Copyright 2024 Mahrouss Logic, all rights reserved.
+;; *
+;; * ========================================================
+;; */
+
[bits 64]
[global rt_do_context_switch]
[extern rt_debug_fence]
-[extern rt_debug_fence_end]
rt_do_context_switch:
- mov rsi, [rt_do_context_switch]
+ mov rsi, [rt_do_context_switch_unprotected]
call rt_debug_fence
- mov rsi, rdi
- mov rax, rsi
-
- call rt_debug_fence_end
+ iret
- iret \ No newline at end of file
+rt_do_context_switch_unprotected:
+ mov [rdi+0], rax
+ mov [rdi+8], rbx
+ mov [rdi+16], rcx
+ ret \ No newline at end of file
diff --git a/Private/HALKit/AMD64/TIBInstall.asm b/Private/HALKit/AMD64/TIBInstall.asm
new file mode 100644
index 00000000..69aa7503
--- /dev/null
+++ b/Private/HALKit/AMD64/TIBInstall.asm
@@ -0,0 +1,18 @@
+;; /*
+;; * ========================================================
+;; *
+;; * hCore
+;; * Copyright 2024 Mahrouss Logic, all rights reserved.
+;; *
+;; * ========================================================
+;; */
+
+[bits 64]
+
+[global rt_install_tib]
+
+rt_install_tib:
+ mov rsi, gs
+ ret
+
+;; //////////////////////////////////////////////////// ;; \ No newline at end of file