* [Qemu-devel] [PATCH] sparc32: fix count calculation when limit = 0
@ 2007-12-18 2:28 Robert Reif
0 siblings, 0 replies; only message in thread
From: Robert Reif @ 2007-12-18 2:28 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 51 bytes --]
Fix count calculation when counter limit set to 0.
[-- Attachment #2: timer2.diff.txt --]
[-- Type: text/plain, Size: 775 bytes --]
diff -p -u -r1.23 slavio_timer.c
--- hw/slavio_timer.c 17 Dec 2007 18:21:57 -0000 1.23
+++ hw/slavio_timer.c 18 Dec 2007 02:23:37 -0000
@@ -97,9 +97,14 @@ static int slavio_timer_is_user(SLAVIO_T
// Convert from ptimer countdown units
static void slavio_timer_get_out(SLAVIO_TIMERState *s)
{
- uint64_t count;
+ uint64_t count, limit;
- count = s->limit - PERIODS_TO_LIMIT(ptimer_get_count(s->timer));
+ if (s->limit == 0) /* free-run processor or system counter */
+ limit = TIMER_MAX_COUNT32;
+ else
+ limit = s->limit;
+
+ count = limit - PERIODS_TO_LIMIT(ptimer_get_count(s->timer));
DPRINTF("get_out: limit %" PRIx64 " count %x%08x\n", s->limit,
s->counthigh, s->count);
s->count = count & TIMER_COUNT_MASK32;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-18 2:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 2:28 [Qemu-devel] [PATCH] sparc32: fix count calculation when limit = 0 Robert Reif
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.