1 |
dpavlin |
4 |
#ifndef MACHINE_H |
2 |
|
|
#define MACHINE_H |
3 |
|
|
|
4 |
|
|
/* |
5 |
dpavlin |
34 |
* Copyright (C) 2005-2007 Anders Gavare. All rights reserved. |
6 |
dpavlin |
4 |
* |
7 |
|
|
* Redistribution and use in source and binary forms, with or without |
8 |
|
|
* modification, are permitted provided that the following conditions are met: |
9 |
|
|
* |
10 |
|
|
* 1. Redistributions of source code must retain the above copyright |
11 |
|
|
* notice, this list of conditions and the following disclaimer. |
12 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
|
|
* notice, this list of conditions and the following disclaimer in the |
14 |
|
|
* documentation and/or other materials provided with the distribution. |
15 |
|
|
* 3. The name of the author may not be used to endorse or promote products |
16 |
|
|
* derived from this software without specific prior written permission. |
17 |
|
|
* |
18 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
19 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 |
|
|
* SUCH DAMAGE. |
29 |
|
|
* |
30 |
|
|
* |
31 |
dpavlin |
36 |
* $Id: machine.h,v 1.157 2007/03/15 15:42:58 debug Exp $ |
32 |
dpavlin |
4 |
*/ |
33 |
|
|
|
34 |
|
|
#include <sys/types.h> |
35 |
|
|
#include <sys/time.h> |
36 |
|
|
|
37 |
dpavlin |
24 |
#include "debugger_gdb.h" |
38 |
dpavlin |
4 |
#include "symbol.h" |
39 |
|
|
|
40 |
dpavlin |
14 |
#include "machine_arc.h" |
41 |
dpavlin |
24 |
#include "machine_pmax.h" |
42 |
dpavlin |
4 |
|
43 |
dpavlin |
14 |
|
44 |
dpavlin |
4 |
#define MAX_BREAKPOINTS 8 |
45 |
|
|
|
46 |
dpavlin |
24 |
#define MAX_TICK_FUNCTIONS 16 |
47 |
dpavlin |
4 |
|
48 |
dpavlin |
28 |
#define MAX_STATISTICS_FIELDS 8 |
49 |
|
|
|
50 |
dpavlin |
4 |
struct cpu_family; |
51 |
|
|
struct diskimage; |
52 |
|
|
struct emul; |
53 |
|
|
struct fb_window; |
54 |
|
|
struct memory; |
55 |
dpavlin |
22 |
struct of_data; |
56 |
dpavlin |
32 |
struct settings; |
57 |
dpavlin |
4 |
|
58 |
dpavlin |
32 |
|
59 |
dpavlin |
34 |
/* TODO: This should probably go away... */ |
60 |
dpavlin |
12 |
struct isa_pic_data { |
61 |
dpavlin |
20 |
struct pic8259_data *pic1; |
62 |
|
|
struct pic8259_data *pic2; |
63 |
dpavlin |
30 |
|
64 |
dpavlin |
32 |
int *pending_timer_interrupts; |
65 |
dpavlin |
20 |
int last_int; |
66 |
dpavlin |
12 |
}; |
67 |
dpavlin |
4 |
|
68 |
dpavlin |
12 |
|
69 |
dpavlin |
4 |
struct machine { |
70 |
|
|
/* Pointer back to the emul struct we are in: */ |
71 |
|
|
struct emul *emul; |
72 |
|
|
|
73 |
dpavlin |
32 |
/* Settings: */ |
74 |
|
|
struct settings *settings; |
75 |
|
|
|
76 |
dpavlin |
4 |
/* Name as choosen by the user: */ |
77 |
|
|
char *name; |
78 |
|
|
|
79 |
dpavlin |
34 |
/* Full "path" to the machine, e.g. "emul[0].machine[0]": */ |
80 |
|
|
char *path; |
81 |
|
|
|
82 |
dpavlin |
4 |
int arch; /* ARCH_MIPS, ARCH_PPC, .. */ |
83 |
dpavlin |
22 |
int machine_type; /* MACHINE_PMAX, .. */ |
84 |
dpavlin |
4 |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
85 |
|
|
|
86 |
dpavlin |
34 |
/* NOTE/TODO: This isn't working yet: */ |
87 |
dpavlin |
24 |
int cycle_accurate; /* Set to non-zero for cycle |
88 |
|
|
accurate (slow) emulation. */ |
89 |
|
|
|
90 |
dpavlin |
22 |
/* Name set by code in src/machines/machine_*.c: */ |
91 |
dpavlin |
4 |
char *machine_name; |
92 |
|
|
|
93 |
dpavlin |
22 |
int stable; /* startup warning for non-stable |
94 |
|
|
emulation modes. */ |
95 |
|
|
|
96 |
dpavlin |
4 |
/* The serial number is mostly used when emulating multiple machines |
97 |
|
|
in a network. nr_of_nics is the current nr of network cards, which |
98 |
|
|
is useful when emulating multiple cards in one machine: */ |
99 |
|
|
int serial_nr; |
100 |
|
|
int nr_of_nics; |
101 |
|
|
|
102 |
dpavlin |
28 |
/* TODO: How about multiple cpu familys in one machine? */ |
103 |
dpavlin |
4 |
struct cpu_family *cpu_family; |
104 |
|
|
|
105 |
|
|
/* |
106 |
|
|
* The "mainbus": |
107 |
|
|
* |
108 |
|
|
* o) memory |
109 |
|
|
* o) devices |
110 |
|
|
* o) CPUs |
111 |
|
|
*/ |
112 |
|
|
|
113 |
|
|
struct memory *memory; |
114 |
|
|
|
115 |
|
|
int main_console_handle; |
116 |
|
|
|
117 |
|
|
/* Hardware devices, run every x clock cycles. */ |
118 |
|
|
int n_tick_entries; |
119 |
|
|
int ticks_till_next[MAX_TICK_FUNCTIONS]; |
120 |
|
|
int ticks_reset_value[MAX_TICK_FUNCTIONS]; |
121 |
|
|
void (*tick_func[MAX_TICK_FUNCTIONS])(struct cpu *, void *); |
122 |
|
|
void *tick_extra[MAX_TICK_FUNCTIONS]; |
123 |
dpavlin |
24 |
double tick_hz[MAX_TICK_FUNCTIONS]; |
124 |
dpavlin |
4 |
|
125 |
|
|
char *cpu_name; /* TODO: remove this, there could be several |
126 |
|
|
cpus with different names in a machine */ |
127 |
|
|
int byte_order_override; |
128 |
|
|
int bootstrap_cpu; |
129 |
|
|
int use_random_bootstrap_cpu; |
130 |
|
|
int start_paused; |
131 |
|
|
int ncpus; |
132 |
|
|
struct cpu **cpus; |
133 |
|
|
|
134 |
|
|
/* These are used by stuff in cpu.c, mostly: */ |
135 |
dpavlin |
34 |
/* TODO: Move to cpu.h! */ |
136 |
dpavlin |
28 |
int64_t ninstrs; |
137 |
|
|
int64_t ninstrs_show; |
138 |
|
|
int64_t ninstrs_flush; |
139 |
|
|
int64_t ninstrs_since_gettimeofday; |
140 |
dpavlin |
10 |
struct timeval starttime; |
141 |
dpavlin |
4 |
|
142 |
|
|
struct diskimage *first_diskimage; |
143 |
|
|
|
144 |
|
|
struct symbol_context symbol_context; |
145 |
|
|
|
146 |
|
|
int random_mem_contents; |
147 |
|
|
int physical_ram_in_mb; |
148 |
|
|
int memory_offset_in_mb; |
149 |
|
|
int prom_emulation; |
150 |
|
|
int register_dump; |
151 |
dpavlin |
12 |
int arch_pagesize; |
152 |
dpavlin |
4 |
|
153 |
dpavlin |
22 |
int bootdev_type; |
154 |
|
|
int bootdev_id; |
155 |
|
|
char *bootstr; |
156 |
|
|
char *bootarg; |
157 |
|
|
|
158 |
dpavlin |
24 |
struct debugger_gdb gdb; |
159 |
|
|
|
160 |
dpavlin |
28 |
/* Breakpoints: */ |
161 |
dpavlin |
4 |
int n_breakpoints; |
162 |
|
|
char *breakpoint_string[MAX_BREAKPOINTS]; |
163 |
|
|
uint64_t breakpoint_addr[MAX_BREAKPOINTS]; |
164 |
|
|
int breakpoint_flags[MAX_BREAKPOINTS]; |
165 |
|
|
|
166 |
|
|
/* Cache sizes: (1 << x) x=0 for default values */ |
167 |
dpavlin |
34 |
/* TODO: these should be _PER CPU_! */ |
168 |
dpavlin |
4 |
int cache_picache; |
169 |
|
|
int cache_pdcache; |
170 |
|
|
int cache_secondary; |
171 |
|
|
int cache_picache_linesize; |
172 |
|
|
int cache_pdcache_linesize; |
173 |
|
|
int cache_secondary_linesize; |
174 |
|
|
|
175 |
|
|
int dbe_on_nonexistant_memaccess; |
176 |
dpavlin |
34 |
int halt_on_nonexistant_memaccess; |
177 |
dpavlin |
4 |
int instruction_trace; |
178 |
|
|
int show_nr_of_instructions; |
179 |
dpavlin |
28 |
int show_trace_tree; |
180 |
dpavlin |
4 |
int show_symbolic_register_names; |
181 |
|
|
int emulated_hz; |
182 |
dpavlin |
28 |
int allow_instruction_combinations; |
183 |
dpavlin |
4 |
char *userland_emul; /* NULL for no userland emulation */ |
184 |
|
|
int force_netboot; |
185 |
|
|
int slow_serial_interrupts_hack_for_linux; |
186 |
|
|
uint64_t file_loaded_end_addr; |
187 |
|
|
char *boot_kernel_filename; |
188 |
|
|
char *boot_string_argument; |
189 |
|
|
int exit_without_entering_debugger; |
190 |
|
|
int n_gfx_cards; |
191 |
|
|
|
192 |
dpavlin |
28 |
/* Instruction statistics: */ |
193 |
|
|
char *statistics_filename; |
194 |
|
|
FILE *statistics_file; |
195 |
|
|
int statistics_enabled; |
196 |
|
|
char *statistics_fields; /* "vpi" etc. */ |
197 |
|
|
|
198 |
dpavlin |
6 |
/* Machine-dependent: (PROM stuff, etc.) */ |
199 |
|
|
union { |
200 |
|
|
struct machine_arcbios arc; |
201 |
dpavlin |
24 |
struct machine_pmax pmax; |
202 |
dpavlin |
34 |
struct of_data *of_data; |
203 |
dpavlin |
6 |
} md; |
204 |
dpavlin |
4 |
|
205 |
dpavlin |
14 |
/* Bus-specific interrupt data: */ |
206 |
dpavlin |
34 |
/* TODO: Remove! */ |
207 |
dpavlin |
14 |
struct isa_pic_data isa_pic_data; |
208 |
|
|
|
209 |
dpavlin |
4 |
/* X11/framebuffer stuff: */ |
210 |
|
|
int use_x11; |
211 |
|
|
int x11_scaledown; |
212 |
dpavlin |
20 |
int x11_scaleup; |
213 |
dpavlin |
4 |
int x11_n_display_names; |
214 |
|
|
char **x11_display_names; |
215 |
|
|
int x11_current_display_name_nr; /* updated by x11.c */ |
216 |
|
|
|
217 |
|
|
int n_fb_windows; |
218 |
|
|
struct fb_window **fb_windows; |
219 |
|
|
}; |
220 |
|
|
|
221 |
|
|
|
222 |
dpavlin |
28 |
/* Tick function "prototype": */ |
223 |
|
|
#define DEVICE_TICK(x) void dev_ ## x ## _tick(struct cpu *cpu, void *extra) |
224 |
|
|
|
225 |
|
|
|
226 |
dpavlin |
4 |
/* |
227 |
|
|
* Machine emulation types: |
228 |
|
|
*/ |
229 |
|
|
|
230 |
|
|
#define ARCH_NOARCH 0 |
231 |
|
|
#define ARCH_MIPS 1 |
232 |
|
|
#define ARCH_PPC 2 |
233 |
|
|
#define ARCH_SPARC 3 |
234 |
dpavlin |
12 |
#define ARCH_ALPHA 4 |
235 |
dpavlin |
34 |
#define ARCH_ARM 5 |
236 |
|
|
#define ARCH_M68K 6 |
237 |
|
|
#define ARCH_SH 7 |
238 |
|
|
#define ARCH_AVR 8 |
239 |
|
|
#define ARCH_TRANSPUTER 9 |
240 |
|
|
#define ARCH_RCA180X 10 |
241 |
dpavlin |
4 |
|
242 |
|
|
/* MIPS: */ |
243 |
|
|
#define MACHINE_BAREMIPS 1000 |
244 |
|
|
#define MACHINE_TESTMIPS 1001 |
245 |
dpavlin |
22 |
#define MACHINE_PMAX 1002 |
246 |
dpavlin |
4 |
#define MACHINE_COBALT 1003 |
247 |
|
|
#define MACHINE_HPCMIPS 1004 |
248 |
|
|
#define MACHINE_PS2 1005 |
249 |
|
|
#define MACHINE_SGI 1006 |
250 |
|
|
#define MACHINE_ARC 1007 |
251 |
dpavlin |
24 |
#define MACHINE_NETGEAR 1008 |
252 |
|
|
#define MACHINE_SONYNEWS 1009 |
253 |
|
|
#define MACHINE_EVBMIPS 1010 |
254 |
|
|
#define MACHINE_PSP 1011 |
255 |
|
|
#define MACHINE_ALGOR 1012 |
256 |
dpavlin |
28 |
#define MACHINE_QEMU_MIPS 1013 |
257 |
dpavlin |
4 |
|
258 |
|
|
/* PPC: */ |
259 |
|
|
#define MACHINE_BAREPPC 2000 |
260 |
|
|
#define MACHINE_TESTPPC 2001 |
261 |
|
|
#define MACHINE_WALNUT 2002 |
262 |
|
|
#define MACHINE_PMPPC 2003 |
263 |
|
|
#define MACHINE_SANDPOINT 2004 |
264 |
|
|
#define MACHINE_BEBOX 2005 |
265 |
|
|
#define MACHINE_PREP 2006 |
266 |
|
|
#define MACHINE_MACPPC 2007 |
267 |
dpavlin |
34 |
#define MACHINE_MVMEPPC 2008 |
268 |
dpavlin |
4 |
|
269 |
|
|
/* SPARC: */ |
270 |
|
|
#define MACHINE_BARESPARC 3000 |
271 |
dpavlin |
12 |
#define MACHINE_TESTSPARC 3001 |
272 |
dpavlin |
24 |
#define MACHINE_SPARC 3002 |
273 |
dpavlin |
4 |
|
274 |
|
|
/* Alpha: */ |
275 |
dpavlin |
12 |
#define MACHINE_BAREALPHA 4000 |
276 |
|
|
#define MACHINE_TESTALPHA 4001 |
277 |
|
|
#define MACHINE_ALPHA 4002 |
278 |
dpavlin |
4 |
|
279 |
dpavlin |
6 |
/* ARM: */ |
280 |
dpavlin |
34 |
#define MACHINE_BAREARM 5000 |
281 |
|
|
#define MACHINE_TESTARM 5001 |
282 |
|
|
#define MACHINE_CATS 5002 |
283 |
|
|
#define MACHINE_HPCARM 5003 |
284 |
|
|
#define MACHINE_ZAURUS 5004 |
285 |
|
|
#define MACHINE_NETWINDER 5005 |
286 |
|
|
#define MACHINE_SHARK 5006 |
287 |
|
|
#define MACHINE_IQ80321 5007 |
288 |
|
|
#define MACHINE_IYONIX 5008 |
289 |
|
|
#define MACHINE_TS7200 5009 |
290 |
|
|
#define MACHINE_QEMU_ARM 5010 |
291 |
dpavlin |
6 |
|
292 |
dpavlin |
12 |
/* M68K: */ |
293 |
dpavlin |
34 |
#define MACHINE_BAREM68K 6000 |
294 |
|
|
#define MACHINE_TESTM68K 6001 |
295 |
dpavlin |
12 |
|
296 |
dpavlin |
14 |
/* SH: */ |
297 |
dpavlin |
34 |
#define MACHINE_BARESH 7000 |
298 |
|
|
#define MACHINE_TESTSH 7001 |
299 |
|
|
#define MACHINE_HPCSH 7002 |
300 |
|
|
#define MACHINE_DREAMCAST 7003 |
301 |
|
|
#define MACHINE_LANDISK 7004 |
302 |
dpavlin |
14 |
|
303 |
|
|
/* AVR: */ |
304 |
dpavlin |
34 |
#define MACHINE_BAREAVR 8000 |
305 |
|
|
#define MACHINE_AVR_PAL 8001 |
306 |
|
|
#define MACHINE_AVR_MAHPONG 8002 |
307 |
dpavlin |
14 |
|
308 |
dpavlin |
28 |
/* TRANSPUTER: */ |
309 |
dpavlin |
34 |
#define MACHINE_BARETRANSPUTER 9000 |
310 |
dpavlin |
28 |
|
311 |
dpavlin |
32 |
/* ARCH_RCA180X: */ |
312 |
dpavlin |
34 |
#define MACHINE_BARE180X 10000 |
313 |
|
|
#define MACHINE_CHIP8 10001 |
314 |
dpavlin |
32 |
|
315 |
dpavlin |
4 |
/* Other "pseudo"-machines: */ |
316 |
|
|
#define MACHINE_NONE 0 |
317 |
|
|
#define MACHINE_USERLAND 100000 |
318 |
|
|
|
319 |
|
|
/* DEC: */ |
320 |
|
|
#define MACHINE_DEC_PMAX_3100 1 |
321 |
|
|
#define MACHINE_DEC_3MAX_5000 2 |
322 |
|
|
#define MACHINE_DEC_3MIN_5000 3 |
323 |
|
|
#define MACHINE_DEC_3MAXPLUS_5000 4 |
324 |
|
|
#define MACHINE_DEC_5800 5 |
325 |
|
|
#define MACHINE_DEC_5400 6 |
326 |
|
|
#define MACHINE_DEC_MAXINE_5000 7 |
327 |
|
|
#define MACHINE_DEC_5500 11 |
328 |
|
|
#define MACHINE_DEC_MIPSMATE_5100 12 |
329 |
|
|
|
330 |
|
|
#define DEC_PROM_CALLBACK_STRUCT 0xffffffffbfc04000ULL |
331 |
|
|
#define DEC_PROM_EMULATION 0xffffffffbfc08000ULL |
332 |
|
|
#define DEC_PROM_INITIAL_ARGV (INITIAL_STACK_POINTER + 0x80) |
333 |
|
|
#define DEC_PROM_STRINGS 0xffffffffbfc20000ULL |
334 |
|
|
#define DEC_PROM_TCINFO 0xffffffffbfc2c000ULL |
335 |
|
|
#define DEC_MEMMAP_ADDR 0xffffffffbfc30000ULL |
336 |
|
|
|
337 |
|
|
/* HPCmips: */ |
338 |
|
|
#define MACHINE_HPCMIPS_CASIO_BE300 1 |
339 |
|
|
#define MACHINE_HPCMIPS_CASIO_E105 2 |
340 |
|
|
#define MACHINE_HPCMIPS_NEC_MOBILEPRO_770 3 |
341 |
|
|
#define MACHINE_HPCMIPS_NEC_MOBILEPRO_780 4 |
342 |
|
|
#define MACHINE_HPCMIPS_NEC_MOBILEPRO_800 5 |
343 |
|
|
#define MACHINE_HPCMIPS_NEC_MOBILEPRO_880 6 |
344 |
|
|
#define MACHINE_HPCMIPS_AGENDA_VR3 7 |
345 |
|
|
#define MACHINE_HPCMIPS_IBM_WORKPAD_Z50 8 |
346 |
|
|
|
347 |
dpavlin |
14 |
/* HPCarm: */ |
348 |
|
|
#define MACHINE_HPCARM_IPAQ 1 |
349 |
|
|
#define MACHINE_HPCARM_JORNADA720 2 |
350 |
|
|
|
351 |
|
|
/* HPCsh: */ |
352 |
|
|
#define MACHINE_HPCSH_JORNADA680 1 |
353 |
|
|
#define MACHINE_HPCSH_JORNADA690 2 |
354 |
|
|
|
355 |
dpavlin |
4 |
/* SGI and ARC: */ |
356 |
|
|
#define MACHINE_ARC_NEC_RD94 1 |
357 |
|
|
#define MACHINE_ARC_JAZZ_PICA 2 |
358 |
|
|
#define MACHINE_ARC_NEC_R94 3 |
359 |
|
|
#define MACHINE_ARC_DESKTECH_TYNE 4 |
360 |
|
|
#define MACHINE_ARC_JAZZ_MAGNUM 5 |
361 |
|
|
#define MACHINE_ARC_NEC_R98 6 |
362 |
|
|
#define MACHINE_ARC_JAZZ_M700 7 |
363 |
|
|
#define MACHINE_ARC_NEC_R96 8 |
364 |
|
|
|
365 |
dpavlin |
20 |
/* Algor: */ |
366 |
|
|
#define MACHINE_ALGOR_P4032 4 |
367 |
|
|
#define MACHINE_ALGOR_P5064 5 |
368 |
|
|
|
369 |
dpavlin |
8 |
/* EVBMIPS: */ |
370 |
|
|
#define MACHINE_EVBMIPS_MALTA 1 |
371 |
dpavlin |
12 |
#define MACHINE_EVBMIPS_MALTA_BE 2 |
372 |
dpavlin |
24 |
#define MACHINE_EVBMIPS_MESHCUBE 3 |
373 |
|
|
#define MACHINE_EVBMIPS_PB1000 4 |
374 |
dpavlin |
8 |
|
375 |
dpavlin |
22 |
/* PReP: */ |
376 |
|
|
#define MACHINE_PREP_IBM6050 1 |
377 |
|
|
#define MACHINE_PREP_MVME2400 2 |
378 |
|
|
|
379 |
dpavlin |
24 |
/* Sun SPARC: */ |
380 |
|
|
#define MACHINE_SPARC_SS5 1 |
381 |
|
|
#define MACHINE_SPARC_SS20 2 |
382 |
|
|
#define MACHINE_SPARC_ULTRA1 3 |
383 |
|
|
#define MACHINE_SPARC_ULTRA60 4 |
384 |
dpavlin |
36 |
#define MACHINE_SPARC_SUN4V 5 |
385 |
dpavlin |
24 |
|
386 |
dpavlin |
4 |
/* MacPPC: TODO: Real model names */ |
387 |
dpavlin |
24 |
#define MACHINE_MACPPC_G3 1 |
388 |
|
|
#define MACHINE_MACPPC_G4 2 |
389 |
|
|
#define MACHINE_MACPPC_G5 3 |
390 |
dpavlin |
4 |
|
391 |
dpavlin |
22 |
/* MVMEPPC */ |
392 |
|
|
#define MACHINE_MVMEPPC_1600 1 |
393 |
|
|
#define MACHINE_MVMEPPC_2100 2 |
394 |
|
|
#define MACHINE_MVMEPPC_5500 3 |
395 |
|
|
|
396 |
dpavlin |
4 |
|
397 |
dpavlin |
22 |
/* For the automachine system: */ |
398 |
|
|
struct machine_entry_subtype { |
399 |
|
|
int machine_subtype;/* Old-style subtype */ |
400 |
|
|
const char *name; /* Official name */ |
401 |
|
|
int n_aliases; |
402 |
|
|
char **aliases; /* Aliases */ |
403 |
|
|
}; |
404 |
|
|
|
405 |
|
|
struct machine_entry { |
406 |
|
|
struct machine_entry *next; |
407 |
|
|
|
408 |
|
|
/* Machine type: */ |
409 |
|
|
int arch; |
410 |
|
|
int machine_type; /* Old-style type */ |
411 |
|
|
const char *name; /* Official name */ |
412 |
|
|
int n_aliases; |
413 |
|
|
char **aliases; /* Aliases */ |
414 |
|
|
|
415 |
|
|
void (*setup)(struct machine *, struct cpu *); |
416 |
|
|
void (*set_default_cpu)(struct machine *); |
417 |
|
|
void (*set_default_ram)(struct machine *); |
418 |
|
|
|
419 |
|
|
/* Machine subtypes: */ |
420 |
|
|
int n_subtypes; |
421 |
|
|
struct machine_entry_subtype **subtype; |
422 |
|
|
}; |
423 |
|
|
|
424 |
|
|
#define MACHINE_SETUP_TYPE(n) void (*n)(struct machine *, struct cpu *) |
425 |
|
|
#define MACHINE_SETUP(x) void machine_setup_ ## x(struct machine *machine, \ |
426 |
|
|
struct cpu *cpu) |
427 |
|
|
#define MACHINE_DEFAULT_CPU(x) void machine_default_cpu_ ## x(struct machine *machine) |
428 |
|
|
#define MACHINE_DEFAULT_RAM(x) void machine_default_ram_ ## x(struct machine *machine) |
429 |
|
|
#define MACHINE_REGISTER(x) void machine_register_ ## x(void) |
430 |
dpavlin |
26 |
#define MR_DEFAULT(x,name,arch,type) struct machine_entry \ |
431 |
|
|
*me = machine_entry_new(name,arch,type); \ |
432 |
|
|
me->setup = machine_setup_ ## x; \ |
433 |
|
|
me->set_default_cpu = machine_default_cpu_ ## x; \ |
434 |
|
|
machine_entry_register(me, arch); |
435 |
dpavlin |
22 |
void automachine_init(void); |
436 |
|
|
|
437 |
|
|
|
438 |
dpavlin |
4 |
/* machine.c: */ |
439 |
dpavlin |
34 |
struct machine *machine_new(char *name, struct emul *emul, int id); |
440 |
dpavlin |
32 |
void machine_destroy(struct machine *machine); |
441 |
dpavlin |
4 |
int machine_name_to_type(char *stype, char *ssubtype, |
442 |
|
|
int *type, int *subtype, int *arch); |
443 |
|
|
void machine_add_tickfunction(struct machine *machine, |
444 |
dpavlin |
24 |
void (*func)(struct cpu *, void *), void *extra, |
445 |
|
|
int clockshift, double hz); |
446 |
dpavlin |
28 |
void machine_statistics_init(struct machine *, char *fname); |
447 |
dpavlin |
22 |
void machine_register(char *name, MACHINE_SETUP_TYPE(setup)); |
448 |
dpavlin |
4 |
void dump_mem_string(struct cpu *cpu, uint64_t addr); |
449 |
|
|
void store_string(struct cpu *cpu, uint64_t addr, char *s); |
450 |
|
|
int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64); |
451 |
|
|
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32); |
452 |
|
|
int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16); |
453 |
dpavlin |
6 |
void store_byte(struct cpu *cpu, uint64_t addr, uint8_t data); |
454 |
dpavlin |
4 |
void store_64bit_word_in_host(struct cpu *cpu, unsigned char *data, |
455 |
|
|
uint64_t data32); |
456 |
|
|
void store_32bit_word_in_host(struct cpu *cpu, unsigned char *data, |
457 |
|
|
uint64_t data32); |
458 |
|
|
void store_16bit_word_in_host(struct cpu *cpu, unsigned char *data, |
459 |
|
|
uint16_t data16); |
460 |
dpavlin |
32 |
uint64_t load_64bit_word(struct cpu *cpu, uint64_t addr); |
461 |
dpavlin |
4 |
uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr); |
462 |
|
|
uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr); |
463 |
|
|
void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len); |
464 |
dpavlin |
22 |
void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr); |
465 |
|
|
void add_environment_string_dual(struct cpu *cpu, |
466 |
|
|
uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2); |
467 |
|
|
void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp, |
468 |
|
|
uint64_t data, int flag64); |
469 |
dpavlin |
4 |
void machine_setup(struct machine *); |
470 |
|
|
void machine_memsize_fix(struct machine *); |
471 |
|
|
void machine_default_cputype(struct machine *); |
472 |
|
|
void machine_dumpinfo(struct machine *); |
473 |
dpavlin |
26 |
int machine_run(struct machine *machine); |
474 |
dpavlin |
4 |
void machine_list_available_types_and_cpus(void); |
475 |
dpavlin |
22 |
struct machine_entry *machine_entry_new(const char *name, |
476 |
dpavlin |
26 |
int arch, int oldstyle_type); |
477 |
|
|
void machine_entry_add_alias(struct machine_entry *me, const char *name); |
478 |
|
|
void machine_entry_add_subtype(struct machine_entry *me, const char *name, |
479 |
|
|
int oldstyle_subtype, ...); |
480 |
|
|
void machine_entry_register(struct machine_entry *me, int arch); |
481 |
dpavlin |
4 |
void machine_init(void); |
482 |
|
|
|
483 |
|
|
|
484 |
|
|
#endif /* MACHINE_H */ |