diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-17 16:11:54 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-17 16:12:07 +0100 |
| commit | 49ba8e9e7de4a1ca2f23dbcdac40e12b45b94e0d (patch) | |
| tree | 8c1aa84da06e9f9e6ed3fe4e7eaed39a4cac8201 /dev/kernel/src | |
| parent | b4211868747c71a33db1c74ef1717596e68afa43 (diff) | |
feat: kernel: implement 'rtl_create_kernel_task'
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/src')
| -rw-r--r-- | dev/kernel/src/CodeMgr.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/dev/kernel/src/CodeMgr.cc b/dev/kernel/src/CodeMgr.cc index 7f85d547..02ed4c62 100644 --- a/dev/kernel/src/CodeMgr.cc +++ b/dev/kernel/src/CodeMgr.cc @@ -9,6 +9,17 @@ #include <NeKit/Utils.h> namespace Kernel { + +/// @brief Executes a new process from a function. Kernel code only. +/// @note This sets up a new stack, anything on the main function that calls the Kernel will not be +/// accessible. +/// @param main the start of the process. +/// @return The team's process id. +BOOL rtl_create_kernel_task(HAL::StackFramePtr task, const KID kid) noexcept { + if (!kid || task == nullptr) return FALSE; + return KernelTaskHelper::Add(task, kid); +} + /***********************************************************************************/ /// @brief Executes a new process from a function. Kernel code only. /// @note This sets up a new stack, anything on the main function that calls the Kernel will not be @@ -19,7 +30,6 @@ namespace Kernel { ProcessID rtl_create_user_process(rtl_main_kind main, const Char* process_name) noexcept { if (!process_name || *process_name == 0) return kSchedInvalidPID; - return UserProcessScheduler::The().Spawn(process_name, reinterpret_cast<VoidPtr>(main), nullptr); } } // namespace Kernel |
