]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/mn10300/sim-main.h
sim: invert sim_state storage
[thirdparty/binutils-gdb.git] / sim / mn10300 / sim-main.h
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-2021 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #ifndef SIM_MAIN_H
23 #define SIM_MAIN_H
24
25 #define SIM_HAVE_COMMON_SIM_STATE
26
27 #define SIM_ENGINE_HALT_HOOK(SD,LAST_CPU,CIA) 0 /* disable this hook */
28
29 #include "sim-basics.h"
30 #include "sim-signal.h"
31
32 #include <signal.h> /* For kill() in insns:do_trap */
33
34 #include <errno.h>
35 #ifdef HAVE_UNISTD_H
36 #include <unistd.h>
37 #endif
38
39 /* These are generated files. */
40 #include "itable.h"
41 #include "idecode.h"
42
43 #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
44 mn10300_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER), (ERROR))
45
46
47 #include "sim-base.h"
48
49 #include "mn10300_sim.h"
50
51 /* Bring data in from the cold */
52
53 #define IMEM8(EA) \
54 (sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA)))
55
56 #define IMEM8_IMMED(EA, N) \
57 (sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA) + (N)))
58
59
60 /* FIXME: For moment, save/restore PC value found in struct State.
61 Struct State will one day go away, being placed in the sim_cpu
62 state. */
63
64 struct _sim_cpu {
65 sim_event *pending_nmi;
66 sim_cia cia;
67 sim_cpu_base base;
68 };
69
70 /* For compatibility, until all functions converted to passing
71 SIM_DESC as an argument */
72 extern SIM_DESC simulator;
73
74 /* (re) initialize the simulator */
75
76 extern void engine_init(SIM_DESC sd);
77 extern SIM_CORE_SIGNAL_FN mn10300_core_signal;
78
79 #endif