diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-06 13:49:29 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-06 13:50:47 +0200 |
| commit | 48d5ea1be488018bc4b83be08b9d87b0e259e3f1 (patch) | |
| tree | a97cdde46e3e41db9f66f85db49189aa3c9e4441 /dev/ZKA/Sources/HardwareThreadScheduler.cxx | |
| parent | 39d95f7fb429c5c6b71cd7c1e985cadaf4ab7b83 (diff) | |
[ IMP ] Lots of fixes regarding GDT, IDT, HW Threads and Scheduler.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ZKA/Sources/HardwareThreadScheduler.cxx')
| -rw-r--r-- | dev/ZKA/Sources/HardwareThreadScheduler.cxx | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/dev/ZKA/Sources/HardwareThreadScheduler.cxx b/dev/ZKA/Sources/HardwareThreadScheduler.cxx index c5d04bbc..134cbb0f 100644 --- a/dev/ZKA/Sources/HardwareThreadScheduler.cxx +++ b/dev/ZKA/Sources/HardwareThreadScheduler.cxx @@ -92,21 +92,23 @@ namespace Kernel !stack_ptr) return false; - if (this->IsBusy()) - return false; - fStack = frame; if (kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled) { + if (this->IsBusy()) + return false; + this->Busy(true); Bool ret = mp_register_process(fStack); - this->Busy(true); + this->Busy(false); return ret; } else { + kcout << "Switching...\r"; + mp_do_context_switch_pre(); mp_do_context_switch(image, stack_ptr, fStack); @@ -120,16 +122,10 @@ namespace Kernel return fWakeup; } - ///! @brief Internal Hardware Thread list. - STATIC HardwareThread cThreadList[cMaxHWThreads]; - ///! @brief Constructor and destructors. ///! @brief Default constructor. - HardwareThreadScheduler::HardwareThreadScheduler() - { - kcout << "Initializing class done!" << endl; - } + HardwareThreadScheduler::HardwareThreadScheduler() = default; ///! @brief Default destructor. HardwareThreadScheduler::~HardwareThreadScheduler() = default; @@ -163,15 +159,7 @@ namespace Kernel } else if (idx >= cMaxHWThreads) { - static HardwareThread* fakeThread = new HardwareThread(); - - if (!fakeThread) - { - fakeThread = new HardwareThread(); - } - - fakeThread->fKind = kInvalidHart; - + static HardwareThread* fakeThread = nullptr; return {fakeThread}; } @@ -200,6 +188,6 @@ namespace Kernel /// @return the number of cores. SizeT HardwareThreadScheduler::Count() noexcept { - return fThreadList.Count(); + return fThreadList.Capacity(); } } // namespace Kernel |
