summaryrefslogtreecommitdiffstats
path: root/sim/m68hc11/interrupts.c
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2001-05-20 15:36:29 +0000
committerStephane Carrez <stcarrez@nerim.fr>2001-05-20 15:36:29 +0000
commit11115521f652c7a4c85fc326efc1ad6fae913e59 (patch)
tree70e9bdee565a958b693e867ae3bd8cc0ad898d33 /sim/m68hc11/interrupts.c
parentb4fa4770b8c2145ec040cb87ead3bd467cb4fa7b (diff)
downloadppe42-binutils-11115521f652c7a4c85fc326efc1ad6fae913e59.tar.gz
ppe42-binutils-11115521f652c7a4c85fc326efc1ad6fae913e59.zip
* dv-m68hc11sio.c (m68hc11sio_tx_poll): Always check for
pending interrupts. * interrupts.c (interrupts_process): Keep track of the last number of masked insn cycles. (interrupts_initialize): Clear last number of masked insn cycles. (interrupts_info): Report them. (interrupts_update_pending): Compute clear and set masks of interrupts and clear the interrupt bits before setting them (due to SCI interrupt sharing). * interrupts.h (struct interrupts): New members last_mask_cycles and xirq_last_mask_cycles.
Diffstat (limited to 'sim/m68hc11/interrupts.c')
-rw-r--r--sim/m68hc11/interrupts.c59
1 files changed, 43 insertions, 16 deletions
diff --git a/sim/m68hc11/interrupts.c b/sim/m68hc11/interrupts.c
index 44771bb4e0..5c7f5e21bd 100644
--- a/sim/m68hc11/interrupts.c
+++ b/sim/m68hc11/interrupts.c
@@ -1,5 +1,5 @@
/* interrupts.c -- 68HC11 Interrupts Emulation
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@worldnet.fr)
This file is part of GDB, GAS, and the GNU binutils.
@@ -67,10 +67,12 @@ interrupts_initialize (struct _sim_cpu *proc)
interrupts->nb_interrupts_raised = 0;
interrupts->min_mask_cycles = CYCLES_MAX;
interrupts->max_mask_cycles = 0;
+ interrupts->last_mask_cycles = 0;
interrupts->start_mask_cycle = -1;
interrupts->xirq_start_mask_cycle = -1;
interrupts->xirq_max_mask_cycles = 0;
interrupts->xirq_min_mask_cycles = CYCLES_MAX;
+ interrupts->xirq_last_mask_cycles = 0;
for (i = 0; i < M6811_INT_NUMBER; i++)
{
@@ -89,7 +91,11 @@ interrupts_update_pending (struct interrupts *interrupts)
{
int i;
uint8 *ioregs;
+ unsigned long clear_mask;
+ unsigned long set_mask;
+ clear_mask = 0;
+ set_mask = 0;
ioregs = &interrupts->cpu->ios[0];
for (i = 0; i < TableSize(idefs); i++)
@@ -104,7 +110,7 @@ interrupts_update_pending (struct interrupts *interrupts)
if (!(data & idef->enabled_mask))
{
/* Disable it. */
- interrupts->pending_mask &= ~(1 << idef->int_number);
+ clear_mask |= (1 << idef->int_number);
continue;
}
}
@@ -114,13 +120,18 @@ interrupts_update_pending (struct interrupts *interrupts)
if (!(data & idef->int_mask))
{
/* Disable it. */
- interrupts->pending_mask &= ~(1 << idef->int_number);
+ clear_mask |= (1 << idef->int_number);
continue;
}
/* Ok, raise it. */
- interrupts->pending_mask |= (1 << idef->int_number);
+ set_mask |= (1 << idef->int_number);
}
+
+ /* Some interrupts are shared (M6811_INT_SCI) so clear
+ the interrupts before setting the new ones. */
+ interrupts->pending_mask &= ~clear_mask;
+ interrupts->pending_mask |= set_mask;
}
@@ -214,6 +225,7 @@ interrupts_process (struct interrupts *interrupts)
if (t > interrupts->max_mask_cycles)
interrupts->max_mask_cycles = t;
interrupts->start_mask_cycle = -1;
+ interrupts->last_mask_cycles = t;
}
if (ccr & M6811_X_BIT)
{
@@ -232,6 +244,7 @@ interrupts_process (struct interrupts *interrupts)
if (t > interrupts->xirq_max_mask_cycles)
interrupts->xirq_max_mask_cycles = t;
interrupts->xirq_start_mask_cycle = -1;
+ interrupts->xirq_last_mask_cycles = t;
}
id = interrupts_get_current (interrupts);
@@ -275,6 +288,10 @@ interrupts_info (SIM_DESC sd, struct interrupts *interrupts)
{
signed64 t;
+ sim_io_printf (sd, "Interrupts Info:\n");
+ sim_io_printf (sd, " Interrupts raised: %lu\n",
+ interrupts->nb_interrupts_raised);
+
if (interrupts->start_mask_cycle >= 0)
{
t = cpu_current_cycle (interrupts->cpu);
@@ -282,20 +299,10 @@ interrupts_info (SIM_DESC sd, struct interrupts *interrupts)
t -= interrupts->start_mask_cycle;
if (t > interrupts->max_mask_cycles)
interrupts->max_mask_cycles = t;
- }
- if (interrupts->xirq_start_mask_cycle >= 0)
- {
- t = cpu_current_cycle (interrupts->cpu);
- t -= interrupts->xirq_start_mask_cycle;
- if (t > interrupts->xirq_max_mask_cycles)
- interrupts->xirq_max_mask_cycles = t;
+ sim_io_printf (sd, " Current interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
}
-
- sim_io_printf (sd, "Interrupts Info:\n");
- sim_io_printf (sd, " Interrupts raised: %lu\n",
- interrupts->nb_interrupts_raised);
-
t = interrupts->min_mask_cycles == CYCLES_MAX ?
interrupts->max_mask_cycles :
interrupts->min_mask_cycles;
@@ -306,6 +313,22 @@ interrupts_info (SIM_DESC sd, struct interrupts *interrupts)
sim_io_printf (sd, " Longest interrupts masked sequence: %s\n",
cycle_to_string (interrupts->cpu, t));
+ t = interrupts->last_mask_cycles;
+ sim_io_printf (sd, " Last interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
+
+ if (interrupts->xirq_start_mask_cycle >= 0)
+ {
+ t = cpu_current_cycle (interrupts->cpu);
+
+ t -= interrupts->xirq_start_mask_cycle;
+ if (t > interrupts->xirq_max_mask_cycles)
+ interrupts->xirq_max_mask_cycles = t;
+
+ sim_io_printf (sd, " XIRQ Current interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
+ }
+
t = interrupts->xirq_min_mask_cycles == CYCLES_MAX ?
interrupts->xirq_max_mask_cycles :
interrupts->xirq_min_mask_cycles;
@@ -315,4 +338,8 @@ interrupts_info (SIM_DESC sd, struct interrupts *interrupts)
t = interrupts->xirq_max_mask_cycles;
sim_io_printf (sd, " XIRQ Max interrupts masked sequence: %s\n",
cycle_to_string (interrupts->cpu, t));
+
+ t = interrupts->xirq_last_mask_cycles;
+ sim_io_printf (sd, " XIRQ Last interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
}
OpenPOWER on IntegriCloud