diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 9 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 10 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 00322d997..25fc8a3e8 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -605,6 +605,7 @@ void Scheduler::OnThreadStart() { | |||
| 605 | void Scheduler::Unload() { | 605 | void Scheduler::Unload() { |
| 606 | Thread* thread = current_thread.get(); | 606 | Thread* thread = current_thread.get(); |
| 607 | if (thread) { | 607 | if (thread) { |
| 608 | thread->SetContinuousOnSVC(false); | ||
| 608 | thread->last_running_ticks = system.CoreTiming().GetCPUTicks(); | 609 | thread->last_running_ticks = system.CoreTiming().GetCPUTicks(); |
| 609 | thread->SetIsRunning(false); | 610 | thread->SetIsRunning(false); |
| 610 | if (!thread->IsHLEThread()) { | 611 | if (!thread->IsHLEThread()) { |
| @@ -697,6 +698,7 @@ void Scheduler::SwitchContext() { | |||
| 697 | 698 | ||
| 698 | // Save context for previous thread | 699 | // Save context for previous thread |
| 699 | if (previous_thread) { | 700 | if (previous_thread) { |
| 701 | previous_thread->SetContinuousOnSVC(false); | ||
| 700 | previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks(); | 702 | previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks(); |
| 701 | if (!previous_thread->IsHLEThread()) { | 703 | if (!previous_thread->IsHLEThread()) { |
| 702 | auto& cpu_core = system.ArmInterface(core_id); | 704 | auto& cpu_core = system.ArmInterface(core_id); |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index eca92b356..d3d4e7bf9 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -2459,7 +2459,8 @@ MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); | |||
| 2459 | void Call(Core::System& system, u32 immediate) { | 2459 | void Call(Core::System& system, u32 immediate) { |
| 2460 | MICROPROFILE_SCOPE(Kernel_SVC); | 2460 | MICROPROFILE_SCOPE(Kernel_SVC); |
| 2461 | 2461 | ||
| 2462 | auto& physical_core = system.CurrentPhysicalCore(); | 2462 | auto* thread = system.CurrentScheduler().GetCurrentThread(); |
| 2463 | thread->SetContinuousOnSVC(true); | ||
| 2463 | 2464 | ||
| 2464 | const FunctionDef* info = system.CurrentProcess()->Is64BitProcess() ? GetSVCInfo64(immediate) | 2465 | const FunctionDef* info = system.CurrentProcess()->Is64BitProcess() ? GetSVCInfo64(immediate) |
| 2465 | : GetSVCInfo32(immediate); | 2466 | : GetSVCInfo32(immediate); |
| @@ -2472,10 +2473,8 @@ void Call(Core::System& system, u32 immediate) { | |||
| 2472 | } else { | 2473 | } else { |
| 2473 | LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); | 2474 | LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); |
| 2474 | } | 2475 | } |
| 2475 | auto& physical_core_2 = system.CurrentPhysicalCore(); | 2476 | |
| 2476 | if (physical_core.CoreIndex() != physical_core_2.CoreIndex()) { | 2477 | if (!thread->IsContinuousOnSVC()) { |
| 2477 | LOG_CRITICAL(Kernel_SVC, "Rewinding"); | ||
| 2478 | auto* thread = physical_core_2.Scheduler().GetCurrentThread(); | ||
| 2479 | auto* host_context = thread->GetHostContext().get(); | 2478 | auto* host_context = thread->GetHostContext().get(); |
| 2480 | host_context->Rewind(); | 2479 | host_context->Rewind(); |
| 2481 | } | 2480 | } |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 9a29875ac..168828ab0 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -573,6 +573,14 @@ public: | |||
| 573 | return pausing_state != 0; | 573 | return pausing_state != 0; |
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | bool IsContinuousOnSVC() const { | ||
| 577 | return is_continuous_on_svc; | ||
| 578 | } | ||
| 579 | |||
| 580 | void SetContinuousOnSVC(bool is_continuous) { | ||
| 581 | is_continuous_on_svc = is_continuous; | ||
| 582 | } | ||
| 583 | |||
| 576 | private: | 584 | private: |
| 577 | friend class GlobalScheduler; | 585 | friend class GlobalScheduler; |
| 578 | friend class Scheduler; | 586 | friend class Scheduler; |
| @@ -672,6 +680,8 @@ private: | |||
| 672 | bool is_waiting_on_sync = false; | 680 | bool is_waiting_on_sync = false; |
| 673 | bool is_sync_cancelled = false; | 681 | bool is_sync_cancelled = false; |
| 674 | 682 | ||
| 683 | bool is_continuous_on_svc = false; | ||
| 684 | |||
| 675 | bool will_be_terminated = false; | 685 | bool will_be_terminated = false; |
| 676 | 686 | ||
| 677 | std::string name; | 687 | std::string name; |