diff options
Diffstat (limited to 'dev/ZKA/Sources')
| -rw-r--r-- | dev/ZKA/Sources/ExeMain.cxx | 8 | ||||
| -rw-r--r-- | dev/ZKA/Sources/HardwareThreadScheduler.cxx | 30 | ||||
| -rw-r--r-- | dev/ZKA/Sources/UserProcessScheduler.cxx | 7 |
3 files changed, 14 insertions, 31 deletions
diff --git a/dev/ZKA/Sources/ExeMain.cxx b/dev/ZKA/Sources/ExeMain.cxx index d8d1ea6e..036c5725 100644 --- a/dev/ZKA/Sources/ExeMain.cxx +++ b/dev/ZKA/Sources/ExeMain.cxx @@ -87,7 +87,7 @@ namespace Kernel::Detail } catalogDir = fNeFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0, - kNeFSCatalogKindDir); + kNeFSCatalogKindDir); CG::CGDrawStringToWnd(cKernelWnd, "Directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory has been created: ")), RGB(0, 0, 0)); @@ -114,12 +114,14 @@ EXTERN_C ATTRIBUTE(naked) Kernel::Void HangCPU(Kernel::Void) { while (Yes) { + Kernel::Char* p = nullptr; + *p = 4; } } namespace Kernel { - EXTERN UserProcessScheduler* cProcessScheduler; + EXTERN UserProcessScheduler* cProcessScheduler; } /// @brief Application entrypoint. @@ -127,7 +129,7 @@ namespace Kernel /// @return Void EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) { - Kernel::cProcessScheduler = nullptr; + Kernel::cProcessScheduler = nullptr; CG::CGDrawBackground(); 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 diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx index c68104b9..2501afc2 100644 --- a/dev/ZKA/Sources/UserProcessScheduler.cxx +++ b/dev/ZKA/Sources/UserProcessScheduler.cxx @@ -12,7 +12,6 @@ /// @brief User Process scheduler. /***********************************************************************************/ -#include "HALKit/AMD64/Processor.hxx" #include <KernelKit/UserProcessScheduler.hxx> #include <KernelKit/IPEFDLLObject.hxx> #include <KernelKit/HardwareThreadScheduler.hxx> @@ -424,17 +423,11 @@ namespace Kernel if (!stack || !frame_ptr || !image_ptr || new_pid < 0) return No; - while (Yes) - ; - for (SizeT index = 0UL; index < HardwareThreadScheduler::The().Count(); ++index) { if (HardwareThreadScheduler::The()[index].Leak()->Kind() == kInvalidHart) continue; - if (HardwareThreadScheduler::The()[index].Leak()->IsBusy()) - continue; - if (HardwareThreadScheduler::The()[index].Leak()->Kind() != ThreadKind::kHartBoot && HardwareThreadScheduler::The()[index].Leak()->Kind() != |
