diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-05 19:19:12 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-05 19:19:12 +0100 |
| commit | f3e49a9d6b865e7a3f6361ed88863cd12a5f90f1 (patch) | |
| tree | bb1ba85c3bc627be09f397f44eb216459f34d902 /Private/Source | |
| parent | 6191833a26e887c2b91ba4ad655297bfe70c97d5 (diff) | |
HCR-13 : Optimize filesystem operations on UEFI.
- Stream concept, on demand.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/ProcessManager.cxx | 8 | ||||
| -rw-r--r-- | Private/Source/RuntimeMain.cxx | 6 | ||||
| -rw-r--r-- | Private/Source/SMPManager.cxx | 10 |
3 files changed, 16 insertions, 8 deletions
diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx index af3fa351..71f38e2f 100644 --- a/Private/Source/ProcessManager.cxx +++ b/Private/Source/ProcessManager.cxx @@ -233,7 +233,7 @@ bool ProcessHelper::CanBeScheduled(Ref<Process> &process) { if (process.Leak().GetStatus() == ProcessStatus::kStarting) { if (process.Leak().PTime < static_cast<Int>(kMinMicroTime)) { process.Leak().Status = ProcessStatus::kRunning; - process.Leak().Affinity = AffinityKind::kStandard; + process.Leak().Affinity = AffinityKind::kHartStandard; return true; } @@ -271,7 +271,7 @@ bool ProcessHelper::Switch(HAL::StackFrame *the_stack, const PID &new_pid) { if (!the_stack || new_pid < 0) return false; for (SizeT index = 0UL; index < kMaxHarts; ++index) { - if (SMPManager::Shared().Leak()[index].Leak().Kind() == kInvalidThread) + if (SMPManager::Shared().Leak()[index].Leak().Kind() == kInvalidHart) continue; if (SMPManager::Shared().Leak()[index].Leak().StackFrame() == the_stack) { @@ -281,9 +281,9 @@ bool ProcessHelper::Switch(HAL::StackFrame *the_stack, const PID &new_pid) { if (SMPManager::Shared().Leak()[index].Leak().IsBusy()) continue; - if (SMPManager::Shared().Leak()[index].Leak().Kind() != ThreadKind::kBoot || + if (SMPManager::Shared().Leak()[index].Leak().Kind() != ThreadKind::kHartBoot || SMPManager::Shared().Leak()[index].Leak().Kind() != - ThreadKind::kSystemReserved) { + ThreadKind::kHartSystemReserved) { SMPManager::Shared().Leak()[index].Leak().Busy(true); ProcessHelper::GetCurrentPID() = new_pid; diff --git a/Private/Source/RuntimeMain.cxx b/Private/Source/RuntimeMain.cxx index e26ce13a..abbfb749 100644 --- a/Private/Source/RuntimeMain.cxx +++ b/Private/Source/RuntimeMain.cxx @@ -17,22 +17,28 @@ extern "C" void RuntimeMain( HCore::HEL::HandoverInformationHeader* HandoverHeader) { + /// Setup kernel globals. kKernelVirtualSize = HandoverHeader->f_VirtualSize; kKernelVirtualStart = HandoverHeader->f_VirtualStart; kKernelPhysicalSize = HandoverHeader->f_VirtualSize; kKernelPhysicalStart = HandoverHeader->f_VirtualStart; + /// Setup base page. HCore::HAL::hal_page_base((HCore::UIntPtr)kKernelVirtualStart); + /// Init memory managers. HCore::ke_init_ke_heap(); HCore::ke_init_heap(); + /// Init the HAL. MUST_PASS(HCore::ke_init_hal()); + /// Mount a New partition. HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager()); HCore::PEFLoader img("/System/HCoreShell.exe"); + /// Run the shell. if (!HCore::Utils::execute_from_image(img)) { HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx index d3c7a4c8..9b976412 100644 --- a/Private/Source/SMPManager.cxx +++ b/Private/Source/SMPManager.cxx @@ -60,8 +60,10 @@ void HardwareThread::Wake(const bool wakeup) noexcept { rt_wakeup_thread(m_Stack); } +extern bool rt_check_stack(HAL::StackFramePtr stackPtr); + bool HardwareThread::Switch(HAL::StackFrame* stack) { - if (stack == nullptr) return false; + if (!rt_check_stack(stack)) return false; m_Stack = stack; @@ -129,12 +131,12 @@ bool SMPManager::Switch(HAL::StackFrame* stack) { */ Ref<HardwareThread> SMPManager::operator[](const SizeT& idx) { if (idx == 0) { - if (m_ThreadList[idx].Leak().Leak().Kind() != kSystemReserved) { - m_ThreadList[idx].Leak().Leak().m_Kind = kBoot; + if (m_ThreadList[idx].Leak().Leak().Kind() != kHartSystemReserved) { + m_ThreadList[idx].Leak().Leak().m_Kind = kHartBoot; } } else if (idx >= kMaxHarts) { HardwareThread fakeThread; - fakeThread.m_Kind = kInvalidThread; + fakeThread.m_Kind = kInvalidHart; return {fakeThread}; } |
