From 2c4b02249ec4355a73b826909ab1889e45871faf Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 31 Aug 2024 10:47:14 +0200 Subject: Saving progress on User scheduler implementation. + Working on RISC-V, ARM64, POWER64 HALs, to be able to distribute mulitple versions of the product. Signed-off-by: Amlal El Mahrouss --- dev/ZKA/Sources/CodeManager.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'dev/ZKA/Sources/CodeManager.cxx') diff --git a/dev/ZKA/Sources/CodeManager.cxx b/dev/ZKA/Sources/CodeManager.cxx index 3dc08ca6..243e3441 100644 --- a/dev/ZKA/Sources/CodeManager.cxx +++ b/dev/ZKA/Sources/CodeManager.cxx @@ -6,12 +6,12 @@ #include #include -#include +#include 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. + /// @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. bool execute_from_image(MainKind main, const Char* processName) noexcept @@ -19,10 +19,12 @@ namespace Kernel if (!main) return false; - PROCESS_HEADER_BLOCK proc((VoidPtr)main); - proc.Kind = PROCESS_HEADER_BLOCK::kExeKind; + UserProcess proc((VoidPtr)main); + proc.Kind = UserProcess::kExeKind; + proc.StackSize = mib_cast(1); + rt_copy_memory((VoidPtr)processName, proc.Name, rt_string_len(processName)); - return ProcessScheduler::The().Add(proc) == kErrorSuccess; + return UserProcessScheduler::The().Add(proc) == kErrorSuccess; } } // namespace Kernel -- cgit v1.2.3