From 1e12163836e649da0d67fc8f17bc9a415554efe4 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 19 Jul 2025 16:11:51 +0100 Subject: feat: wip: new tree kind 'kSpecial' and refactor user scheduler code temporary regarding FileTree allocation. Signed-off-by: Amlal El Mahrouss --- dev/kernel/src/UserProcessScheduler.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'dev/kernel/src/UserProcessScheduler.cc') diff --git a/dev/kernel/src/UserProcessScheduler.cc b/dev/kernel/src/UserProcessScheduler.cc index 7e14fa62..45957c7b 100644 --- a/dev/kernel/src/UserProcessScheduler.cc +++ b/dev/kernel/src/UserProcessScheduler.cc @@ -122,20 +122,9 @@ ErrorOr USER_PROCESS::New(SizeT sz, SizeT pad_amount) { hal_write_cr3(vm_register); #else - auto ptr = mm_alloc_ptr(sz, Yes, Yes, pad_amount); + auto ptr = mm_alloc_ptr(sz, Yes, Yes, pad_amount); #endif - if (!this->FileTree) { - this->FileTree = new PROCESS_FILE_TREE(); - - if (!this->FileTree) { - this->Crash(); - return ErrorOr(-kErrorHeapOutOfMemory); - } - - /// @todo File Tree allocation and dispose methods (amlal) - } - if (!this->HeapTree) { this->HeapTree = new PROCESS_HEAP_TREE(); @@ -335,7 +324,7 @@ Void USER_PROCESS::Exit(const Int32& exit_code) { /// @brief Add dylib to the process object. /***********************************************************************************/ -Bool USER_PROCESS::SpawnDylib() { +Bool USER_PROCESS::InitDylib() { // React according to the process's kind. switch (this->Kind) { case USER_PROCESS::kExecutableDylibKind: { @@ -437,6 +426,17 @@ ProcessID UserProcessScheduler::Spawn(const Char* name, VoidPtr code, VoidPtr im process.PTime = 0; process.RTime = 0; + if (!process.FileTree) { + process.FileTree = new PROCESS_FILE_TREE(); + + if (!process.FileTree) { + process.Crash(); + return ErrorOr(-kErrorHeapOutOfMemory); + } + + /// @todo File Tree allocation and dispose methods (amlal) + } + (Void)(kout << "PID: " << number(process.ProcessId) << kendl); (Void)(kout << "Name: " << process.Name << kendl); -- cgit v1.2.3