SVC/ARM: Correct svcSendSyncRequest and cache ticks on arm interface.

This commit is contained in:
Fernando Sahmkow 2020-03-20 12:36:01 -04:00
parent f2ade343e2
commit 87c49aa7be
3 changed files with 20 additions and 5 deletions

View file

@ -72,17 +72,23 @@ public:
} }
void AddTicks(u64 ticks) override { void AddTicks(u64 ticks) override {
/// We are using host timing, NOP this->ticks -= ticks;
} }
u64 GetTicksRemaining() override { u64 GetTicksRemaining() override {
if (!parent.interrupt_handler.IsInterrupted()) { if (!parent.interrupt_handler.IsInterrupted()) {
return 1000ULL; return std::max<s64>(ticks, 0);
} }
return 0ULL; return 0ULL;
} }
void ResetTicks() {
ticks = 1000LL;
}
ARM_Dynarmic_32& parent; ARM_Dynarmic_32& parent;
std::size_t num_interpreted_instructions{}; std::size_t num_interpreted_instructions{};
s64 ticks{};
}; };
std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable& page_table, std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable& page_table,
@ -97,6 +103,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable&
} }
void ARM_Dynarmic_32::Run() { void ARM_Dynarmic_32::Run() {
cb->ResetTicks();
jit->Run(); jit->Run();
} }

View file

@ -124,22 +124,29 @@ public:
} }
void AddTicks(u64 ticks) override { void AddTicks(u64 ticks) override {
/// We are using host timing, NOP this->ticks -= ticks;
} }
u64 GetTicksRemaining() override { u64 GetTicksRemaining() override {
if (!parent.interrupt_handler.IsInterrupted()) { if (!parent.interrupt_handler.IsInterrupted()) {
return 1000ULL; return std::max<s64>(ticks, 0);
} }
return 0ULL; return 0ULL;
} }
u64 GetCNTPCT() override { u64 GetCNTPCT() override {
return parent.system.CoreTiming().GetClockTicks(); return parent.system.CoreTiming().GetClockTicks();
} }
void ResetTicks() {
ticks = 1000LL;
}
ARM_Dynarmic_64& parent; ARM_Dynarmic_64& parent;
std::size_t num_interpreted_instructions = 0; std::size_t num_interpreted_instructions = 0;
u64 tpidrro_el0 = 0; u64 tpidrro_el0 = 0;
u64 tpidr_el0 = 0; u64 tpidr_el0 = 0;
s64 ticks{};
}; };
std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable& page_table, std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable& page_table,
@ -181,6 +188,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable&
} }
void ARM_Dynarmic_64::Run() { void ARM_Dynarmic_64::Run() {
cb->ResetTicks();
jit->Run(); jit->Run();
} }

View file

@ -342,7 +342,7 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
thread->InvokeHLECallback(SharedFrom(thread)); thread->InvokeHLECallback(SharedFrom(thread));
} }
return RESULT_SUCCESS; return thread->GetSignalingResult();
} }
static ResultCode SendSyncRequest32(Core::System& system, Handle handle) { static ResultCode SendSyncRequest32(Core::System& system, Handle handle) {