2 |
#define MACHINE_H |
#define MACHINE_H |
3 |
|
|
4 |
/* |
/* |
5 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2007 Anders Gavare. All rights reserved. |
6 |
* |
* |
7 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
8 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: machine.h,v 1.136 2006/10/25 09:24:06 debug Exp $ |
* $Id: machine.h,v 1.156 2007/02/10 14:29:55 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include <sys/types.h> |
#include <sys/types.h> |
39 |
|
|
40 |
#include "machine_arc.h" |
#include "machine_arc.h" |
41 |
#include "machine_pmax.h" |
#include "machine_pmax.h" |
|
#include "machine_x86.h" |
|
42 |
|
|
43 |
|
|
44 |
#define MAX_BREAKPOINTS 8 |
#define MAX_BREAKPOINTS 8 |
|
#define BREAKPOINT_FLAG_R 1 |
|
45 |
|
|
46 |
#define MAX_TICK_FUNCTIONS 16 |
#define MAX_TICK_FUNCTIONS 16 |
47 |
|
|
55 |
struct of_data; |
struct of_data; |
56 |
struct settings; |
struct settings; |
57 |
|
|
|
/* Ugly: */ |
|
|
struct kn230_csr; |
|
|
struct kn02_csr; |
|
|
struct dec_ioasic_data; |
|
|
struct ps2_data; |
|
|
struct footbridge_data; |
|
|
struct dec5800_data; |
|
|
struct au1x00_ic_data; |
|
|
struct malta_data; |
|
|
struct vr41xx_data; |
|
|
struct jazz_data; |
|
|
struct crime_data; |
|
|
struct mace_data; |
|
|
struct sgi_ip20_data; |
|
|
struct sgi_ip22_data; |
|
|
struct sgi_ip30_data; |
|
58 |
|
|
59 |
|
/* TODO: This should probably go away... */ |
60 |
struct isa_pic_data { |
struct isa_pic_data { |
61 |
struct pic8259_data *pic1; |
struct pic8259_data *pic1; |
62 |
struct pic8259_data *pic2; |
struct pic8259_data *pic2; |
63 |
|
|
64 |
int *pending_timer_interrupts; |
int *pending_timer_interrupts; |
65 |
int last_int; |
int last_int; |
|
|
|
|
int native_irq; |
|
|
int native_secondary_irq; |
|
|
uint8_t secondary_mask1; |
|
|
}; |
|
|
|
|
|
|
|
|
struct machine_bus { |
|
|
struct machine_bus *next; |
|
|
|
|
|
char *name; |
|
|
|
|
|
void (*debug_dump)(void *); |
|
|
void *extra; |
|
66 |
}; |
}; |
67 |
|
|
68 |
|
|
76 |
/* Name as choosen by the user: */ |
/* Name as choosen by the user: */ |
77 |
char *name; |
char *name; |
78 |
|
|
79 |
|
/* Full "path" to the machine, e.g. "emul[0].machine[0]": */ |
80 |
|
char *path; |
81 |
|
|
82 |
int arch; /* ARCH_MIPS, ARCH_PPC, .. */ |
int arch; /* ARCH_MIPS, ARCH_PPC, .. */ |
83 |
int machine_type; /* MACHINE_PMAX, .. */ |
int machine_type; /* MACHINE_PMAX, .. */ |
84 |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
85 |
|
|
86 |
|
/* NOTE/TODO: This isn't working yet: */ |
87 |
int cycle_accurate; /* Set to non-zero for cycle |
int cycle_accurate; /* Set to non-zero for cycle |
88 |
accurate (slow) emulation. */ |
accurate (slow) emulation. */ |
89 |
|
|
122 |
void *tick_extra[MAX_TICK_FUNCTIONS]; |
void *tick_extra[MAX_TICK_FUNCTIONS]; |
123 |
double tick_hz[MAX_TICK_FUNCTIONS]; |
double tick_hz[MAX_TICK_FUNCTIONS]; |
124 |
|
|
|
void (*md_interrupt)(struct machine *m, struct cpu *cpu, |
|
|
int irq_nr, int assert); |
|
|
|
|
125 |
char *cpu_name; /* TODO: remove this, there could be several |
char *cpu_name; /* TODO: remove this, there could be several |
126 |
cpus with different names in a machine */ |
cpus with different names in a machine */ |
127 |
int byte_order_override; |
int byte_order_override; |
131 |
int ncpus; |
int ncpus; |
132 |
struct cpu **cpus; |
struct cpu **cpus; |
133 |
|
|
|
/* Registered busses: */ |
|
|
struct machine_bus *first_bus; |
|
|
int n_busses; |
|
|
|
|
134 |
/* These are used by stuff in cpu.c, mostly: */ |
/* These are used by stuff in cpu.c, mostly: */ |
135 |
|
/* TODO: Move to cpu.h! */ |
136 |
int64_t ninstrs; |
int64_t ninstrs; |
137 |
int64_t ninstrs_show; |
int64_t ninstrs_show; |
138 |
int64_t ninstrs_flush; |
int64_t ninstrs_flush; |
164 |
int breakpoint_flags[MAX_BREAKPOINTS]; |
int breakpoint_flags[MAX_BREAKPOINTS]; |
165 |
|
|
166 |
/* Cache sizes: (1 << x) x=0 for default values */ |
/* Cache sizes: (1 << x) x=0 for default values */ |
167 |
/* TODO: these are _PER CPU_! */ |
/* TODO: these should be _PER CPU_! */ |
168 |
int cache_picache; |
int cache_picache; |
169 |
int cache_pdcache; |
int cache_pdcache; |
170 |
int cache_secondary; |
int cache_secondary; |
173 |
int cache_secondary_linesize; |
int cache_secondary_linesize; |
174 |
|
|
175 |
int dbe_on_nonexistant_memaccess; |
int dbe_on_nonexistant_memaccess; |
176 |
|
int halt_on_nonexistant_memaccess; |
177 |
int instruction_trace; |
int instruction_trace; |
178 |
int show_nr_of_instructions; |
int show_nr_of_instructions; |
179 |
int show_trace_tree; |
int show_trace_tree; |
199 |
union { |
union { |
200 |
struct machine_arcbios arc; |
struct machine_arcbios arc; |
201 |
struct machine_pmax pmax; |
struct machine_pmax pmax; |
202 |
struct machine_pc pc; |
struct of_data *of_data; |
203 |
} md; |
} md; |
204 |
|
|
|
/* OpenFirmware: */ |
|
|
struct of_data *of_data; |
|
|
|
|
205 |
/* Bus-specific interrupt data: */ |
/* Bus-specific interrupt data: */ |
206 |
|
/* TODO: Remove! */ |
207 |
struct isa_pic_data isa_pic_data; |
struct isa_pic_data isa_pic_data; |
208 |
|
|
|
/* Machine-dependent interrupt specific structs: */ |
|
|
union { |
|
|
struct kn230_csr *kn230_csr; |
|
|
struct kn02_csr *kn02_csr; |
|
|
struct dec_ioasic_data *dec_ioasic_data; |
|
|
struct ps2_data *ps2_data; |
|
|
struct dec5800_data *dec5800_csr; |
|
|
struct au1x00_ic_data *au1x00_ic_data; |
|
|
struct vr41xx_data *vr41xx_data; |
|
|
struct jazz_data *jazz_data; |
|
|
struct malta_data *malta_data; |
|
|
struct sgi_ip20_data *sgi_ip20_data; |
|
|
struct sgi_ip22_data *sgi_ip22_data; |
|
|
struct sgi_ip30_data *sgi_ip30_data; |
|
|
struct { |
|
|
struct crime_data *crime_data; |
|
|
struct mace_data *mace_data; |
|
|
} ip32; |
|
|
struct footbridge_data *footbridge_data; |
|
|
struct bebox_data *bebox_data; |
|
|
struct prep_data *prep_data; |
|
|
struct cpc700_data *cpc700_data; |
|
|
struct gc_data *gc_data; |
|
|
struct v3_data *v3_data; |
|
|
} md_int; |
|
|
|
|
209 |
/* X11/framebuffer stuff: */ |
/* X11/framebuffer stuff: */ |
210 |
int use_x11; |
int use_x11; |
211 |
int x11_scaledown; |
int x11_scaledown; |
232 |
#define ARCH_PPC 2 |
#define ARCH_PPC 2 |
233 |
#define ARCH_SPARC 3 |
#define ARCH_SPARC 3 |
234 |
#define ARCH_ALPHA 4 |
#define ARCH_ALPHA 4 |
235 |
#define ARCH_X86 5 |
#define ARCH_ARM 5 |
236 |
#define ARCH_ARM 6 |
#define ARCH_M68K 6 |
237 |
#define ARCH_IA64 7 |
#define ARCH_SH 7 |
238 |
#define ARCH_M68K 8 |
#define ARCH_AVR 8 |
239 |
#define ARCH_SH 9 |
#define ARCH_TRANSPUTER 9 |
240 |
#define ARCH_HPPA 10 |
#define ARCH_RCA180X 10 |
|
#define ARCH_I960 11 |
|
|
#define ARCH_AVR 12 |
|
|
#define ARCH_TRANSPUTER 13 |
|
|
#define ARCH_RCA180X 14 |
|
|
#define ARCH_AVR32 15 |
|
241 |
|
|
242 |
/* MIPS: */ |
/* MIPS: */ |
243 |
#define MACHINE_BAREMIPS 1000 |
#define MACHINE_BAREMIPS 1000 |
264 |
#define MACHINE_BEBOX 2005 |
#define MACHINE_BEBOX 2005 |
265 |
#define MACHINE_PREP 2006 |
#define MACHINE_PREP 2006 |
266 |
#define MACHINE_MACPPC 2007 |
#define MACHINE_MACPPC 2007 |
267 |
#define MACHINE_DB64360 2008 |
#define MACHINE_MVMEPPC 2008 |
|
#define MACHINE_MVMEPPC 2009 |
|
268 |
|
|
269 |
/* SPARC: */ |
/* SPARC: */ |
270 |
#define MACHINE_BARESPARC 3000 |
#define MACHINE_BARESPARC 3000 |
276 |
#define MACHINE_TESTALPHA 4001 |
#define MACHINE_TESTALPHA 4001 |
277 |
#define MACHINE_ALPHA 4002 |
#define MACHINE_ALPHA 4002 |
278 |
|
|
|
/* X86: */ |
|
|
#define MACHINE_BAREX86 5000 |
|
|
#define MACHINE_X86 5001 |
|
|
|
|
279 |
/* ARM: */ |
/* ARM: */ |
280 |
#define MACHINE_BAREARM 6000 |
#define MACHINE_BAREARM 5000 |
281 |
#define MACHINE_TESTARM 6001 |
#define MACHINE_TESTARM 5001 |
282 |
#define MACHINE_CATS 6002 |
#define MACHINE_CATS 5002 |
283 |
#define MACHINE_HPCARM 6003 |
#define MACHINE_HPCARM 5003 |
284 |
#define MACHINE_ZAURUS 6004 |
#define MACHINE_ZAURUS 5004 |
285 |
#define MACHINE_NETWINDER 6005 |
#define MACHINE_NETWINDER 5005 |
286 |
#define MACHINE_SHARK 6006 |
#define MACHINE_SHARK 5006 |
287 |
#define MACHINE_IQ80321 6007 |
#define MACHINE_IQ80321 5007 |
288 |
#define MACHINE_IYONIX 6008 |
#define MACHINE_IYONIX 5008 |
289 |
#define MACHINE_TS7200 6009 |
#define MACHINE_TS7200 5009 |
290 |
#define MACHINE_QEMU_ARM 6010 |
#define MACHINE_QEMU_ARM 5010 |
|
|
|
|
/* IA64: */ |
|
|
#define MACHINE_BAREIA64 7000 |
|
|
#define MACHINE_TESTIA64 7001 |
|
291 |
|
|
292 |
/* M68K: */ |
/* M68K: */ |
293 |
#define MACHINE_BAREM68K 8000 |
#define MACHINE_BAREM68K 6000 |
294 |
#define MACHINE_TESTM68K 8001 |
#define MACHINE_TESTM68K 6001 |
295 |
|
|
296 |
/* SH: */ |
/* SH: */ |
297 |
#define MACHINE_BARESH 9000 |
#define MACHINE_BARESH 7000 |
298 |
#define MACHINE_TESTSH 9001 |
#define MACHINE_TESTSH 7001 |
299 |
#define MACHINE_HPCSH 9002 |
#define MACHINE_HPCSH 7002 |
300 |
#define MACHINE_DREAMCAST 9003 |
#define MACHINE_DREAMCAST 7003 |
301 |
|
#define MACHINE_LANDISK 7004 |
|
/* HPPA: */ |
|
|
#define MACHINE_BAREHPPA 10000 |
|
|
#define MACHINE_TESTHPPA 10001 |
|
|
|
|
|
/* I960: */ |
|
|
#define MACHINE_BAREI960 11000 |
|
|
#define MACHINE_TESTI960 11001 |
|
302 |
|
|
303 |
/* AVR: */ |
/* AVR: */ |
304 |
#define MACHINE_BAREAVR 12000 |
#define MACHINE_BAREAVR 8000 |
305 |
#define MACHINE_AVR_PAL 12001 |
#define MACHINE_AVR_PAL 8001 |
306 |
#define MACHINE_AVR_MAHPONG 12002 |
#define MACHINE_AVR_MAHPONG 8002 |
307 |
|
|
308 |
/* TRANSPUTER: */ |
/* TRANSPUTER: */ |
309 |
#define MACHINE_BARETRANSPUTER 13000 |
#define MACHINE_BARETRANSPUTER 9000 |
310 |
|
|
311 |
/* ARCH_RCA180X: */ |
/* ARCH_RCA180X: */ |
312 |
#define MACHINE_BARE180X 14000 |
#define MACHINE_BARE180X 10000 |
313 |
#define MACHINE_CHIP8 14001 |
#define MACHINE_CHIP8 10001 |
|
|
|
|
/* AVR32: */ |
|
|
#define MACHINE_BAREAVR32 15000 |
|
|
#define MACHINE_TESTAVR32 15001 |
|
314 |
|
|
315 |
/* Other "pseudo"-machines: */ |
/* Other "pseudo"-machines: */ |
316 |
#define MACHINE_NONE 0 |
#define MACHINE_NONE 0 |
392 |
#define MACHINE_MVMEPPC_2100 2 |
#define MACHINE_MVMEPPC_2100 2 |
393 |
#define MACHINE_MVMEPPC_5500 3 |
#define MACHINE_MVMEPPC_5500 3 |
394 |
|
|
|
/* X86: */ |
|
|
#define MACHINE_X86_GENERIC 1 |
|
|
#define MACHINE_X86_XT 2 |
|
|
|
|
395 |
|
|
396 |
/* For the automachine system: */ |
/* For the automachine system: */ |
397 |
struct machine_entry_subtype { |
struct machine_entry_subtype { |
435 |
|
|
436 |
|
|
437 |
/* machine.c: */ |
/* machine.c: */ |
438 |
struct machine *machine_new(char *name, struct emul *emul); |
struct machine *machine_new(char *name, struct emul *emul, int id); |
439 |
void machine_destroy(struct machine *machine); |
void machine_destroy(struct machine *machine); |
440 |
int machine_name_to_type(char *stype, char *ssubtype, |
int machine_name_to_type(char *stype, char *ssubtype, |
441 |
int *type, int *subtype, int *arch); |
int *type, int *subtype, int *arch); |
469 |
void machine_memsize_fix(struct machine *); |
void machine_memsize_fix(struct machine *); |
470 |
void machine_default_cputype(struct machine *); |
void machine_default_cputype(struct machine *); |
471 |
void machine_dumpinfo(struct machine *); |
void machine_dumpinfo(struct machine *); |
|
void machine_bus_register(struct machine *, char *busname, |
|
|
void (*debug_dump)(void *), void *extra); |
|
472 |
int machine_run(struct machine *machine); |
int machine_run(struct machine *machine); |
473 |
void machine_list_available_types_and_cpus(void); |
void machine_list_available_types_and_cpus(void); |
474 |
struct machine_entry *machine_entry_new(const char *name, |
struct machine_entry *machine_entry_new(const char *name, |