[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 29/47] cpu-exec: invalidate nocache translation if th
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 29/47] cpu-exec: invalidate nocache translation if they are interrupted |
Date: |
Mon, 15 Dec 2014 17:38:13 +0100 |
From: Pavel Dovgalyuk <address@hidden>
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.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpu-exec.c | 2 +-
include/exec/exec-all.h | 1 +
translate-all.c | 6 ++++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index cce80f0..a4f0eff 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -216,7 +216,7 @@ static void cpu_exec_nocache(CPUArchState *env, int
max_cycles,
/* tb_gen_code can flush our orig_tb, invalidate it now */
tb_phys_invalidate(orig_tb, -1);
tb = tb_gen_code(cpu, pc, cs_base, flags,
- max_cycles);
+ max_cycles | CF_NOCACHE);
cpu->current_tb = tb;
/* execute the generated code */
trace_exec_tb_nocache(tb, tb->pc);
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 0844885..38a8a09 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -145,6 +145,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. */
diff --git a/translate-all.c b/translate-all.c
index ba5c840..cf05472 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -264,6 +264,12 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
tb = tb_find_pc(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(tb, -1);
+ tb_free(tb);
+ }
return true;
}
return false;
--
1.8.3.1
- [Qemu-devel] [PULL 24/47] scsi-disk: provide maximum transfer length, (continued)
- [Qemu-devel] [PULL 27/47] icount: set can_do_io outside TB execution, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 25/47] cpu-exec: fix cpu_exec_nocache, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 28/47] icount: introduce cpu_get_icount_raw, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 29/47] cpu-exec: invalidate nocache translation if they are interrupted,
Paolo Bonzini <=
- [Qemu-devel] [PULL 30/47] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 31/47] cpus: make icount warp behave well with respect to stop/cont, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 32/47] i386: do not cross the pages boundaries in replay mode, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 34/47] target-i386: add VME to all CPUs, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 33/47] pc: add 2.3 machine types, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 35/47] target-i386: add f16c and rdrand to Haswell and Broadwell, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 36/47] target-i386: add Ivy Bridge CPU model, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 38/47] linuxboot: fix loading old kernels, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 37/47] kvm/apic: fix 2.2->2.1 migration, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 39/47] serial: reset thri_pending on IER writes with THRI=0, Paolo Bonzini, 2014/12/15