All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Reif <reif@earthlink.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] sparc32: fix count calculation when limit = 0
Date: Mon, 17 Dec 2007 21:28:31 -0500	[thread overview]
Message-ID: <4767304F.3020602@earthlink.net> (raw)

[-- 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;

                 reply	other threads:[~2007-12-18  2:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4767304F.3020602@earthlink.net \
    --to=reif@earthlink.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.