mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-25 21:41:11 +00:00
cpu-exec: invalidate nocache translation if they are interrupted
In this case, QEMU might longjmp out of cpu-exec.c and miss the final cleanup in cpu_exec_nocache. Do this manually through a new compile flag. Backports commit d8a499f17ee5f05407874f29f69f0e3e3198a853 from qemu
This commit is contained in:
parent
1cbd175736
commit
ac46898b3c
|
@ -193,6 +193,7 @@ struct TranslationBlock {
|
||||||
uint16_t cflags; /* compile flags */
|
uint16_t cflags; /* compile flags */
|
||||||
#define CF_COUNT_MASK 0x7fff
|
#define CF_COUNT_MASK 0x7fff
|
||||||
#define CF_LAST_IO 0x8000 /* Last insn may be an IO access. */
|
#define CF_LAST_IO 0x8000 /* Last insn may be an IO access. */
|
||||||
|
#define CF_NOCACHE 0x10000 /* To be freed after execution */
|
||||||
|
|
||||||
void *tc_ptr; /* pointer to the translated code */
|
void *tc_ptr; /* pointer to the translated code */
|
||||||
/* next matching tb for physical address. */
|
/* next matching tb for physical address. */
|
||||||
|
|
|
@ -283,6 +283,12 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
|
||||||
tb = tb_find_pc(env->uc, retaddr);
|
tb = tb_find_pc(env->uc, retaddr);
|
||||||
if (tb) {
|
if (tb) {
|
||||||
cpu_restore_state_from_tb(cpu, tb, retaddr);
|
cpu_restore_state_from_tb(cpu, tb, retaddr);
|
||||||
|
if (tb->cflags & CF_NOCACHE) {
|
||||||
|
/* one-shot translation, invalidate it immediately */
|
||||||
|
cpu->current_tb = NULL;
|
||||||
|
tb_phys_invalidate(cpu->uc, tb, -1);
|
||||||
|
tb_free(cpu->uc, tb);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue