summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-27 17:38:23 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-27 17:38:23 +0100
commit1ce16b83dba0326b13dfa3399c1497ac6b1af14d (patch)
tree8a5e4063b5d4cf6ce4f42dd500073994e9ef8954 /Private/Source
parent6a18e607ffc4e83f2bd953c9de5c14f18e077df8 (diff)
Kernel && Developer:
Developer: - Rework System API to use C instead of C++ - Add new calls in Thread.h - Documented code. Kernel: - Rework handover stage, separated the Processor specific code from the cross platform code. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/PEFSharedObjectRT.cxx14
-rw-r--r--Private/Source/ProcessScheduler.cxx6
-rw-r--r--Private/Source/RuntimeMain.cxx30
3 files changed, 41 insertions, 9 deletions
diff --git a/Private/Source/PEFSharedObjectRT.cxx b/Private/Source/PEFSharedObjectRT.cxx
index dc75e8b6..871552d7 100644
--- a/Private/Source/PEFSharedObjectRT.cxx
+++ b/Private/Source/PEFSharedObjectRT.cxx
@@ -18,9 +18,9 @@
Revision History:
- 01/02/24: Rework shared library ABI, except a rt_library_init and rt_library_free
- (amlel)
- 15/02/24: Breaking changes, changed the name of the routines. (amlel)
+ 01/02/24: Rework shared library ABI, except a rt_library_init and
+ rt_library_free (amlel) 15/02/24: Breaking changes, changed the name of the
+ routines. (amlel)
------------------------------------------- */
@@ -76,7 +76,7 @@ EXTERN_C SharedObjectPtr rt_library_init(void) {
EXTERN_C Void rt_library_free(SharedObjectPtr lib, bool *successful) {
MUST_PASS(successful);
- // sanity check (will also trigger a bug check)
+ // sanity check (will also trigger a bug check if this fails)
if (lib == nullptr) {
*successful = false;
ProcessScheduler::Shared().Leak().GetCurrent().Leak().Crash();
@@ -92,7 +92,9 @@ EXTERN_C Void rt_library_free(SharedObjectPtr lib, bool *successful) {
/***********************************************************************************/
-extern "C" void __mh_purecall(void) {
- // virtual placeholder.
+/// @brief Unimplemented function (crashes by default)
+/// @param
+EXTERN_C void __mh_purecall(void) {
+ ProcessScheduler::Shared().Leak().GetCurrent().Leak().Crash();
return;
}
diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx
index ebcf82c0..54a4afe8 100644
--- a/Private/Source/ProcessScheduler.cxx
+++ b/Private/Source/ProcessScheduler.cxx
@@ -162,15 +162,15 @@ SizeT ProcessScheduler::Add(Ref<ProcessHeader> &process) {
UIntPtr imageStart = reinterpret_cast<UIntPtr>(process.Leak().Image);
- process.Leak().SetStart(imageStart);
+ process.Leak().SetEntrypoint(imageStart);
mTeam.AsArray().Add(process);
- if (!imageStart && process.Leak().Kind == ProcessHeader::ExecutableType) {
+ if (!imageStart && process.Leak().Kind == ProcessHeader::kUserKind) {
process.Leak().Crash();
}
- if (!imageStart && process.Leak().Kind == ProcessHeader::DriverType) {
+ if (!imageStart && process.Leak().Kind == ProcessHeader::kDriverKind) {
if (process.Leak().Ring == 3)
process.Leak().Crash();
else
diff --git a/Private/Source/RuntimeMain.cxx b/Private/Source/RuntimeMain.cxx
new file mode 100644
index 00000000..ffecaa18
--- /dev/null
+++ b/Private/Source/RuntimeMain.cxx
@@ -0,0 +1,30 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <ArchKit/ArchKit.hpp>
+#include <Builtins/Toolbox/Rsrc/Splash.rsrc>
+#include <Builtins/Toolbox/Toolbox.hxx>
+#include <FirmwareKit/Handover.hxx>
+#include <KernelKit/FileManager.hpp>
+#include <KernelKit/Framebuffer.hpp>
+#include <KernelKit/KernelHeap.hpp>
+#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/ProcessScheduler.hpp>
+#include <KernelKit/UserHeap.hpp>
+#include <NewKit/Json.hpp>
+
+/// @file Main microkernel entrypoint.
+
+EXTERN_C void RuntimeMain(void) {
+ ///! Mounts a NewFS block.
+ HCore::NewFilesystemManager* newFS = new HCore::NewFilesystemManager();
+ HCore::ke_protect_ke_heap(newFS);
+
+ HCore::FilesystemManagerInterface::Mount(newFS);
+
+ ///! we're done, unmount.
+ delete newFS;
+} \ No newline at end of file