summaryrefslogtreecommitdiffhomepage
path: root/Kernel/Sources
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 09:09:07 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 09:10:20 +0200
commit7a43990192e13a7b32bc1f99a7dd02efe6f71e4e (patch)
treebecb45624bbef4749233cd26d3c91653c6e77701 /Kernel/Sources
parentfdc9c15c47fab1e780c97359b90c84bde30671d1 (diff)
MHR-38: Ticket done.
MHR-28: Initial commit, working on it. + Reworked SMP support inside x86 HAL with some bug fixes as well. + Reworked scheduler as well with some bug fixes as well. + Add ControlWord field inside StackFrame struct in x86 HAL. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources')
-rw-r--r--Kernel/Sources/ProcessScheduler.cxx30
1 files changed, 28 insertions, 2 deletions
diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx
index 954d9a7c..8ca94b60 100644
--- a/Kernel/Sources/ProcessScheduler.cxx
+++ b/Kernel/Sources/ProcessScheduler.cxx
@@ -244,11 +244,27 @@ namespace Kernel
}
process.Leak().StackFrame = reinterpret_cast<HAL::StackFrame*>(
- mm_new_ke_heap(sizeof(HAL::StackFrame), true, false));
+ mm_new_ke_heap(sizeof(HAL::StackFrame), Yes, Yes));
MUST_PASS(process.Leak().StackFrame);
- process.Leak().Status = ProcessStatus::kRunning;
+ if (process.Leak().Image)
+ {
+ process.Leak().StackFrame->BP = reinterpret_cast<HAL::Reg>(process.Leak().Image);
+ }
+ else
+ {
+ if (process.Leak().Kind != PROCESS_HEADER_BLOCK::kSharedObjectKind)
+ {
+ process.Leak().Crash();
+ return -kErrorProcessFault;
+ }
+ }
+
+ if (!process.Leak().StackFrame->SP)
+ process.Leak().StackFrame->SP = reinterpret_cast<HAL::Reg>(mm_new_ke_heap(sizeof(UInt8) * 8196, Yes, Yes));
+
+ process.Leak().Status = ProcessStatus::kStarting;
process.Leak().ProcessId = (mTeam.AsArray().Count() - 1);
process.Leak().HeapCursor = process.Leak().HeapPtr;
@@ -356,6 +372,16 @@ namespace Kernel
process.Leak().Status == ProcessStatus::kDead)
return false;
+ if (process.Leak().Kind == PROCESS_HEADER_BLOCK::kSharedObjectKind)
+ {
+ if (auto start = process.Leak().DLLPtr->Load<VoidPtr>(kPefStart, rt_string_len(kPefStart), kPefCode);
+ start)
+ {
+ process.Leak().Image = start;
+ process.Leak().StackFrame->BP = reinterpret_cast<HAL::Reg>(start);
+ }
+ }
+
if (process.Leak().GetStatus() == ProcessStatus::kStarting)
{
if (process.Leak().PTime <= 0)