aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-05-17 19:32:20 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-05-17 19:32:20 +0000
commit31ade715088fa40976cdaf7bd4c01345ea8fda26 (patch)
tree60a6fb2b3b479d3ee4f932eda1d8f755c6682060
parent6c36d3fa860b1dfa55de1e8248be6fffcd876f69 (diff)
Fix Qemu division by zero triggered by NetBSD
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2825 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/slavio_timer.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index acf94f3d53..91148583a0 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -80,13 +80,11 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s)
out = (ticks > s->expire_time);
if (out)
s->reached = 0x80000000;
- if (!s->limit)
- limit = 0x7fffffff;
- else
- limit = s->limit;
-
// Convert register units to counter ticks
- limit = limit >> 9;
+ limit = s->limit >> 9;
+
+ if (!limit)
+ limit = 0x7fffffff >> 9;
// Convert cpu ticks to counter ticks
diff = muldiv64(ticks - s->count_load_time, CNT_FREQ, ticks_per_sec);