simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Simulavr-devel] [PATCH] FIX: Removed delayed ISR calls when clearing th


From: Stan Behrens
Subject: [Simulavr-devel] [PATCH] FIX: Removed delayed ISR calls when clearing the interrupt's flag.
Date: Wed, 4 Jan 2012 15:55:54 +0100

---
 src/hwtimer/timerirq.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/hwtimer/timerirq.cpp b/src/hwtimer/timerirq.cpp
index 279d4a7..fe696be 100644
--- a/src/hwtimer/timerirq.cpp
+++ b/src/hwtimer/timerirq.cpp
@@ -129,9 +129,18 @@ unsigned char TimerIRQRegister::set_from_reg(const 
IOSpecialReg* reg, unsigned c
                 irqsystem->SetIrqFlag(this, lines[idx]->irqvector);
         }
         irqmask = nv;
-    } else
+    } else {
+               // Get all interrupt flags that are actually cleared with this 
instruction.
+               unsigned char reset = nv & bitmask & irqflags;
+
         // reset flag, if written with 1
-        irqflags ^= nv & bitmask & irqflags;
+        irqflags ^= reset;
+
+               // Walk through resetted flags beginning with the LSB.
+               for(unsigned char idx = 0; reset && idx < lines.size(); ++idx, 
reset >>= 1)
+                       if(reset & 1)
+                               ClearIrqFlag(lines[idx]->irqvector);
+       }
     return nv;
 }
 
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]