aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-07-07 21:46:29 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-07-07 21:46:29 +0000
commit4e588a4d0e1683488282658c057d4b44976d77d8 (patch)
tree05d062377c028ad52eea676933249722bb409853 /hw/ppc.c
parenta368741bf2508b7ca29d9ade73ec1b0f29ae2286 (diff)
negative decr fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1510 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ppc.c')
-rw-r--r--hw/ppc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/ppc.c b/hw/ppc.c
index 2146739a92..c460fec482 100644
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -107,13 +107,16 @@ uint32_t cpu_ppc_load_decr (CPUState *env)
{
ppc_tb_t *tb_env = env->tb_env;
uint32_t decr;
+ int64_t diff;
- decr = muldiv64(tb_env->decr_next - qemu_get_clock(vm_clock),
- tb_env->tb_freq, ticks_per_sec);
+ diff = tb_env->decr_next - qemu_get_clock(vm_clock);
+ if (diff >= 0)
+ decr = muldiv64(diff, tb_env->tb_freq, ticks_per_sec);
+ else
+ decr = -muldiv64(-diff, tb_env->tb_freq, ticks_per_sec);
#if defined(DEBUG_TB)
printf("%s: 0x%08x\n", __func__, decr);
#endif
-
return decr;
}