mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 01:35:31 +00:00
tcg: Pass last_tb by value to tb_find_fast()
This is a small clean up. tb_find_fast() is a final consumer of this variable so no need to pass it by reference. 'last_tb' is always updated by subsequent cpu_loop_exec_tb() in cpu_exec(). This change also simplifies calling cpu_exec_nocache() in cpu_handle_exception(). Backports commit 4b7e69509df2fcbfdab8c62c294dbfcfdab8a6e1 from qemu
This commit is contained in:
parent
cc45b82472
commit
371101a184
|
@ -180,7 +180,7 @@ found:
|
|||
}
|
||||
|
||||
static inline TranslationBlock *tb_find_fast(CPUState *cpu,
|
||||
TranslationBlock **last_tb,
|
||||
TranslationBlock *last_tb,
|
||||
int tb_exit)
|
||||
{
|
||||
CPUArchState *env = (CPUArchState *)cpu->env_ptr;
|
||||
|
@ -203,7 +203,7 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu,
|
|||
/* Ensure that no TB jump will be modified as the
|
||||
* translation buffer has been flushed.
|
||||
*/
|
||||
*last_tb = NULL;
|
||||
last_tb = NULL;
|
||||
cpu->tb_flushed = false;
|
||||
}
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
@ -212,12 +212,12 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu,
|
|||
* spanning two pages because the mapping for the second page can change.
|
||||
*/
|
||||
if (tb->page_addr[1] != -1) {
|
||||
*last_tb = NULL;
|
||||
last_tb = NULL;
|
||||
}
|
||||
#endif
|
||||
/* See if we can patch the calling TB. */
|
||||
if (*last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
|
||||
tb_add_jump(*last_tb, tb_exit, tb);
|
||||
if (last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
|
||||
tb_add_jump(last_tb, tb_exit, tb);
|
||||
}
|
||||
// Unicorn: commented out
|
||||
//tb_unlock();
|
||||
|
@ -444,7 +444,7 @@ int cpu_exec(struct uc_struct *uc, CPUState *cpu)
|
|||
cpu->tb_flushed = false; /* reset before first TB lookup */
|
||||
for(;;) {
|
||||
cpu_handle_interrupt(cpu, &last_tb);
|
||||
tb = tb_find_fast(cpu, &last_tb, tb_exit);
|
||||
tb = tb_find_fast(cpu, last_tb, tb_exit);
|
||||
if (!tb) { // invalid TB due to invalid code?
|
||||
uc->invalid_error = UC_ERR_FETCH_UNMAPPED;
|
||||
ret = EXCP_HLT;
|
||||
|
|
Loading…
Reference in a new issue