diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2024-11-02 07:46:45 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2024-11-02 07:49:04 +0100 |
| commit | f5e656424dc41ff93c67bcc8139a76d40f525efc (patch) | |
| tree | f701847fb8d2bec8a31c1f24f86afc5f2f338e64 /dev/ZKAKit/src/UserProcessScheduler.cc | |
| parent | 358379efc79bdda8b5742b82b95c45063184d76f (diff) | |
IMP: minOSKrnl commit 1039.
- KernelKit: New allocation limit in Heap.cc
- KernelKit: Add Matches method for password validation.
- KernelKit: Scheduler and Thread have been improved with new validations on frame.
- META: Ran format command.
- NewKit: Add new Ptr8 type for UInt8* types.
- MBCI: Fix codestyle.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/src/UserProcessScheduler.cc')
| -rw-r--r-- | dev/ZKAKit/src/UserProcessScheduler.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/dev/ZKAKit/src/UserProcessScheduler.cc b/dev/ZKAKit/src/UserProcessScheduler.cc index c3e85716..b2fed635 100644 --- a/dev/ZKAKit/src/UserProcessScheduler.cc +++ b/dev/ZKAKit/src/UserProcessScheduler.cc @@ -38,9 +38,12 @@ namespace Kernel /// @brief User Process scheduler global and external reference of thread scheduler. /***********************************************************************************/ - UserProcessScheduler kProcessScheduler; + UserProcessScheduler kProcessScheduler; - UserProcess::UserProcess(VoidPtr start_image) : Image(start_image) {} + UserProcess::UserProcess(VoidPtr start_image) + : Image(start_image) + { + } UserProcess::~UserProcess() = default; @@ -127,9 +130,9 @@ namespace Kernel if (!this->MemoryHeap) { - this->MemoryHeap = new UserProcess::USER_PROCESS_HEAP(); + this->MemoryHeap = new UserProcess::USER_PROCESS_HEAP(); - this->MemoryHeap->MemoryEntryPad = pad_amount; + this->MemoryHeap->MemoryEntryPad = pad_amount; this->MemoryHeap->MemoryEntrySize = sz; this->MemoryHeap->MemoryEntry = ptr; @@ -141,7 +144,7 @@ namespace Kernel } else { - USER_PROCESS_HEAP* entry = this->MemoryHeap; + USER_PROCESS_HEAP* entry = this->MemoryHeap; USER_PROCESS_HEAP* prev_entry = nullptr; while (!entry) @@ -439,7 +442,7 @@ namespace Kernel process.PTime = static_cast<Int32>(process.Affinity); UserProcessScheduler::The().GetCurrentProcess().Leak().Status = ProcessStatusKind::kFrozen; - UserProcessScheduler::The().GetCurrentProcess() = process; + UserProcessScheduler::The().GetCurrentProcess() = process; kcout << "Switch to '" << process.Name << "'.\r"; @@ -541,10 +544,18 @@ namespace Kernel PID prev_pid = UserProcessHelper::TheCurrentPID(); UserProcessHelper::TheCurrentPID() = new_pid; + //////////////////////////////////////////////////////////// + /// Prepare task switch. /// + //////////////////////////////////////////////////////////// + auto prev_ptime = HardwareThreadScheduler::The()[index].Leak()->fPTime; HardwareThreadScheduler::The()[index].Leak()->fPTime = UserProcessScheduler::The().CurrentTeam().AsArray()[new_pid].ProcessId; Bool ret = HardwareThreadScheduler::The()[index].Leak()->Switch(image_ptr, stack, frame_ptr); + //////////////////////////////////////////////////////////// + /// Rollback on fail. /// + //////////////////////////////////////////////////////////// + /// if (!ret) { HardwareThreadScheduler::The()[index].Leak()->fPTime = prev_ptime; |
