summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/HALKit/ARM64/HalKernelMain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/HALKit/ARM64/HalKernelMain.cpp')
-rw-r--r--src/kernel/HALKit/ARM64/HalKernelMain.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/kernel/HALKit/ARM64/HalKernelMain.cpp b/src/kernel/HALKit/ARM64/HalKernelMain.cpp
new file mode 100644
index 00000000..3a6e4085
--- /dev/null
+++ b/src/kernel/HALKit/ARM64/HalKernelMain.cpp
@@ -0,0 +1,60 @@
+// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (see LICENSE file)
+// Official repository: https://github.com/nekernel-org/nekernel
+
+#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