From 06be6d65bb71152be8a28d7bb6b1028b5a588654 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 28 Jan 2024 16:26:33 +0100 Subject: 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 --- Private/HALKit/AMD64/PlatformAMD64.cpp | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Private/HALKit/AMD64/PlatformAMD64.cpp (limited to 'Private/HALKit/AMD64/PlatformAMD64.cpp') 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 + +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 &gdt) +{ + GDTLoader::Load(gdt.Leak()); +} + +void IDTLoader::Load(Ref &idt) +{ + IDTLoader::Load(idt.Leak()); +} +} // namespace hCore::HAL -- cgit v1.2.3