This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix clearing of interrupts in 68hc11 simulator
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH]: Fix clearing of interrupts in 68hc11 simulator
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sun, 10 Sep 2000 17:04:18 +0200
Hi!
The 68hc11 simulator was automatically clearing the interrupts after they are
serviced. This is not correct because the device must be explicitly acknowledged.
If an interrupt routine does not acknowledge, the interrupt is raised again.
I've commited the following patch to fix the problem.
Stephane
2000-09-10 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* interrupts.c (interrupts_update_pending): Clear the mask of
pending interrupts here.
(interrupts_get_current): Don't clear the mask of pending interrupts.
Index: interrupts.c
===================================================================
RCS file: /cvs/src/src/sim/m68hc11/interrupts.c,v
retrieving revision 1.2
diff -p -r1.2 interrupts.c
*** interrupts.c 2000/09/09 21:00:39 1.2
--- interrupts.c 2000/09/10 12:56:33
*************** interrupts_update_pending (struct interr
*** 102,114 ****
{
data = ioregs[idef->enable_paddr];
if (!(data & idef->enabled_mask))
! continue;
}
/* Interrupt is enabled, see if it's there. */
data = ioregs[idef->int_paddr];
if (!(data & idef->int_mask))
! continue;
/* Ok, raise it. */
interrupts->pending_mask |= (1 << idef->int_number);
--- 102,122 ----
{
data = ioregs[idef->enable_paddr];
if (!(data & idef->enabled_mask))
! {
! /* 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))
! {
! /* Disable it. */
! interrupts->pending_mask &= ~(1 << idef->int_number);
! continue;
! }
/* Ok, raise it. */
interrupts->pending_mask |= (1 << idef->int_number);
*************** interrupts_get_current (struct interrupt
*** 159,172 ****
}
/* Returns the first interrupt number which is pending.
! The interrupt priority is specified by the table `interrupt_order'. */
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;
}
}
--- 167,183 ----
}
/* Returns the first interrupt number which is pending.
! 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))
{
return int_number;
}
}