aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);