summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/CodeManager.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-29 23:10:36 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-29 23:14:16 +0100
commit995e1580f9291c5b8e95687c59b95e561c0c4569 (patch)
tree50616d08887f2ca193683ff188ca952a0bb0ce3e /Private/Source/CodeManager.cxx
parent43ae417266c3127bbae35527c95c26e01ed50bd9 (diff)
Kernel: See below.
- Fix ACPI. - Parsing SDT correctly now. - Fix ke_runtime_check line endings. - Update Kernel heap magic and add padding to header. - Document Code Manager add limit for process teams. - Add execute_from_image for Code Manager. - Add loop for scheduler inside RuntimeMain. - Set SMP core to 4 for testing purposes. - Check for ACPI 2.x+ Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source/CodeManager.cxx')
-rw-r--r--Private/Source/CodeManager.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/Private/Source/CodeManager.cxx b/Private/Source/CodeManager.cxx
new file mode 100644
index 00000000..db2a7017
--- /dev/null
+++ b/Private/Source/CodeManager.cxx
@@ -0,0 +1,26 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <NewKit/Utils.hpp>
+#include <KernelKit/CodeManager.hpp>
+#include <KernelKit/ProcessScheduler.hpp>
+
+using namespace NewOS;
+
+/// @brief Executes a new process from a function. kernel code only.
+/// @param main the start of the process.
+/// @return
+bool execute_from_image(MainKind main, const char* processName) noexcept {
+ if (!main) return false;
+
+ ProcessHeader proc((VoidPtr)main);
+ proc.Kind = ProcessHeader::kDriverKind;
+ rt_copy_memory((VoidPtr)processName, proc.Name, rt_string_len(proc.Name));
+
+ Ref<ProcessHeader> refProc = proc;
+
+ return ProcessScheduler::Shared().Leak().Add(refProc);
+} \ No newline at end of file