Commit | Line | Data |
---|---|---|
0543ebbb JJ |
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 | ||
1e23866b AC |
23 | #ifndef SIM_MAIN_H |
24 | #define SIM_MAIN_H | |
0543ebbb JJ |
25 | |
26 | #define WITH_CORE | |
27 | #define WITH_WATCHPOINTS 1 | |
28 | ||
1e23866b AC |
29 | /* FIXME: Need to set up things so that the generated file semantics.c |
30 | includes the contents of the file op_utils.c */ | |
31 | #define SIM_MAIN_INLINE 0 | |
32 | ||
33 | ||
0543ebbb JJ |
34 | #include "sim-basics.h" |
35 | #include "sim-signal.h" | |
36 | ||
37 | #include <signal.h> /* For kill() in insns:do_trap */ | |
38 | ||
39 | #include <errno.h> | |
40 | #ifdef HAVE_UNISTD_H | |
41 | #include <unistd.h> | |
42 | #endif | |
43 | ||
44 | /* These are generated files. */ | |
45 | #include "itable.h" | |
46 | #include "idecode.h" | |
47 | #include "idecode.h" | |
48 | ||
49 | typedef instruction_address sim_cia; | |
50 | static const sim_cia null_cia = {0}; /* Dummy */ | |
51 | #define NULL_CIA null_cia | |
52 | /* FIXME: Perhaps igen should generate access macros for | |
53 | `instruction_address' that we could use. */ | |
54 | /*#define CIA_ADDR(cia) ((cia).ip) this is from tic80, doesn't work for mn10300*/ | |
55 | ||
56 | #define WITH_WATCHPOINTS 1 | |
57 | ||
58 | #include "sim-base.h" | |
59 | ||
60 | #include "mn10300_sim.h" | |
61 | ||
62 | /* Bring data in from the cold */ | |
63 | ||
64 | #define IMEM8(EA) \ | |
65 | (sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA))) | |
66 | ||
67 | #define IMEM8_IMMED(EA, N) \ | |
68 | (sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA) + (N))) | |
69 | ||
70 | ||
1e23866b AC |
71 | /* FIXME: For moment, save/restore PC value found in struct State. |
72 | Struct State will one day go away, being placed in the sim_cpu | |
73 | state. */ | |
74 | #define CIA_GET(CPU) ((PC) + 0) | |
75 | #define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL), PC = (VAL)) | |
0543ebbb JJ |
76 | |
77 | ||
78 | struct _sim_cpu { | |
79 | sim_event *pending_nmi; | |
80 | sim_cia cia; | |
81 | sim_cpu_base base; | |
82 | }; | |
83 | ||
84 | ||
85 | struct sim_state { | |
86 | ||
87 | /* the processors proper */ | |
88 | sim_cpu cpu; | |
89 | #define STATE_CPU(sd, n) (&(sd)->cpu) | |
90 | ||
91 | /* The base class. */ | |
92 | sim_state_base base; | |
93 | ||
94 | }; | |
95 | ||
96 | /* For compatibility, until all functions converted to passing | |
97 | SIM_DESC as an argument */ | |
98 | extern SIM_DESC simulator; | |
99 | ||
100 | /* (re) initialize the simulator */ | |
101 | ||
102 | extern void engine_init(SIM_DESC sd); | |
103 | ||
104 | #endif |