summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlal@softwarelabs.com>2024-06-14 09:58:11 +0200
committerAmlal EL Mahrouss <amlal@softwarelabs.com>2024-06-14 09:58:11 +0200
commitdd7b72379108c10cd68853d2a8a0332784ebb8cb (patch)
tree0b057b7a0aeebb68967c4fc2caf56a39eddbb8fe /Kernel/HALKit
parent479ee6ad453401f5ae7f46d3d91136753f0839e7 (diff)
Kernel: Scheduler: ProcessHeader::New: do not get the pointer before allocating it!
Kernel: HAL: AMD64: Two things. - Switching to an ARM HAL for our Zeta platform. - Fix return register when sending acknowledge on APIC, which was using the 32-bit eax instead of rax. Kernel: Boot: Update uname for Windows. Kernel: GDT: move as global (HalKenelMain.cxx) Signed-off-by: Amlal EL Mahrouss <amlal@softwarelabs.com>
Diffstat (limited to 'Kernel/HALKit')
-rw-r--r--Kernel/HALKit/AMD64/HalInterruptAPI.asm4
-rw-r--r--Kernel/HALKit/AMD64/HalKernelMain.cxx37
2 files changed, 19 insertions, 22 deletions
diff --git a/Kernel/HALKit/AMD64/HalInterruptAPI.asm b/Kernel/HALKit/AMD64/HalInterruptAPI.asm
index 150cfc10..4832ecf3 100644
--- a/Kernel/HALKit/AMD64/HalInterruptAPI.asm
+++ b/Kernel/HALKit/AMD64/HalInterruptAPI.asm
@@ -157,10 +157,10 @@ __NEW_INT_32:
pop rcx
pop rax
- mov eax, 0
+ mov rax, 0
;; tell there local apic that we're done.
- mov dword [0xFEE00000 + 0xB0], eax ; LAPIC_EOI
+ mov [0xFEE00000 + 0xB0], rax ; LAPIC_EOI
iretq
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx
index 9b605e1a..cafa6388 100644
--- a/Kernel/HALKit/AMD64/HalKernelMain.cxx
+++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx
@@ -28,9 +28,21 @@ namespace NewOS::HAL
extern void hal_system_get_cores(NewOS::voidPtr rsdPtr);
} // namespace NewOS::HAL
+/* GDT constant. */
+STATIC NewOS::HAL::Detail::NewOSGDT cGdt = {
+ {0, 0, 0, 0x00, 0x00, 0}, // null entry
+ {0, 0, 0, 0x9a, 0xaf, 0}, // kernel code
+ {0, 0, 0, 0x92, 0xaf, 0}, // kernel data
+ {0, 0, 0, 0x00, 0x00, 0}, // null entry
+ {0, 0, 0, 0x9a, 0xaf, 0}, // user code
+ {0, 0, 0, 0x92, 0xaf, 0}, // user data
+};
+
EXTERN_C void hal_init_platform(
NewOS::HEL::HandoverInformationHeader* HandoverHeader)
{
+ /* Setup globals. */
+
kHandoverHeader = HandoverHeader;
if (kHandoverHeader->f_Magic != kHandoverMagic &&
@@ -39,29 +51,17 @@ EXTERN_C void hal_init_platform(
return;
}
- /// Setup kernel globals.
kKernelVirtualSize = HandoverHeader->f_VirtualSize;
kKernelVirtualStart = reinterpret_cast<NewOS::VoidPtr>(
reinterpret_cast<NewOS::UIntPtr>(HandoverHeader->f_VirtualStart) + kVirtualAddressStartOffset);
kKernelPhysicalStart = HandoverHeader->f_PhysicalStart;
- STATIC NewOS::HAL::Detail::NewOSGDT GDT = {
- {0, 0, 0, 0x00, 0x00, 0}, // null entry
- {0, 0, 0, 0x9a, 0xaf, 0}, // kernel code
- {0, 0, 0, 0x92, 0xaf, 0}, // kernel data
- {0, 0, 0, 0x00, 0x00, 0}, // null entry
- {0, 0, 0, 0x9a, 0xaf, 0}, // user code
- {0, 0, 0, 0x92, 0xaf, 0}, // user data
- };
-
NewOS::HAL::RegisterGDT gdtBase;
- gdtBase.Base = reinterpret_cast<NewOS::UIntPtr>(&GDT);
+ gdtBase.Base = reinterpret_cast<NewOS::UIntPtr>(&cGdt);
gdtBase.Limit = sizeof(NewOS::HAL::Detail::NewOSGDT) - 1;
- /// Load GDT.
-
NewOS::HAL::GDTLoader gdt;
gdt.Load(gdtBase);
@@ -74,7 +74,7 @@ EXTERN_C void hal_init_platform(
NewOS::HAL::IDTLoader idt;
idt.Load(idtBase);
- /// START POST
+ /* install basic hooks. */
constexpr auto cDummyInterrupt = 0x10; // 16
@@ -87,12 +87,9 @@ EXTERN_C void hal_init_platform(
NewOS::HAL::Detail::_ke_power_on_self_test();
- auto cLoaderName = "LaunchDevil";
- NewOS::execute_from_image(KeMain, cLoaderName);
+ /* Call generic kernel entrypoint. */
- NewOS::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_RsdPtr);
+ KeMain();
- while (true)
- {
- }
+ NewOS::ke_stop(RUNTIME_CHECK_BOOTSTRAP);
}