summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-08 19:50:36 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-08 19:51:18 +0100
commitd0252ab0b32c55b08749e94545e17d389b1081c9 (patch)
tree20af91e0b6ac2d7f4f61c3547d3bf97e49a747c2 /Private/HALKit
parentfe44d10437a3508f62ac21e03cd712aba0c1683b (diff)
HCR-15: See below.
Boot: Fixed dependance on old os.epm file. Kernel: Will get it running this weekend. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
-rw-r--r--Private/HALKit/64x0/APM/.hgkeep0
-rw-r--r--Private/HALKit/AMD64/HalPageAlloc.hpp37
-rw-r--r--Private/HALKit/ARM64/ACPI/.gitkeep0
-rw-r--r--Private/HALKit/RISCV/APM/.gitkeep0
4 files changed, 34 insertions, 3 deletions
diff --git a/Private/HALKit/64x0/APM/.hgkeep b/Private/HALKit/64x0/APM/.hgkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/HALKit/64x0/APM/.hgkeep
diff --git a/Private/HALKit/AMD64/HalPageAlloc.hpp b/Private/HALKit/AMD64/HalPageAlloc.hpp
index 367cc26e..d6912318 100644
--- a/Private/HALKit/AMD64/HalPageAlloc.hpp
+++ b/Private/HALKit/AMD64/HalPageAlloc.hpp
@@ -9,6 +9,12 @@
#pragma once
+/** ---------------------------------------------------
+
+ * THIS FILE CONTAINS CODE FOR X86_64 PAGING.
+
+------------------------------------------------------- */
+
#include <NewKit/Defines.hpp>
#ifndef PTE_MAX
@@ -23,9 +29,9 @@ extern "C" void flush_tlb(HCore::UIntPtr VirtualAddr);
extern "C" void write_cr3(HCore::UIntPtr pde);
extern "C" void write_cr0(HCore::UIntPtr bit);
-extern "C" HCore::UIntPtr read_cr0();
-extern "C" HCore::UIntPtr read_cr2();
-extern "C" HCore::UIntPtr read_cr3();
+extern "C" HCore::UIntPtr read_cr0(); // @brief CPU control register.
+extern "C" HCore::UIntPtr read_cr2(); // @brief Fault address.
+extern "C" HCore::UIntPtr read_cr3(); // @brief Page table.
namespace HCore::HAL {
struct PageTable64 {
@@ -41,6 +47,26 @@ struct PageTable64 {
bool ExecDisable : 1;
};
+namespace Detail {
+enum class ControlRegisterBits {
+ ProtectedModeEnable = 0,
+ MonitorCoProcessor = 1,
+ Emulation = 2,
+ TaskSwitched = 3,
+ ExtensionType = 4,
+ NumericError = 5,
+ WriteProtect = 16,
+ AlignementMask = 18,
+ NotWriteThrough = 29,
+ CacheDisable = 30,
+ Paging = 31,
+};
+
+inline UInt8 control_register_cast(ControlRegisterBits reg) {
+ return static_cast<UInt8>(reg);
+}
+} // namespace Detail
+
struct PageDirectory64 final {
PageTable64 ALIGN(PTE_ALIGN) Pte[PTE_MAX];
};
@@ -50,3 +76,8 @@ UIntPtr& hal_page_base() noexcept;
void hal_page_base(const UIntPtr& newPagePtr) noexcept;
UIntPtr hal_create_page(Boolean rw, Boolean user);
} // namespace HCore::HAL
+
+namespace HCore {
+typedef HAL::PageTable64 PTE;
+typedef HAL::PageDirectory64 PDE;
+} // namespace HCore
diff --git a/Private/HALKit/ARM64/ACPI/.gitkeep b/Private/HALKit/ARM64/ACPI/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/HALKit/ARM64/ACPI/.gitkeep
diff --git a/Private/HALKit/RISCV/APM/.gitkeep b/Private/HALKit/RISCV/APM/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/HALKit/RISCV/APM/.gitkeep