summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-01 12:14:17 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:58 -0400
commit1567824d2da8e9b49b433f3d1d753d8ad84e65f9 (patch)
treec9553bb3f1693e430054695737d2f87ba4b58955 /src/core/core.cpp
parentCore: Refactor ARM Interface. (diff)
downloadyuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.gz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.xz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.zip
General: Move ARM_Interface into Threads.
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 2ca9c0be5..40eea297e 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -119,14 +119,6 @@ struct System::Impl {
119 : kernel{system}, fs_controller{system}, memory{system}, 119 : kernel{system}, fs_controller{system}, memory{system},
120 cpu_manager{system}, reporter{system}, applet_manager{system} {} 120 cpu_manager{system}, reporter{system}, applet_manager{system} {}
121 121
122 Kernel::PhysicalCore& CurrentPhysicalCore() {
123 return kernel.CurrentPhysicalCore();
124 }
125
126 Kernel::PhysicalCore& GetPhysicalCore(std::size_t index) {
127 return kernel.PhysicalCore(index);
128 }
129
130 ResultStatus Run() { 122 ResultStatus Run() {
131 status = ResultStatus::Success; 123 status = ResultStatus::Success;
132 124
@@ -443,7 +435,7 @@ bool System::IsPoweredOn() const {
443} 435}
444 436
445void System::PrepareReschedule() { 437void System::PrepareReschedule() {
446 impl->CurrentPhysicalCore().Stop(); 438 //impl->CurrentPhysicalCore().Stop();
447} 439}
448 440
449void System::PrepareReschedule(const u32 core_index) { 441void System::PrepareReschedule(const u32 core_index) {
@@ -463,11 +455,11 @@ const TelemetrySession& System::TelemetrySession() const {
463} 455}
464 456
465ARM_Interface& System::CurrentArmInterface() { 457ARM_Interface& System::CurrentArmInterface() {
466 return impl->CurrentPhysicalCore().ArmInterface(); 458 return impl->kernel.CurrentScheduler().GetCurrentThread()->ArmInterface();
467} 459}
468 460
469const ARM_Interface& System::CurrentArmInterface() const { 461const ARM_Interface& System::CurrentArmInterface() const {
470 return impl->CurrentPhysicalCore().ArmInterface(); 462 return impl->kernel.CurrentScheduler().GetCurrentThread()->ArmInterface();
471} 463}
472 464
473std::size_t System::CurrentCoreIndex() const { 465std::size_t System::CurrentCoreIndex() const {
@@ -477,27 +469,27 @@ std::size_t System::CurrentCoreIndex() const {
477} 469}
478 470
479Kernel::Scheduler& System::CurrentScheduler() { 471Kernel::Scheduler& System::CurrentScheduler() {
480 return impl->CurrentPhysicalCore().Scheduler(); 472 return impl->kernel.CurrentScheduler();
481} 473}
482 474
483const Kernel::Scheduler& System::CurrentScheduler() const { 475const Kernel::Scheduler& System::CurrentScheduler() const {
484 return impl->CurrentPhysicalCore().Scheduler(); 476 return impl->kernel.CurrentScheduler();
485} 477}
486 478
487Kernel::PhysicalCore& System::CurrentPhysicalCore() { 479Kernel::PhysicalCore& System::CurrentPhysicalCore() {
488 return impl->CurrentPhysicalCore(); 480 return impl->kernel.CurrentPhysicalCore();
489} 481}
490 482
491const Kernel::PhysicalCore& System::CurrentPhysicalCore() const { 483const Kernel::PhysicalCore& System::CurrentPhysicalCore() const {
492 return impl->CurrentPhysicalCore(); 484 return impl->kernel.CurrentPhysicalCore();
493} 485}
494 486
495Kernel::Scheduler& System::Scheduler(std::size_t core_index) { 487Kernel::Scheduler& System::Scheduler(std::size_t core_index) {
496 return impl->GetPhysicalCore(core_index).Scheduler(); 488 return impl->kernel.Scheduler(core_index);
497} 489}
498 490
499const Kernel::Scheduler& System::Scheduler(std::size_t core_index) const { 491const Kernel::Scheduler& System::Scheduler(std::size_t core_index) const {
500 return impl->GetPhysicalCore(core_index).Scheduler(); 492 return impl->kernel.Scheduler(core_index);
501} 493}
502 494
503/// Gets the global scheduler 495/// Gets the global scheduler
@@ -527,11 +519,15 @@ const Kernel::Process* System::CurrentProcess() const {
527} 519}
528 520
529ARM_Interface& System::ArmInterface(std::size_t core_index) { 521ARM_Interface& System::ArmInterface(std::size_t core_index) {
530 return impl->GetPhysicalCore(core_index).ArmInterface(); 522 auto* thread = impl->kernel.Scheduler(core_index).GetCurrentThread();
523 ASSERT(thread && !thread->IsHLEThread());
524 return thread->ArmInterface();
531} 525}
532 526
533const ARM_Interface& System::ArmInterface(std::size_t core_index) const { 527const ARM_Interface& System::ArmInterface(std::size_t core_index) const {
534 return impl->GetPhysicalCore(core_index).ArmInterface(); 528 auto* thread = impl->kernel.Scheduler(core_index).GetCurrentThread();
529 ASSERT(thread && !thread->IsHLEThread());
530 return thread->ArmInterface();
535} 531}
536 532
537ExclusiveMonitor& System::Monitor() { 533ExclusiveMonitor& System::Monitor() {