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 | ||
23 | #ifndef _SIM_MAIN_H_ | |
24 | #define _SIM_MAIN_H_ | |
25 | ||
26 | #define WITH_CORE | |
27 | #define WITH_WATCHPOINTS 1 | |
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 | #include "idecode.h" | |
43 | ||
44 | typedef instruction_address sim_cia; | |
45 | static const sim_cia null_cia = {0}; /* Dummy */ | |
46 | #define NULL_CIA null_cia | |
47 | /* FIXME: Perhaps igen should generate access macros for | |
48 | `instruction_address' that we could use. */ | |
49 | /*#define CIA_ADDR(cia) ((cia).ip) this is from tic80, doesn't work for mn10300*/ | |
50 | ||
51 | #define WITH_WATCHPOINTS 1 | |
52 | ||
53 | #include "sim-base.h" | |
54 | ||
55 | #include "mn10300_sim.h" | |
56 | ||
57 | /* Bring data in from the cold */ | |
58 | ||
59 | #define IMEM8(EA) \ | |
60 | (sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA))) | |
61 | ||
62 | #define IMEM8_IMMED(EA, N) \ | |
63 | (sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA) + (N))) | |
64 | ||
65 | ||
66 | #define CIA_GET(CPU) ((CPU)->cia) | |
67 | #define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL)) | |
68 | ||
69 | ||
70 | struct _sim_cpu { | |
71 | sim_event *pending_nmi; | |
72 | sim_cia cia; | |
73 | sim_cpu_base base; | |
74 | }; | |
75 | ||
76 | ||
77 | struct sim_state { | |
78 | ||
79 | /* the processors proper */ | |
80 | sim_cpu cpu; | |
81 | #define STATE_CPU(sd, n) (&(sd)->cpu) | |
82 | ||
83 | /* The base class. */ | |
84 | sim_state_base base; | |
85 | ||
86 | }; | |
87 | ||
88 | /* For compatibility, until all functions converted to passing | |
89 | SIM_DESC as an argument */ | |
90 | extern SIM_DESC simulator; | |
91 | ||
92 | /* (re) initialize the simulator */ | |
93 | ||
94 | extern void engine_init(SIM_DESC sd); | |
95 | ||
96 | #endif |