summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-12-03 15:32:45 -0800
committerGravatar GitHub2020-12-03 15:32:45 -0800
commit69aaad9b9684570284efcdb5921e54d0f5983838 (patch)
tree364256228dfcdfc989a597aca2a6c753b173f93a /src/core/hle/kernel/kernel.cpp
parentMerge pull request #5059 from lioncash/mouse (diff)
parentkernel: scheduler: Minor cleanup to remove duplicated code. (diff)
downloadyuzu-69aaad9b9684570284efcdb5921e54d0f5983838.tar.gz
yuzu-69aaad9b9684570284efcdb5921e54d0f5983838.tar.xz
yuzu-69aaad9b9684570284efcdb5921e54d0f5983838.zip
Merge pull request #4996 from bunnei/use-4jits
Kernel: Refactor to use 4-instances of Dynarmic & various cleanups and improvements
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index bb3e312a7..929db696d 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -68,6 +68,12 @@ struct KernelCore::Impl {
68 InitializeSuspendThreads(); 68 InitializeSuspendThreads();
69 } 69 }
70 70
71 void InitializeCores() {
72 for (auto& core : cores) {
73 core.Initialize(current_process->Is64BitProcess());
74 }
75 }
76
71 void Shutdown() { 77 void Shutdown() {
72 next_object_id = 0; 78 next_object_id = 0;
73 next_kernel_process_id = Process::InitialKIPIDMin; 79 next_kernel_process_id = Process::InitialKIPIDMin;
@@ -116,7 +122,7 @@ struct KernelCore::Impl {
116 Core::MakeExclusiveMonitor(system.Memory(), Core::Hardware::NUM_CPU_CORES); 122 Core::MakeExclusiveMonitor(system.Memory(), Core::Hardware::NUM_CPU_CORES);
117 for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { 123 for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) {
118 schedulers[i] = std::make_unique<Kernel::Scheduler>(system, i); 124 schedulers[i] = std::make_unique<Kernel::Scheduler>(system, i);
119 cores.emplace_back(system, i, *schedulers[i], interrupts[i]); 125 cores.emplace_back(i, system, *schedulers[i], interrupts);
120 } 126 }
121 } 127 }
122 128
@@ -181,6 +187,7 @@ struct KernelCore::Impl {
181 if (process == nullptr) { 187 if (process == nullptr) {
182 return; 188 return;
183 } 189 }
190
184 const u32 core_id = GetCurrentHostThreadID(); 191 const u32 core_id = GetCurrentHostThreadID();
185 if (core_id < Core::Hardware::NUM_CPU_CORES) { 192 if (core_id < Core::Hardware::NUM_CPU_CORES) {
186 system.Memory().SetCurrentPageTable(*process, core_id); 193 system.Memory().SetCurrentPageTable(*process, core_id);
@@ -372,6 +379,10 @@ void KernelCore::Initialize() {
372 impl->Initialize(*this); 379 impl->Initialize(*this);
373} 380}
374 381
382void KernelCore::InitializeCores() {
383 impl->InitializeCores();
384}
385
375void KernelCore::Shutdown() { 386void KernelCore::Shutdown() {
376 impl->Shutdown(); 387 impl->Shutdown();
377} 388}
@@ -486,12 +497,17 @@ const Core::ExclusiveMonitor& KernelCore::GetExclusiveMonitor() const {
486} 497}
487 498
488void KernelCore::InvalidateAllInstructionCaches() { 499void KernelCore::InvalidateAllInstructionCaches() {
489 auto& threads = GlobalScheduler().GetThreadList(); 500 for (auto& physical_core : impl->cores) {
490 for (auto& thread : threads) { 501 physical_core.ArmInterface().ClearInstructionCache();
491 if (!thread->IsHLEThread()) { 502 }
492 auto& arm_interface = thread->ArmInterface(); 503}
493 arm_interface.ClearInstructionCache(); 504
505void KernelCore::InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size) {
506 for (auto& physical_core : impl->cores) {
507 if (!physical_core.IsInitialized()) {
508 continue;
494 } 509 }
510 physical_core.ArmInterface().InvalidateCacheRange(addr, size);
495 } 511 }
496} 512}
497 513