summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit/AMD64/PlatformAMD64.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-28 16:26:33 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-28 16:26:33 +0100
commit06be6d65bb71152be8a28d7bb6b1028b5a588654 (patch)
treeb47625ad70e5ec6093187f9d454f4edeaffb5ed1 /Private/HALKit/AMD64/PlatformAMD64.cpp
parentf69bd40d5d97e371451d2e9c27721422141d828f (diff)
NewKernel: Final things are getting done for the first prototype.
NewBoot: Add ARM64 to HEL. SPEC: Update it to include NewFS into it. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit/AMD64/PlatformAMD64.cpp')
-rw-r--r--Private/HALKit/AMD64/PlatformAMD64.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/Private/HALKit/AMD64/PlatformAMD64.cpp b/Private/HALKit/AMD64/PlatformAMD64.cpp
new file mode 100644
index 00000000..0bade8dc
--- /dev/null
+++ b/Private/HALKit/AMD64/PlatformAMD64.cpp
@@ -0,0 +1,58 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright 2024 Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <ArchKit/Arch.hpp>
+
+namespace hCore::HAL
+{
+namespace Detail
+{
+struct RegisterAMD64 final
+{
+ UIntPtr base;
+ UShort limit;
+};
+} // namespace Detail
+
+void GDTLoader::Load(Register64 &gdt)
+{
+ Detail::RegisterAMD64 *reg = new Detail::RegisterAMD64();
+ MUST_PASS(reg);
+
+ reg->base = gdt.Base;
+ reg->limit = gdt.Limit;
+
+ rt_cli();
+ load_gdt(reg);
+ rt_sti();
+}
+
+void IDTLoader::Load(Register64 &idt)
+{
+ Detail::RegisterAMD64 *reg = new Detail::RegisterAMD64();
+ MUST_PASS(reg);
+
+ reg->base = idt.Base;
+ reg->limit = idt.Limit;
+
+ rt_cli();
+ load_idt(reg);
+ rt_sti();
+}
+
+void GDTLoader::Load(Ref<Register64> &gdt)
+{
+ GDTLoader::Load(gdt.Leak());
+}
+
+void IDTLoader::Load(Ref<Register64> &idt)
+{
+ IDTLoader::Load(idt.Leak());
+}
+} // namespace hCore::HAL