summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/Processor.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-03-29 10:59:55 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-03-29 10:59:55 +0100
commitb7709d9dc8fc74ab1c60336b487a2c2f90ceeb99 (patch)
tree752d60a92c2902e4669fae0639888a065cb7beba /dev/kernel/HALKit/AMD64/Processor.h
parent2c272e3ca3272cf8f1449c76cc83b1b927f419c9 (diff)
hal/amd64: unify GDT/IDT setup and rename I/O ops
Normalize descriptor loading logic under Register64. Prefix low-level port and MSR functions with hal_ for consistency. Improve APIC init flow to reflect MADT-based IRQ routing. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64/Processor.h')
-rw-r--r--dev/kernel/HALKit/AMD64/Processor.h26
1 files changed, 6 insertions, 20 deletions
diff --git a/dev/kernel/HALKit/AMD64/Processor.h b/dev/kernel/HALKit/AMD64/Processor.h
index 57f50a48..38822be1 100644
--- a/dev/kernel/HALKit/AMD64/Processor.h
+++ b/dev/kernel/HALKit/AMD64/Processor.h
@@ -28,13 +28,10 @@
#define kPIC2Command (0xA0)
#define kPIC2Data (0xA1)
-EXTERN_C
-{
-#include <cpuid.h>
-}
-
#include <HALKit/AMD64/CPUID.h>
+#define rtl_nop_op() asm volatile("nop")
+
/// @brief Maximum entries of the interrupt descriptor table.
#define kKernelIdtSize (0x100)
@@ -85,12 +82,6 @@ namespace Kernel::HAL
UIntPtr Base;
};
- struct PACKED RegisterGDT final
- {
- UShort Limit;
- UIntPtr Base;
- };
-
using RawRegister = UInt64;
using Reg = RawRegister;
using InterruptId = UInt16; /* For each element in the IVT */
@@ -167,8 +158,8 @@ namespace Kernel::HAL
class GDTLoader final
{
public:
- static Void Load(RegisterGDT& gdt);
- static Void Load(Ref<RegisterGDT>& gdt);
+ static Void Load(Register64& gdt);
+ static Void Load(Ref<Register64>& gdt);
};
class IDTLoader final
@@ -230,12 +221,7 @@ namespace Kernel::HAL
/// @param msr MSR
/// @param lo low byte
/// @param hi high byte
- inline Void hal_set_msr(UInt32 msr, UInt32 lo, UInt32 hi) noexcept
- {
- asm volatile("wrmsr"
- :
- : "a"(lo), "d"(hi), "c"(msr));
- }
+ Void hal_set_msr(UInt32 msr, UInt32 lo, UInt32 hi) noexcept;
/// @brief Processor specific namespace.
namespace Detail
@@ -320,7 +306,7 @@ EXTERN_C Kernel::Void idt_handle_math(Kernel::UIntPtr rsp);
EXTERN_C Kernel::Void idt_handle_pf(Kernel::UIntPtr rsp);
EXTERN_C ATTRIBUTE(naked) Kernel::Void hal_load_idt(Kernel::HAL::Register64 ptr);
-EXTERN_C ATTRIBUTE(naked) Kernel::Void hal_load_gdt(Kernel::HAL::RegisterGDT ptr);
+EXTERN_C ATTRIBUTE(naked) Kernel::Void hal_load_gdt(Kernel::HAL::Register64 ptr);
inline Kernel::VoidPtr kKernelBitMpStart = nullptr;
inline Kernel::UIntPtr kKernelBitMpSize = 0UL;