Merge pull request #3184 from MerryMage/timing
core/arm: Improve timing accuracy before service calls in JIT
This commit is contained in:
commit
e165b5bb94
10 changed files with 64 additions and 53 deletions
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include "core/arm/dyncom/arm_dyncom.h"
|
||||
|
@ -20,6 +21,14 @@ ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) {
|
|||
|
||||
ARM_DynCom::~ARM_DynCom() {}
|
||||
|
||||
void ARM_DynCom::Run() {
|
||||
ExecuteInstructions(std::max(CoreTiming::GetDowncount(), 0));
|
||||
}
|
||||
|
||||
void ARM_DynCom::Step() {
|
||||
ExecuteInstructions(1);
|
||||
}
|
||||
|
||||
void ARM_DynCom::ClearInstructionCache() {
|
||||
state->instruction_cache.clear();
|
||||
trans_cache_buf_top = 0;
|
||||
|
@ -79,10 +88,6 @@ void ARM_DynCom::SetCP15Register(CP15Register reg, u32 value) {
|
|||
|
||||
void ARM_DynCom::ExecuteInstructions(int num_instructions) {
|
||||
state->NumInstrsToExecute = num_instructions;
|
||||
|
||||
// Dyncom only breaks on instruction dispatch. This only happens on every instruction when
|
||||
// executing one instruction at a time. Otherwise, if a block is being executed, more
|
||||
// instructions may actually be executed than specified.
|
||||
unsigned ticks_executed = InterpreterMainLoop(state.get());
|
||||
CoreTiming::AddTicks(ticks_executed);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@ public:
|
|||
ARM_DynCom(PrivilegeMode initial_mode);
|
||||
~ARM_DynCom();
|
||||
|
||||
void Run() override;
|
||||
void Step() override;
|
||||
|
||||
void ClearInstructionCache() override;
|
||||
void PageTableChanged() override;
|
||||
|
||||
|
@ -35,8 +38,9 @@ public:
|
|||
void LoadContext(const ThreadContext& ctx) override;
|
||||
|
||||
void PrepareReschedule() override;
|
||||
void ExecuteInstructions(int num_instructions) override;
|
||||
|
||||
private:
|
||||
void ExecuteInstructions(int num_instructions);
|
||||
|
||||
std::unique_ptr<ARMul_State> state;
|
||||
};
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "core/arm/skyeye_common/armstate.h"
|
||||
#include "core/arm/skyeye_common/armsupp.h"
|
||||
#include "core/arm/skyeye_common/vfp/vfp.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/gdbstub/gdbstub.h"
|
||||
#include "core/hle/svc.h"
|
||||
#include "core/memory.h"
|
||||
|
@ -3858,6 +3859,10 @@ SUB_INST : {
|
|||
SWI_INST : {
|
||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||
swi_inst* const inst_cream = (swi_inst*)inst_base->component;
|
||||
CoreTiming::AddTicks(num_instrs);
|
||||
cpu->NumInstrsToExecute =
|
||||
num_instrs >= cpu->NumInstrsToExecute ? 0 : cpu->NumInstrsToExecute - num_instrs;
|
||||
num_instrs = 0;
|
||||
SVC::CallSVC(inst_cream->num & 0xFFFF);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue