summary refs log tree commit diff stats
path: root/hw/mips_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/mips_timer.c')
-rw-r--r--hw/mips_timer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/mips_timer.c b/hw/mips_timer.c
index 5b172ea424..5549e2483a 100644
--- a/hw/mips_timer.c
+++ b/hw/mips_timer.c
@@ -91,7 +91,12 @@ static void mips_timer_cb (void *opaque)
     if (env->CP0_Cause & (1 << CP0Ca_DC))
         return;
 
+    /* ??? This callback should occur when the counter is exactly equal to
+       the comparator value.  Offset the count by one to avoid immediately
+       retriggering the callback before any virtual time has passed.  */
+    env->CP0_Count++;
     cpu_mips_timer_update(env);
+    env->CP0_Count--;
     if (env->insn_flags & ISA_MIPS32R2)
         env->CP0_Cause |= 1 << CP0Ca_TI;
     qemu_irq_raise(env->irq[(env->CP0_IntCtl >> CP0IntCtl_IPTI) & 0x7]);