diff options
author | malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-04 14:18:13 +0000 |
---|---|---|
committer | malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-04 14:18:13 +0000 |
commit | 55e8b85e4891dafd0d0222ad1ced78e3c5f24e1e (patch) | |
tree | a9f89f6536dff7bbc0c79539ee1c3d8e785dd11a /cpu-exec.c | |
parent | 0c5f3c8d7d77307d79c6f764ef62ce6ffb3bc9e8 (diff) | |
download | qemu-55e8b85e4891dafd0d0222ad1ced78e3c5f24e1e.zip qemu-55e8b85e4891dafd0d0222ad1ced78e3c5f24e1e.tar.gz qemu-55e8b85e4891dafd0d0222ad1ced78e3c5f24e1e.tar.bz2 |
Add safety net against potential infinite loop
cpu_interrupt might be called while translating the TB, but before it
is linked into a potentially infinite loop and becomes env->current_tb.
Currently this can (and does) cause huge problems only when using
dyntick clock, with other (periodic) clocks host_alarm_handler will
eventually be executed resulting in a call to cpu_interrupt which will
reset the recursion of running TB and the damage is "only" latency.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5620 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r-- | cpu-exec.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -623,6 +623,14 @@ int cpu_exec(CPUState *env1) } spin_unlock(&tb_lock); env->current_tb = tb; + + /* cpu_interrupt might be called while translating the + TB, but before it is linked into a potentially + infinite loop and becomes env->current_tb. Avoid + starting execution if there is a pending interrupt. */ + if (unlikely (env->interrupt_request & CPU_INTERRUPT_EXIT)) + env->current_tb = NULL; + while (env->current_tb) { tc_ptr = tb->tc_ptr; /* execute the generated code */ |