summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/HALKit/ARM64/HalKernelMain.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/HALKit/ARM64/HalKernelMain.cc')
-rw-r--r--src/kernel/HALKit/ARM64/HalKernelMain.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/kernel/HALKit/ARM64/HalKernelMain.cc b/src/kernel/HALKit/ARM64/HalKernelMain.cc
new file mode 100644
index 00000000..e36535c3
--- /dev/null
+++ b/src/kernel/HALKit/ARM64/HalKernelMain.cc
@@ -0,0 +1,63 @@
+/* ========================================
+
+ Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
+
+======================================== */
+
+#include <ArchKit/ArchKit.h>
+#include <CFKit/Property.h>
+#include <FirmwareKit/Handover.h>
+#include <HALKit/ARM64/ApplicationProcessor.h>
+#include <HALKit/ARM64/Processor.h>
+#include <KernelKit/CodeMgr.h>
+#include <KernelKit/FileMgr.h>
+#include <KernelKit/HardwareThreadScheduler.h>
+#include <KernelKit/HeapMgr.h>
+#include <KernelKit/PEFCodeMgr.h>
+#include <KernelKit/ProcessScheduler.h>
+#include <NeKit/Json.h>
+#include <NetworkKit/IPC.h>
+#include <modules/ACPI/ACPIFactoryInterface.h>
+#include <modules/CoreGfx/CoreGfx.h>
+
+#ifndef __NE_MODULAR_KERNEL_COMPONENTS__
+EXTERN_C void hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
+ using namespace Kernel;
+
+ /************************************************** */
+ /* INITIALIZE AND VALIDATE HEADER. */
+ /************************************************** */
+
+ kHandoverHeader = handover_hdr;
+
+ if (kHandoverHeader->f_Magic != kHandoverMagic &&
+ kHandoverHeader->f_Version != kHandoverVersion) {
+ return;
+ }
+
+#ifdef __NE_ARM64_EFI__
+ fw_init_efi((EfiSystemTable*) handover_hdr->f_FirmwareCustomTables[1]);
+
+ Boot::ExitBootServices(handover_hdr->f_HardwareTables.f_ImageKey,
+ handover_hdr->f_HardwareTables.f_ImageHandle);
+#endif
+
+ FB::cg_clear_video();
+
+ /************************************** */
+ /* INITIALIZE BIT MAP. */
+ /************************************** */
+
+ kBitMapCursor = 0UL;
+ kKernelBitMpSize = kHandoverHeader->f_BitMapSize;
+ kKernelBitMpStart = reinterpret_cast<Kernel::VoidPtr>(
+ reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_BitMapStart));
+
+ /// @note do initialize the interrupts after it.
+
+ Kernel::mp_init_cores();
+
+ while (YES)
+ ;
+}
+#endif