Commit | Line | Data |
---|---|---|
15c16493 AC |
1 | /* This file is part of the program psim. |
2 | ||
3 | Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au> | |
4 | Copyright (C) 1997, Free Software Foundation | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | ||
20 | */ | |
21 | ||
22 | ||
23 | #ifndef _SIM_MAIN_H_ | |
24 | #define _SIM_MAIN_H_ | |
25 | ||
26 | #include "sim-basics.h" | |
d9b75947 AC |
27 | |
28 | #include <signal.h> | |
15c16493 AC |
29 | |
30 | /* These are generated files. */ | |
31 | #include "itable.h" | |
32 | #include "idecode.h" | |
33 | #include "idecode.h" | |
34 | ||
d9b75947 AC |
35 | typedef instruction_address sim_cia; |
36 | static const sim_cia null_cia = {0}; /* Dummy */ | |
37 | #define NULL_CIA null_cia | |
38 | ||
39 | #include "sim-base.h" | |
40 | ||
15c16493 | 41 | #include "alu.h" |
381f42ef | 42 | #include "cpu.h" |
15c16493 | 43 | |
15c16493 AC |
44 | |
45 | struct sim_state { | |
46 | ||
15c16493 AC |
47 | /* escape route for inner functions */ |
48 | int halt_ok; | |
49 | jmp_buf path_to_halt; | |
50 | int restart_ok; | |
51 | jmp_buf path_to_restart; | |
52 | ||
53 | /* status from last halt */ | |
54 | enum sim_stop reason; | |
55 | int siggnal; | |
56 | ||
57 | /* the processors proper */ | |
58 | sim_cpu cpu; | |
59 | #define STATE_CPU(sd, n) (&(sd)->cpu) | |
60 | ||
61 | /* The base class. */ | |
62 | sim_state_base base; | |
63 | ||
64 | }; | |
65 | ||
66 | /* (re) initialize the simulator */ | |
67 | ||
68 | extern void engine_init | |
69 | (SIM_DESC sd); | |
70 | ||
71 | ||
abe293a0 AC |
72 | /* Mechanisms for stopping/restarting the simulation. |
73 | ||
74 | A non NULL CPU argument designates the processor that is initiating | |
75 | the halt. After the simulation has stopped that processor should | |
76 | be marked as the last one active */ | |
15c16493 AC |
77 | |
78 | extern void engine_error | |
79 | (SIM_DESC sd, | |
abe293a0 | 80 | sim_cpu *cpu, |
15c16493 AC |
81 | instruction_address cia, |
82 | const char *fmt, | |
83 | ...); | |
84 | ||
85 | extern void engine_halt | |
86 | (SIM_DESC sd, | |
abe293a0 | 87 | sim_cpu *cpu, |
15c16493 AC |
88 | instruction_address cia, |
89 | enum sim_stop reason, | |
90 | int siggnal); | |
91 | ||
92 | extern void engine_restart | |
93 | (SIM_DESC sd, | |
abe293a0 | 94 | sim_cpu *cpu, |
15c16493 AC |
95 | instruction_address cia); |
96 | ||
15c16493 AC |
97 | /* SIMULATE INSTRUCTIONS, various different ways of achieving the same |
98 | thing (others later) */ | |
99 | ||
100 | extern void engine_run_until_stop | |
101 | (SIM_DESC sd, | |
102 | volatile int *keep_running); | |
103 | ||
104 | ||
105 | #endif |