From: Stephane Carrez Date: Sun, 20 May 2001 15:36:29 +0000 (+0000) Subject: * dv-m68hc11sio.c (m68hc11sio_tx_poll): Always check for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11115521f652c7a4c85fc326efc1ad6fae913e59;p=binutils-gdb.git * 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. --- diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog index bf0ce6491ad..265a6d3a722 100644 --- a/sim/m68hc11/ChangeLog +++ b/sim/m68hc11/ChangeLog @@ -1,3 +1,17 @@ +2001-05-20 Stephane Carrez + + * 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 * dv-m68hc11.c (m68hc11cpu_io_read_buffer): Use attach_size diff --git a/sim/m68hc11/dv-m68hc11sio.c b/sim/m68hc11/dv-m68hc11sio.c index 1f022c4bbe7..ec7a46de506 100644 --- a/sim/m68hc11/dv-m68hc11sio.c +++ b/sim/m68hc11/dv-m68hc11sio.c @@ -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 diff --git a/sim/m68hc11/interrupts.c b/sim/m68hc11/interrupts.c index 44771bb4e03..5c7f5e21bd7 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)); } diff --git a/sim/m68hc11/interrupts.h b/sim/m68hc11/interrupts.h index 39069cd3426..69afa540677 100644 --- a/sim/m68hc11/interrupts.h +++ b/sim/m68hc11/interrupts.h @@ -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;