mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 09:31:04 +00:00
Stopping dyncom translation where there is a binary translation available.
This commit is contained in:
parent
70463da199
commit
f8ca04f93f
@ -28,14 +28,15 @@ Common::Profiling::TimingCategory profile_execute("DynCom::Execute");
|
||||
Common::Profiling::TimingCategory profile_decode("DynCom::Decode");
|
||||
|
||||
enum {
|
||||
COND = (1 << 0),
|
||||
NON_BRANCH = (1 << 1),
|
||||
DIRECT_BRANCH = (1 << 2),
|
||||
INDIRECT_BRANCH = (1 << 3),
|
||||
CALL = (1 << 4),
|
||||
RET = (1 << 5),
|
||||
END_OF_PAGE = (1 << 6),
|
||||
THUMB = (1 << 7)
|
||||
COND = (1 << 0),
|
||||
NON_BRANCH = (1 << 1),
|
||||
DIRECT_BRANCH = (1 << 2),
|
||||
INDIRECT_BRANCH = (1 << 3),
|
||||
CALL = (1 << 4),
|
||||
RET = (1 << 5),
|
||||
END_OF_PAGE = (1 << 6),
|
||||
THUMB = (1 << 7),
|
||||
BINARY_TRANSLATED = (1 << 8)
|
||||
};
|
||||
|
||||
#define RM BITS(sht_oper, 0, 3)
|
||||
@ -3653,6 +3654,10 @@ static int InterpreterTranslate(ARMul_State* cpu, int& bb_start, u32 addr) {
|
||||
translated:
|
||||
phys_addr += inst_size;
|
||||
|
||||
if (BinaryTranslationLoader::CanRun(phys_addr, cpu->TFlag))
|
||||
{
|
||||
inst_base->br = BINARY_TRANSLATED;
|
||||
}
|
||||
if ((phys_addr & 0xfff) == 0) {
|
||||
inst_base->br = END_OF_PAGE;
|
||||
}
|
||||
|
@ -130,6 +130,8 @@ void BinaryTranslationLoader::Load(FileUtil::IOFile& file)
|
||||
g_verify = *verify_ptr;
|
||||
|
||||
g_enabled = true;
|
||||
|
||||
LOG_INFO(Loader, "Binary translation enabled");
|
||||
}
|
||||
|
||||
void BinaryTranslationLoader::SetCpuState(ARMul_State* state)
|
||||
@ -155,6 +157,16 @@ bool BinaryTranslationLoader::CanRun(bool specific_address)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BinaryTranslationLoader::CanRun(u32 pc, bool tflag)
|
||||
{
|
||||
if (!g_enabled) return false;
|
||||
if (tflag) return false;
|
||||
std::swap(g_state->Reg[15], pc);
|
||||
auto result = g_can_run_function();
|
||||
std::swap(g_state->Reg[15], pc);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t BinaryTranslationLoader::Run(uint32_t instruction_count)
|
||||
{
|
||||
// No need to check the PC, Run does it anyway
|
||||
|
@ -12,6 +12,8 @@ public:
|
||||
// Checks whether the cpu state can be run
|
||||
// If specific_address, checks the specific PC too
|
||||
static bool CanRun(bool specific_address);
|
||||
// Checks whether the cpu state can run the specific address at the specific mode
|
||||
static bool CanRun(u32 pc, bool tflag);
|
||||
// Runs the state provided at SetCpuState.
|
||||
// Returns instruction_count + number of instructions executed
|
||||
static uint32_t Run(uint32_t instruction_count);
|
||||
|
Loading…
Reference in New Issue
Block a user