From 31ade715088fa40976cdaf7bd4c01345ea8fda26 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Thu, 17 May 2007 19:32:20 +0000 Subject: [PATCH] Fix Qemu division by zero triggered by NetBSD git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2825 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/slavio_timer.c | 10 ++++------ 1 file 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); -- GitLab