diff options
author | bunnei <bunneidev@gmail.com> | 2022-02-26 19:46:31 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2022-02-28 03:00:09 +0100 |
commit | f87f076162e6d95cc444e35e086f168e5e6da712 (patch) | |
tree | cdf64a251b790ba5b9950e88c4123624b7f4611b /src/core/hle/kernel/kernel.cpp | |
parent | hle: kernel: k_page_heap: GetPhysicalAddr can be const. (diff) | |
download | yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.tar yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.tar.gz yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.tar.bz2 yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.tar.lz yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.tar.xz yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.tar.zst yuzu-f87f076162e6d95cc444e35e086f168e5e6da712.zip |
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 797f47021..eda67d933 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -70,13 +70,12 @@ struct KernelCore::Impl { // Derive the initial memory layout from the emulated board Init::InitializeSlabResourceCounts(kernel); - KMemoryLayout memory_layout; - DeriveInitialMemoryLayout(memory_layout); + DeriveInitialMemoryLayout(); Init::InitializeSlabHeaps(system, memory_layout); // Initialize kernel memory and resources. - InitializeSystemResourceLimit(kernel, system.CoreTiming(), memory_layout); - InitializeMemoryLayout(memory_layout); + InitializeSystemResourceLimit(kernel, system.CoreTiming()); + InitializeMemoryLayout(); InitializePageSlab(); InitializeSchedulers(); InitializeSuspendThreads(); @@ -219,8 +218,7 @@ struct KernelCore::Impl { // Creates the default system resource limit void InitializeSystemResourceLimit(KernelCore& kernel, - const Core::Timing::CoreTiming& core_timing, - const KMemoryLayout& memory_layout) { + const Core::Timing::CoreTiming& core_timing) { system_resource_limit = KResourceLimit::Create(system.Kernel()); system_resource_limit->Initialize(&core_timing); @@ -353,7 +351,7 @@ struct KernelCore::Impl { return schedulers[thread_id]->GetCurrentThread(); } - void DeriveInitialMemoryLayout(KMemoryLayout& memory_layout) { + void DeriveInitialMemoryLayout() { // Insert the root region for the virtual memory tree, from which all other regions will // derive. memory_layout.GetVirtualMemoryRegionTree().InsertDirectly( @@ -616,20 +614,16 @@ struct KernelCore::Impl { linear_region_start); } - void InitializeMemoryLayout(const KMemoryLayout& memory_layout) { + void InitializeMemoryLayout() { const auto system_pool = memory_layout.GetKernelSystemPoolRegionPhysicalExtents(); const auto applet_pool = memory_layout.GetKernelAppletPoolRegionPhysicalExtents(); const auto application_pool = memory_layout.GetKernelApplicationPoolRegionPhysicalExtents(); - // Initialize memory managers + // Initialize the memory manager. memory_manager = std::make_unique<KMemoryManager>(system); - memory_manager->InitializeManager(KMemoryManager::Pool::Application, - application_pool.GetAddress(), - application_pool.GetEndAddress()); - memory_manager->InitializeManager(KMemoryManager::Pool::Applet, applet_pool.GetAddress(), - applet_pool.GetEndAddress()); - memory_manager->InitializeManager(KMemoryManager::Pool::System, system_pool.GetAddress(), - system_pool.GetEndAddress()); + const auto& management_region = memory_layout.GetPoolManagementRegion(); + ASSERT(management_region.GetEndAddress() != 0); + memory_manager->Initialize(management_region.GetAddress(), management_region.GetSize()); // Setup memory regions for emulated processes // TODO(bunnei): These should not be hardcoded regions initialized within the kernel @@ -770,6 +764,9 @@ struct KernelCore::Impl { Kernel::KSharedMemory* irs_shared_mem{}; Kernel::KSharedMemory* time_shared_mem{}; + // Memory layout + KMemoryLayout memory_layout; + // Threads used for services std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads; Common::ThreadWorker service_threads_manager; @@ -1135,6 +1132,10 @@ const KWorkerTaskManager& KernelCore::WorkerTaskManager() const { return impl->worker_task_manager; } +const KMemoryLayout& KernelCore::MemoryLayout() const { + return impl->memory_layout; +} + bool KernelCore::IsPhantomModeForSingleCore() const { return impl->IsPhantomModeForSingleCore(); } |