diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2024-10-28 07:01:58 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2024-10-28 07:01:58 +0100 |
| commit | e0024d9ea688ee91a77abc0e28c5ea24b13ca67d (patch) | |
| tree | a4e29bd919cbeccf2689e81a5d52bfc02f2a8b77 /dev/ZKAKit/src/CodeMgr.cc | |
| parent | 36a3600ff7fc65a63b7386b7a680dbe8e647bd8f (diff) | |
IMP: Refactor whole source code to make it even.
- That is because previously the source was both in lowercase and lettercase.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/src/CodeMgr.cc')
| -rw-r--r-- | dev/ZKAKit/src/CodeMgr.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/dev/ZKAKit/src/CodeMgr.cc b/dev/ZKAKit/src/CodeMgr.cc new file mode 100644 index 00000000..c855347b --- /dev/null +++ b/dev/ZKAKit/src/CodeMgr.cc @@ -0,0 +1,33 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co. + +------------------------------------------- */ + +#include <KernelKit/CodeMgr.h> +#include <NewKit/Utils.h> +#include <KernelKit/UserProcessScheduler.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 if the process was started or not. + SizeT rtl_create_process(MainKind main, const Char* process_name) noexcept + { + if (!main) + return No; + + UserProcess proc; + + proc.Image = reinterpret_cast<VoidPtr>(main); + proc.Kind = UserProcess::kExectuableKind; + proc.StackSize = kib_cast(32); + + rt_set_memory(proc.Name, 0, kProcessLen); + rt_copy_memory((VoidPtr)process_name, proc.Name, rt_string_len(process_name)); + + return UserProcessScheduler::The().Add(proc); + } +} // namespace Kernel |
