summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-10 23:41:11 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:46 +0200
commitf370de84b16f9d668b7d5dcc0fd851264e2e6144 (patch)
tree1fedb0bc3338587a328b573c3319fba7cdd0c3bc /src/core/hle/kernel
parentKernel: Preempt Single core on redudant yields. (diff)
downloadyuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.tar
yuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.tar.gz
yuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.tar.bz2
yuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.tar.lz
yuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.tar.xz
yuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.tar.zst
yuzu-f370de84b16f9d668b7d5dcc0fd851264e2e6144.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/scheduler.cpp2
-rw-r--r--src/core/hle/kernel/svc.cpp9
-rw-r--r--src/core/hle/kernel/thread.h10
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() {
void Scheduler::Unload() {
Thread* thread = current_thread.get();
if (thread) {
+ thread->SetContinuousOnSVC(false);
thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
thread->SetIsRunning(false);
if (!thread->IsHLEThread()) {
@@ -697,6 +698,7 @@ void Scheduler::SwitchContext() {
// Save context for previous thread
if (previous_thread) {
+ previous_thread->SetContinuousOnSVC(false);
previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
if (!previous_thread->IsHLEThread()) {
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));
void Call(Core::System& system, u32 immediate) {
MICROPROFILE_SCOPE(Kernel_SVC);
- auto& physical_core = system.CurrentPhysicalCore();
+ auto* thread = system.CurrentScheduler().GetCurrentThread();
+ thread->SetContinuousOnSVC(true);
const FunctionDef* info = system.CurrentProcess()->Is64BitProcess() ? GetSVCInfo64(immediate)
: GetSVCInfo32(immediate);
@@ -2472,10 +2473,8 @@ void Call(Core::System& system, u32 immediate) {
} else {
LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate);
}
- auto& physical_core_2 = system.CurrentPhysicalCore();
- if (physical_core.CoreIndex() != physical_core_2.CoreIndex()) {
- LOG_CRITICAL(Kernel_SVC, "Rewinding");
- auto* thread = physical_core_2.Scheduler().GetCurrentThread();
+
+ if (!thread->IsContinuousOnSVC()) {
auto* host_context = thread->GetHostContext().get();
host_context->Rewind();
}
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:
return pausing_state != 0;
}
+ bool IsContinuousOnSVC() const {
+ return is_continuous_on_svc;
+ }
+
+ void SetContinuousOnSVC(bool is_continuous) {
+ is_continuous_on_svc = is_continuous;
+ }
+
private:
friend class GlobalScheduler;
friend class Scheduler;
@@ -672,6 +680,8 @@ private:
bool is_waiting_on_sync = false;
bool is_sync_cancelled = false;
+ bool is_continuous_on_svc = false;
+
bool will_be_terminated = false;
std::string name;