summaryrefslogtreecommitdiff
path: root/sim/m68hc11/interrupts.c
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2000-09-10 12:58:53 +0000
committerStephane Carrez <stcarrez@nerim.fr>2000-09-10 12:58:53 +0000
commita8afa79ab6fa5848dfd41b0e6173b51e4a898c9f (patch)
tree9ef2aefed0aa11af68e0be8dc3f19663220e34d5 /sim/m68hc11/interrupts.c
parent2990a9f484ce9ff796d68d6fbfdad7e8a2ea61b8 (diff)
downloadbinutils-gdb-a8afa79ab6fa5848dfd41b0e6173b51e4a898c9f.tar.gz
Fix clearing of interrupts in 68hc11 simulator
Diffstat (limited to 'sim/m68hc11/interrupts.c')
-rw-r--r--sim/m68hc11/interrupts.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sim/m68hc11/interrupts.c b/sim/m68hc11/interrupts.c
index 655c4006f9d..44771bb4e03 100644
--- a/sim/m68hc11/interrupts.c
+++ b/sim/m68hc11/interrupts.c
@@ -102,13 +102,21 @@ interrupts_update_pending (struct interrupts *interrupts)
{
data = ioregs[idef->enable_paddr];
if (!(data & idef->enabled_mask))
- continue;
+ {
+ /* Disable it. */
+ interrupts->pending_mask &= ~(1 << idef->int_number);
+ continue;
+ }
}
/* Interrupt is enabled, see if it's there. */
data = ioregs[idef->int_paddr];
if (!(data & idef->int_mask))
- continue;
+ {
+ /* Disable it. */
+ interrupts->pending_mask &= ~(1 << idef->int_number);
+ continue;
+ }
/* Ok, raise it. */
interrupts->pending_mask |= (1 << idef->int_number);
@@ -159,14 +167,17 @@ interrupts_get_current (struct interrupts *interrupts)
}
/* Returns the first interrupt number which is pending.
- The interrupt priority is specified by the table `interrupt_order'. */
+ The interrupt priority is specified by the table `interrupt_order'.
+ For these interrupts, the pending mask is cleared when the program
+ performs some actions on the corresponding device. If the device
+ is not reset, the interrupt remains and will be re-raised when
+ we return from the interrupt (see 68HC11 pink book). */
for (i = 0; i < M6811_INT_NUMBER; i++)
{
enum M6811_INT int_number = interrupts->interrupt_order[i];
if (interrupts->pending_mask & (1 << int_number))
{
- interrupts->pending_mask &= ~(1 << int_number);
return int_number;
}
}