From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J4SCC-0001XU-BZ for qemu-devel@nongnu.org; Mon, 17 Dec 2007 21:28:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J4SCA-0001Vw-2m for qemu-devel@nongnu.org; Mon, 17 Dec 2007 21:28:35 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4SC9-0001Vj-Ph for qemu-devel@nongnu.org; Mon, 17 Dec 2007 21:28:33 -0500 Received: from pop-scotia.atl.sa.earthlink.net ([207.69.195.65]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J4SC9-0006ic-Ok for qemu-devel@nongnu.org; Mon, 17 Dec 2007 21:28:33 -0500 Received: from user-142h2k8.cable.mindspring.com ([72.40.138.136] helo=earthlink.net) by pop-scotia.atl.sa.earthlink.net with esmtp (Exim 3.36 #1) id 1J4SC8-0003bG-00 for qemu-devel@nongnu.org; Mon, 17 Dec 2007 21:28:32 -0500 Message-ID: <4767304F.3020602@earthlink.net> Date: Mon, 17 Dec 2007 21:28:31 -0500 From: Robert Reif MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060301070404090807020300" Subject: [Qemu-devel] [PATCH] sparc32: fix count calculation when limit = 0 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060301070404090807020300 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Fix count calculation when counter limit set to 0. --------------060301070404090807020300 Content-Type: text/plain; name="timer2.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="timer2.diff.txt" 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; --------------060301070404090807020300--