From a8eacc4a5d7f89b497b8be552491dba26fa68162 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 31 Aug 2024 16:16:08 +0200 Subject: [ IMP ] Improvements over PEF loader, and new thread loading API, to load new threads form syscalls. Signed-off-by: Amlal El Mahrouss --- dev/ZKA/KernelKit/CodeManager.hxx | 2 +- dev/ZKA/Sources/CodeManager.cxx | 2 +- dev/ZKA/Sources/DLLMain.cxx | 7 ------- dev/ZKA/Sources/MP.cxx | 1 - dev/ZKA/Sources/PEFCodeManager.cxx | 5 ++++- 5 files changed, 6 insertions(+), 11 deletions(-) (limited to 'dev') diff --git a/dev/ZKA/KernelKit/CodeManager.hxx b/dev/ZKA/KernelKit/CodeManager.hxx index aa384123..ef9d18f4 100644 --- a/dev/ZKA/KernelKit/CodeManager.hxx +++ b/dev/ZKA/KernelKit/CodeManager.hxx @@ -27,5 +27,5 @@ namespace Kernel /// @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* process_name) noexcept; + bool sched_execute_thread(MainKind main, const Char* process_name) noexcept; } // namespace Kernel diff --git a/dev/ZKA/Sources/CodeManager.cxx b/dev/ZKA/Sources/CodeManager.cxx index 585c7c01..c8f76309 100644 --- a/dev/ZKA/Sources/CodeManager.cxx +++ b/dev/ZKA/Sources/CodeManager.cxx @@ -14,7 +14,7 @@ namespace Kernel /// @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 + bool sched_execute_thread(MainKind main, const Char* processName) noexcept { if (!main) return false; diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx index 8f5d1977..e8436411 100644 --- a/dev/ZKA/Sources/DLLMain.cxx +++ b/dev/ZKA/Sources/DLLMain.cxx @@ -213,13 +213,6 @@ EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) CG::CGDrawStringToWnd(cKernelWnd, kSysDrv, 20, 10 + (FONT_SIZE_X * Kernel::rt_string_len("newoskrnl.dll: Missing catalog: ")), RGB(0, 0, 0)); } - STATIC auto main_kind = []() -> void { - auto number_own = 8; - while (Yes); - }; - - Kernel::execute_from_image(main_kind, "ZKA Logger"); - while (Yes) { Kernel::ProcessHelper::StartScheduling(); diff --git a/dev/ZKA/Sources/MP.cxx b/dev/ZKA/Sources/MP.cxx index 5be23422..5df86fd6 100644 --- a/dev/ZKA/Sources/MP.cxx +++ b/dev/ZKA/Sources/MP.cxx @@ -102,7 +102,6 @@ namespace Kernel if (!ret) { - /// TODO: start timer to schedule another process here. return mp_do_context_switch(image, stack_ptr, fStack) != 0; } diff --git a/dev/ZKA/Sources/PEFCodeManager.cxx b/dev/ZKA/Sources/PEFCodeManager.cxx index 3d740a87..8dbfd029 100644 --- a/dev/ZKA/Sources/PEFCodeManager.cxx +++ b/dev/ZKA/Sources/PEFCodeManager.cxx @@ -13,6 +13,9 @@ #include #include +/// @brief PEF stack size symbol. +#define cPefStackSizeSymbol "SizeOfReserveStack" + namespace Kernel { namespace Detail @@ -203,7 +206,7 @@ namespace Kernel proc.SetEntrypoint(errOrStart.Leak().Leak()); proc.Kind = procKind; - proc.StackSize = *(UIntPtr*)exec.FindSymbol("__STACK_SIZE", kPefData); + proc.StackSize = *(UIntPtr*)exec.FindSymbol(cPefStackSizeSymbol, kPefData); if (!proc.StackSize) { -- cgit v1.2.3