mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Kernel: Rewind on SVC change.
This commit is contained in:
parent
d494b074e8
commit
f370de84b1
3 changed files with 16 additions and 5 deletions
|
@ -605,6 +605,7 @@ void Scheduler::OnThreadStart() {
|
||||||
void Scheduler::Unload() {
|
void Scheduler::Unload() {
|
||||||
Thread* thread = current_thread.get();
|
Thread* thread = current_thread.get();
|
||||||
if (thread) {
|
if (thread) {
|
||||||
|
thread->SetContinuousOnSVC(false);
|
||||||
thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
|
thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
|
||||||
thread->SetIsRunning(false);
|
thread->SetIsRunning(false);
|
||||||
if (!thread->IsHLEThread()) {
|
if (!thread->IsHLEThread()) {
|
||||||
|
@ -697,6 +698,7 @@ void Scheduler::SwitchContext() {
|
||||||
|
|
||||||
// Save context for previous thread
|
// Save context for previous thread
|
||||||
if (previous_thread) {
|
if (previous_thread) {
|
||||||
|
previous_thread->SetContinuousOnSVC(false);
|
||||||
previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
|
previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
|
||||||
if (!previous_thread->IsHLEThread()) {
|
if (!previous_thread->IsHLEThread()) {
|
||||||
auto& cpu_core = system.ArmInterface(core_id);
|
auto& cpu_core = system.ArmInterface(core_id);
|
||||||
|
|
|
@ -2459,7 +2459,8 @@ MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70));
|
||||||
void Call(Core::System& system, u32 immediate) {
|
void Call(Core::System& system, u32 immediate) {
|
||||||
MICROPROFILE_SCOPE(Kernel_SVC);
|
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)
|
const FunctionDef* info = system.CurrentProcess()->Is64BitProcess() ? GetSVCInfo64(immediate)
|
||||||
: GetSVCInfo32(immediate);
|
: GetSVCInfo32(immediate);
|
||||||
|
@ -2472,10 +2473,8 @@ void Call(Core::System& system, u32 immediate) {
|
||||||
} else {
|
} else {
|
||||||
LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate);
|
LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate);
|
||||||
}
|
}
|
||||||
auto& physical_core_2 = system.CurrentPhysicalCore();
|
|
||||||
if (physical_core.CoreIndex() != physical_core_2.CoreIndex()) {
|
if (!thread->IsContinuousOnSVC()) {
|
||||||
LOG_CRITICAL(Kernel_SVC, "Rewinding");
|
|
||||||
auto* thread = physical_core_2.Scheduler().GetCurrentThread();
|
|
||||||
auto* host_context = thread->GetHostContext().get();
|
auto* host_context = thread->GetHostContext().get();
|
||||||
host_context->Rewind();
|
host_context->Rewind();
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,6 +573,14 @@ public:
|
||||||
return pausing_state != 0;
|
return pausing_state != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsContinuousOnSVC() const {
|
||||||
|
return is_continuous_on_svc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetContinuousOnSVC(bool is_continuous) {
|
||||||
|
is_continuous_on_svc = is_continuous;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class GlobalScheduler;
|
friend class GlobalScheduler;
|
||||||
friend class Scheduler;
|
friend class Scheduler;
|
||||||
|
@ -672,6 +680,8 @@ private:
|
||||||
bool is_waiting_on_sync = false;
|
bool is_waiting_on_sync = false;
|
||||||
bool is_sync_cancelled = false;
|
bool is_sync_cancelled = false;
|
||||||
|
|
||||||
|
bool is_continuous_on_svc = false;
|
||||||
|
|
||||||
bool will_be_terminated = false;
|
bool will_be_terminated = false;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
Loading…
Reference in a new issue