From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQF1Y-000311-HZ for qemu-devel@nongnu.org; Thu, 21 Jul 2016 10:32:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQF1T-0003ig-Va for qemu-devel@nongnu.org; Thu, 21 Jul 2016 10:32:28 -0400 From: Dmitry Osipenko Date: Thu, 21 Jul 2016 17:31:12 +0300 Message-Id: <776fdb54f6bbd9050f68136b646e8080eb77a45b.1469110137.git.digetx@gmail.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH v15 01/15] hw/ptimer: Change ptimer_get_count to return "1" for the expired timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers , qemu-arm@nongnu.org Cc: Peter Crosthwaite , Peter Maydell Software shouldn't see counter eq to "0" before timer IRQ trigger happened, as it could be wrong behaviour for some of the emulated platforms. In order to maintain deterministic behaviour, change returned counter value to "1" for the expired timer. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 30829ee..9dc2bb0 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -96,7 +96,7 @@ uint64_t ptimer_get_count(ptimer_state *s) if (expired) { /* Prevent timer underflowing if it should already have triggered. */ - counter = 0; + counter = 1; } else { uint64_t rem; uint64_t div; -- 2.9.2