diff mbox

[v15,01/15] hw/ptimer: Change ptimer_get_count to return "1" for the expired timer

Message ID 776fdb54f6bbd9050f68136b646e8080eb77a45b.1469110137.git.digetx@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Osipenko July 21, 2016, 2:31 p.m. UTC
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 <digetx@gmail.com>
---
 hw/core/ptimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

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;