* 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.
This commit is contained in:
parent
b4fa4770b8
commit
11115521f6
4 changed files with 64 additions and 24 deletions
|
@ -1,3 +1,17 @@
|
|||
2001-05-20 Stephane Carrez <Stephane.Carrez@worldnet.fr>
|
||||
|
||||
* 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.
|
||||
|
||||
2000-11-26 Stephane Carrez <Stephane.Carrez@worldnet.fr>
|
||||
|
||||
* dv-m68hc11.c (m68hc11cpu_io_read_buffer): Use attach_size
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* dv-m68hc11sio.c -- Simulation of the 68HC11 serial device.
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Stephane Carrez (stcarrez@worldnet.fr)
|
||||
(From a driver model Contributed by Cygnus Solutions.)
|
||||
|
||||
|
@ -320,7 +320,6 @@ m68hc11sio_tx_poll (struct hw *me, void *data)
|
|||
SIM_DESC sd;
|
||||
struct m68hc11sio *controller;
|
||||
sim_cpu *cpu;
|
||||
int check_interrupt = 0;
|
||||
|
||||
controller = hw_data (me);
|
||||
sd = hw_system (me);
|
||||
|
@ -329,13 +328,12 @@ m68hc11sio_tx_poll (struct hw *me, void *data)
|
|||
cpu->ios[M6811_SCSR] |= M6811_TDRE;
|
||||
cpu->ios[M6811_SCSR] |= M6811_TC;
|
||||
|
||||
/* Transmitter is enabled and we have something to sent. */
|
||||
/* Transmitter is enabled and we have something to send. */
|
||||
if ((cpu->ios[M6811_SCCR2] & M6811_TE) && controller->tx_has_char)
|
||||
{
|
||||
cpu->ios[M6811_SCSR] &= ~M6811_TDRE;
|
||||
cpu->ios[M6811_SCSR] &= ~M6811_TC;
|
||||
controller->tx_has_char = 0;
|
||||
check_interrupt = 1;
|
||||
switch (controller->backend)
|
||||
{
|
||||
case sio_tcp:
|
||||
|
@ -371,8 +369,7 @@ m68hc11sio_tx_poll (struct hw *me, void *data)
|
|||
NULL);
|
||||
}
|
||||
|
||||
if (check_interrupt)
|
||||
interrupts_update_pending (&cpu->cpu_interrupts);
|
||||
interrupts_update_pending (&cpu->cpu_interrupts);
|
||||
}
|
||||
|
||||
/* Descriptions of the SIO I/O ports. These descriptions are only used to
|
||||
|
|
|
@ -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;
|
||||
|
||||
sim_io_printf (sd, " Current 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, "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));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* interrupts.h -- 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.
|
||||
|
@ -109,11 +109,13 @@ struct interrupts {
|
|||
signed64 start_mask_cycle;
|
||||
signed64 min_mask_cycles;
|
||||
signed64 max_mask_cycles;
|
||||
signed64 last_mask_cycles;
|
||||
|
||||
/* - Same for XIRQ. */
|
||||
signed64 xirq_start_mask_cycle;
|
||||
signed64 xirq_min_mask_cycles;
|
||||
signed64 xirq_max_mask_cycles;
|
||||
signed64 xirq_last_mask_cycles;
|
||||
|
||||
/* - Total number of interrupts raised. */
|
||||
unsigned long nb_interrupts_raised;
|
||||
|
|
Loading…
Reference in a new issue