aboutsummaryrefslogtreecommitdiff
path: root/sim/m68hc11/interrupts.h
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2002-03-07 18:59:38 +0000
committerStephane Carrez <stcarrez@nerim.fr>2002-03-07 18:59:38 +0000
commit261289656f5d50f63fb39e917569b6a00ecf438d (patch)
tree03525efe846b41b4f455ba52457744ea3031a61d /sim/m68hc11/interrupts.h
parentaa066ac86af343df3f305d72379378917390d391 (diff)
downloadgdb-261289656f5d50f63fb39e917569b6a00ecf438d.zip
gdb-261289656f5d50f63fb39e917569b6a00ecf438d.tar.gz
gdb-261289656f5d50f63fb39e917569b6a00ecf438d.tar.bz2
* interrupts.c (interrupts_reset): New function, setup interrupt
vector address according to cpu mode. (interrupts_initialize): Move reset portion to the above. (interrupt_names): New table to give a name to interrupts. (idefs): Handle pulse accumulator interrupts. (interrupts_info): Print the interrupt history. (interrupt_option_handler): New function. (interrupt_options): New table of options. (interrupts_update_pending): Keep track of when interrupts are raised and implement breakpoint-on-raise-interrupt. (interrupts_process): Keep track of when interrupts are taken and implement breakpoint-on-interrupt. * interrupts.h (struct interrupt_history): Define. (struct interrupt): Keep track of the interrupt history. (interrupts_reset): Declare. (interrupts_initialize): Update prototype. * m68hc11_sim.c (cpu_reset): Reset interrupts. (cpu_initialize): Cleanup.
Diffstat (limited to 'sim/m68hc11/interrupts.h')
-rw-r--r--sim/m68hc11/interrupts.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/sim/m68hc11/interrupts.h b/sim/m68hc11/interrupts.h
index 69afa54..d29e577 100644
--- a/sim/m68hc11/interrupts.h
+++ b/sim/m68hc11/interrupts.h
@@ -1,5 +1,5 @@
/* interrupts.h -- 68HC11 Interrupts Emulation
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@worldnet.fr)
This file is part of GDB, GAS, and the GNU binutils.
@@ -79,6 +79,39 @@ struct interrupt_def
unsigned char enabled_mask;
};
+#define MAX_INT_HISTORY 64
+
+/* Structure used to keep track of interrupt history.
+ This is used to understand in which order interrupts were
+ raised and when. */
+struct interrupt_history
+{
+ enum M6811_INT type;
+
+ /* CPU cycle when interrupt handler is called. */
+ signed64 taken_cycle;
+
+ /* CPU cycle when the interrupt is first raised by the device. */
+ signed64 raised_cycle;
+};
+
+#define SIM_STOP_WHEN_RAISED 1
+#define SIM_STOP_WHEN_TAKEN 2
+
+/* Information and control of pending interrupts. */
+struct interrupt
+{
+ /* CPU cycle when the interrupt is raised by the device. */
+ signed64 cpu_cycle;
+
+ /* Number of times the interrupt was raised. */
+ unsigned long raised_count;
+
+ /* Controls whether we must stop the simulator. */
+ int stop_mode;
+};
+
+
/* Management of 68HC11 interrupts:
- We use a table of 'interrupt_def' to describe the interrupts that must be
raised depending on IO register flags (enable and present flags).
@@ -102,6 +135,7 @@ struct interrupts {
/* Priority order of interrupts. This is controlled by setting the HPRIO
IO register. */
enum M6811_INT interrupt_order[M6811_INT_NUMBER];
+ struct interrupt interrupts[M6811_INT_NUMBER];
/* Simulator statistics to report useful debug information to users. */
@@ -119,9 +153,15 @@ struct interrupts {
/* - Total number of interrupts raised. */
unsigned long nb_interrupts_raised;
+
+ /* Interrupt history to help understand which interrupts
+ were raised recently and in which order. */
+ int history_index;
+ struct interrupt_history interrupts_history[MAX_INT_HISTORY];
};
-extern int interrupts_initialize (struct _sim_cpu* cpu);
+extern void interrupts_initialize (SIM_DESC sd, struct _sim_cpu* cpu);
+extern void interrupts_reset (struct interrupts* interrupts);
extern void interrupts_update_pending (struct interrupts* interrupts);
extern int interrupts_get_current (struct interrupts* interrupts);
extern int interrupts_process (struct interrupts* interrupts);