summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/ARM64/HalKernelMain.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dev/kernel/HALKit/ARM64/HalKernelMain.cc')
-rw-r--r--dev/kernel/HALKit/ARM64/HalKernelMain.cc84
1 files changed, 39 insertions, 45 deletions
diff --git a/dev/kernel/HALKit/ARM64/HalKernelMain.cc b/dev/kernel/HALKit/ARM64/HalKernelMain.cc
index 3498d477..3e6701ea 100644
--- a/dev/kernel/HALKit/ARM64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/ARM64/HalKernelMain.cc
@@ -1,77 +1,71 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
#include <ArchKit/ArchKit.h>
-#include <modules/CoreGfx/CoreGfx.h>
+#include <CFKit/Property.h>
#include <FirmwareKit/Handover.h>
+#include <HALKit/ARM64/Processor.h>
+#include <KernelKit/CodeMgr.h>
#include <KernelKit/FileMgr.h>
#include <KernelKit/MemoryMgr.h>
#include <KernelKit/PEFCodeMgr.h>
#include <KernelKit/ProcessScheduler.h>
+#include <NetworkKit/IPC.h>
#include <NewKit/Json.h>
-#include <KernelKit/CodeMgr.h>
#include <modules/ACPI/ACPIFactoryInterface.h>
-#include <NetworkKit/IPC.h>
-#include <HALKit/ARM64/Processor.h>
-#include <CFKit/Property.h>
+#include <modules/CoreGfx/CoreGfx.h>
#include <HALKit/ARM64/ApplicationProcessor.h>
-EXTERN_C void hal_init_platform(
- Kernel::HEL::BootInfoHeader* handover_hdr)
-{
-
- /************************************************** */
- /* INITIALIZE AND VALIDATE HEADER. */
- /************************************************** */
+EXTERN_C void hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
+ /************************************************** */
+ /* INITIALIZE AND VALIDATE HEADER. */
+ /************************************************** */
- kHandoverHeader = handover_hdr;
+ kHandoverHeader = handover_hdr;
- if (kHandoverHeader->f_Magic != kHandoverMagic &&
- kHandoverHeader->f_Version != kHandoverVersion)
- {
- return;
- }
+ if (kHandoverHeader->f_Magic != kHandoverMagic &&
+ kHandoverHeader->f_Version != kHandoverVersion) {
+ return;
+ }
- /************************************** */
- /* INITIALIZE BIT MAP. */
- /************************************** */
+ /************************************** */
+ /* INITIALIZE BIT MAP. */
+ /************************************** */
- kKernelBitMpSize = kHandoverHeader->f_BitMapSize;
- kKernelBitMpStart = reinterpret_cast<Kernel::VoidPtr>(
- reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_BitMapStart));
+ kKernelBitMpSize = kHandoverHeader->f_BitMapSize;
+ kKernelBitMpStart = reinterpret_cast<Kernel::VoidPtr>(
+ reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_BitMapStart));
- /// @note do initialize the interrupts after it.
+ /// @note do initialize the interrupts after it.
- Kernel::mp_initialize_gic();
+ Kernel::mp_initialize_gic();
- /// after the scheduler runs, we must look over teams, every 5000s in order to schedule every process according to their affinity fairly.
+ /// after the scheduler runs, we must look over teams, every 5000s in order to schedule every
+ /// process according to their affinity fairly.
- auto constexpr kSchedTeamSwitchMS = 5U; /// @brief Team switch time in milliseconds.
+ auto constexpr kSchedTeamSwitchMS = 5U; /// @brief Team switch time in milliseconds.
- Kernel::HardwareTimer timer(rtl_milliseconds(kSchedTeamSwitchMS));
+ Kernel::HardwareTimer timer(rtl_milliseconds(kSchedTeamSwitchMS));
- STATIC Kernel::Array<UserProcessTeam, kSchedTeamCount> kTeams;
+ STATIC Kernel::Array<UserProcessTeam, kSchedTeamCount> kTeams;
- SizeT team_index = 0U;
+ SizeT team_index = 0U;
- /// @brief This just loops over the teams and switches between them.
- /// @details Not even round-robin, just a simple loop in this boot core we're at.
- while (YES)
- {
- if (team_index > (kSchedTeamCount - 1))
- {
- team_index = 0U;
- }
+ /// @brief This just loops over the teams and switches between them.
+ /// @details Not even round-robin, just a simple loop in this boot core we're at.
+ while (YES) {
+ if (team_index > (kSchedTeamCount - 1)) {
+ team_index = 0U;
+ }
- while (!UserProcessScheduler::The().SwitchTeam(kTeams[team_index]))
- ;
+ while (!UserProcessScheduler::The().SwitchTeam(kTeams[team_index]));
- timer.Wait();
+ timer.Wait();
- ++team_index;
- }
+ ++team_index;
+ }
}