Commit 31ade715088fa40976cdaf7bd4c01345ea8fda26
1 parent
6c36d3fa
Fix Qemu division by zero triggered by NetBSD
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2825 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
6 deletions
hw/slavio_timer.c
@@ -80,13 +80,11 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s) | @@ -80,13 +80,11 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s) | ||
80 | out = (ticks > s->expire_time); | 80 | out = (ticks > s->expire_time); |
81 | if (out) | 81 | if (out) |
82 | s->reached = 0x80000000; | 82 | s->reached = 0x80000000; |
83 | - if (!s->limit) | ||
84 | - limit = 0x7fffffff; | ||
85 | - else | ||
86 | - limit = s->limit; | ||
87 | - | ||
88 | // Convert register units to counter ticks | 83 | // Convert register units to counter ticks |
89 | - limit = limit >> 9; | 84 | + limit = s->limit >> 9; |
85 | + | ||
86 | + if (!limit) | ||
87 | + limit = 0x7fffffff >> 9; | ||
90 | 88 | ||
91 | // Convert cpu ticks to counter ticks | 89 | // Convert cpu ticks to counter ticks |
92 | diff = muldiv64(ticks - s->count_load_time, CNT_FREQ, ticks_per_sec); | 90 | diff = muldiv64(ticks - s->count_load_time, CNT_FREQ, ticks_per_sec); |