diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-03 22:37:17 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-03 22:37:17 +0200 |
| commit | cc9ce57cac59bd443e2319e3b8f427172b93f7da (patch) | |
| tree | 524ac4109ba00c887765f243e07e3d8c25cddffa /dev/ZKA/HALKit | |
| parent | 2a20797f83b5184cd569bacefbe68efb731a1135 (diff) | |
[ KERNEL ] REFACTORINGS AND IMPROVEMENTS OVER KERNEL AND DRIVERS.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/HALKit')
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalKernelMain.cxx | 20 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalProcessor.cxx | 8 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx | 3 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/Processor.hxx | 2 |
5 files changed, 7 insertions, 28 deletions
diff --git a/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx b/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx index 9a0914f8..4474295f 100644 --- a/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx +++ b/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx @@ -64,7 +64,7 @@ namespace Kernel::HAL { MUST_PASS(ptr_ivt[idt_indx]); - Detail::kInterruptVectorTable[idt_indx].Selector = (idt_indx == kSyscallRoute) ? kGdtUserCodeSelector : kGdtKernelCodeSelector; + Detail::kInterruptVectorTable[idt_indx].Selector = kGdtKernelCodeSelector; Detail::kInterruptVectorTable[idt_indx].Ist = 0; Detail::kInterruptVectorTable[idt_indx].TypeAttributes = kInterruptGate; Detail::kInterruptVectorTable[idt_indx].OffsetLow = ((UIntPtr)ptr_ivt[idt_indx] & __INT16_MAX__); diff --git a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx index 2cdeb7f0..34398871 100644 --- a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx +++ b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx @@ -64,26 +64,6 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept; EXTERN_C void hal_user_code_start(void); EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void); -/* @brief TSS */ - -Kernel::HAL::Detail::ZKA_TSS cTSS = { - .fReserved1 = 0x0, - .fRsp0 = 0x0, - .fRsp1 = 0x0, - .fRsp2 = 0x0, - .fReserved2 = 0x0, - .fIst1 = 0x0, - .fIst2 = 0x0, - .fIst3 = 0x0, - .fIst4 = 0x0, - .fIst5 = 0x0, - .fIst6 = 0x0, - .fIst7 = 0x0, - .fReserved3 = 0x0, - .fReserved4 = 0x0, - .fIopb = 0x0, -}; - /* GDT, mostly descriptors for user and kernel segments. */ STATIC Kernel::HAL::Detail::ZKA_GDT_ENTRY cGdt[6] = { {.fLimitLow = 0, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // Null entry diff --git a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx index 169c02f5..407b7e51 100644 --- a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx +++ b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx @@ -26,17 +26,17 @@ namespace Kernel::HAL UIntPtr pte_idx = ((UIntPtr)virt_addr >> 12) & 0x1FFF; // Access PML4 entry - volatile UInt64* pml4_entry = (volatile UInt64*)(pml4_base + pml4_idx * sizeof(UIntPtr)); + volatile UInt64* pml4_entry = (volatile UInt64*)(((UInt64)pml4_base) + pml4_idx * sizeof(UIntPtr)); UInt64 pdpt_base = *pml4_entry & ~0xFFF; // Remove flags (assuming 4KB pages) // Access PDPT entry - volatile UInt64* pdpt_entry = (volatile UInt64*)(pdpt_base + pdpt_idx * sizeof(UIntPtr)); + volatile UInt64* pdpt_entry = (volatile UInt64*)(((UInt64)pdpt_base) + pdpt_idx * sizeof(UIntPtr)); UInt64 pd_base = *pdpt_entry & ~0xFFF; // Remove flags - volatile UInt64* pd_entry = (volatile UInt64*)(pd_base + pd_idx * sizeof(UIntPtr)); + volatile UInt64* pd_entry = (volatile UInt64*)(((UInt64)pd_base) + pd_idx * sizeof(UIntPtr)); UInt64 pt_base = *pd_entry & ~0xFFF; // Remove flags - volatile UInt64* page_addr = (volatile UInt64*)((UIntPtr)pt_base + (pte_idx * sizeof(UIntPtr))); + volatile UInt64* page_addr = (volatile UInt64*)(((UInt64)pt_base) + (pte_idx * sizeof(UIntPtr))); if (page_addr) { diff --git a/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx b/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx index bf98d01d..cef5d368 100644 --- a/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx +++ b/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx @@ -14,7 +14,8 @@ Void UserProcess::SetImageStart(VoidPtr imageStart) noexcept if (imageStart == nullptr) this->Crash(); - HAL::mm_update_pte(imageStart, HAL::eFlagsPresent | HAL::eFlagsUser); + HAL::mm_update_pte(imageStart, HAL::eFlagsPresent); + HAL::mm_update_pte(imageStart, HAL::eFlagsUser); this->Image = imageStart; } diff --git a/dev/ZKA/HALKit/AMD64/Processor.hxx b/dev/ZKA/HALKit/AMD64/Processor.hxx index 0f24a2be..a80e13cb 100644 --- a/dev/ZKA/HALKit/AMD64/Processor.hxx +++ b/dev/ZKA/HALKit/AMD64/Processor.hxx @@ -24,8 +24,6 @@ EXTERN_C #include <cpuid.h> } -#define kSyscallRoute (0x29) - #define IsActiveLow(FLG) (FLG & 2) #define IsLevelTriggered(FLG) (FLG & 8) |
