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:
Pavel Dovgalyuk 2018-02-16 08:39:07 -05:00 committed by Lioncash
parent 1cbd175736
commit ac46898b3c
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 7 additions and 0 deletions

View file

@ -193,6 +193,7 @@ struct TranslationBlock {
uint16_t cflags; /* compile flags */
#define CF_COUNT_MASK 0x7fff
#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 */
/* next matching tb for physical address. */

View file

@ -283,6 +283,12 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
tb = tb_find_pc(env->uc, retaddr);
if (tb) {
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 false;