summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/KernelMain.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-21 19:48:01 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-21 19:48:56 +0100
commit1b072a1dc14d67c9a64028d515f60c715544fcd4 (patch)
treea853dfac6fd35a0f66d23381245149eea25d7b2b /Private/Source/KernelMain.cxx
parent5cc05e3f40267ff30c0191f7c53a62d9c791102b (diff)
Kernel: Got it up and running.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/KernelMain.cxx')
-rw-r--r--Private/Source/KernelMain.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/Private/Source/KernelMain.cxx b/Private/Source/KernelMain.cxx
new file mode 100644
index 00000000..1d52967d
--- /dev/null
+++ b/Private/Source/KernelMain.cxx
@@ -0,0 +1,47 @@
+/*
+ * ========================================================
+ *
+ * HCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <ArchKit/ArchKit.hpp>
+#include <EFIKit/Handover.hxx>
+#include <KernelKit/FileManager.hpp>
+#include <KernelKit/PEFCodeManager.hxx>
+#include <NewKit/Json.hpp>
+#include <NewKit/KernelHeap.hpp>
+#include <NewKit/UserHeap.hpp>
+
+#include "NewKit/Utils.hpp"
+
+EXTERN_C void RuntimeMain(
+ HCore::HEL::HandoverInformationHeader* HandoverHeader) {
+ /// Setup kernel globals.
+ kKernelVirtualSize = HandoverHeader->f_VirtualSize;
+ kKernelVirtualStart = HandoverHeader->f_VirtualStart;
+
+ kKernelPhysicalSize = HandoverHeader->f_VirtualSize;
+ kKernelPhysicalStart = HandoverHeader->f_VirtualStart;
+
+ /// Setup base page.
+ HCore::HAL::hal_page_base((HCore::UIntPtr)kKernelVirtualStart);
+
+ /// Init memory managers.
+ HCore::ke_init_ke_heap();
+ HCore::ke_init_heap();
+
+ /// Init the HAL.
+ MUST_PASS(HCore::ke_init_hal());
+
+ /// Mount a New partition.
+ HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager());
+ HCore::PEFLoader img("/System/HCoreShell.exe");
+
+ /// Run the shell.
+ if (!HCore::Utils::execute_from_image(img)) {
+ HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP);
+ }
+}