28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: machine.h,v 1.162 2007/04/19 15:18:16 debug Exp $ |
* $Id: machine.h,v 1.179 2007/06/15 17:02:39 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/time.h> |
|
35 |
|
|
36 |
#include "symbol.h" |
#include "symbol.h" |
37 |
|
|
|
#include "machine_arc.h" |
|
|
#include "machine_pmax.h" |
|
|
|
|
|
|
|
|
#define MAX_BREAKPOINTS 8 |
|
|
|
|
|
#define MAX_TICK_FUNCTIONS 16 |
|
|
|
|
|
#define MAX_STATISTICS_FIELDS 8 |
|
|
|
|
38 |
struct cpu_family; |
struct cpu_family; |
39 |
struct diskimage; |
struct diskimage; |
40 |
struct emul; |
struct emul; |
41 |
struct fb_window; |
struct fb_window; |
42 |
|
struct machine_arcbios; |
43 |
|
struct machine_pmax; |
44 |
struct memory; |
struct memory; |
45 |
struct of_data; |
struct of_data; |
46 |
struct settings; |
struct settings; |
55 |
int last_int; |
int last_int; |
56 |
}; |
}; |
57 |
|
|
58 |
|
struct breakpoints { |
59 |
|
int n; |
60 |
|
|
61 |
|
/* Arrays, with one element for each entry: */ |
62 |
|
char **string; |
63 |
|
uint64_t *addr; |
64 |
|
}; |
65 |
|
|
66 |
|
struct tick_functions { |
67 |
|
int n_entries; |
68 |
|
|
69 |
|
/* Arrays, with one element for each entry: */ |
70 |
|
int *ticks_till_next; |
71 |
|
int *ticks_reset_value; |
72 |
|
void (*(*f))(struct cpu *, void *); |
73 |
|
void **extra; |
74 |
|
}; |
75 |
|
|
76 |
|
struct x11_md { |
77 |
|
/* X11/framebuffer stuff: */ |
78 |
|
int in_use; |
79 |
|
int scaledown; |
80 |
|
int scaleup; |
81 |
|
int n_display_names; |
82 |
|
char **display_names; |
83 |
|
int current_display_name_nr; /* updated by x11.c */ |
84 |
|
|
85 |
|
int n_fb_windows; |
86 |
|
struct fb_window **fb_windows; |
87 |
|
}; |
88 |
|
|
89 |
struct machine { |
struct machine { |
90 |
/* Pointer back to the emul struct we are in: */ |
/* Pointer back to the emul struct we are in: */ |
103 |
int machine_type; /* MACHINE_PMAX, .. */ |
int machine_type; /* MACHINE_PMAX, .. */ |
104 |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
105 |
|
|
|
/* NOTE/TODO: This isn't working yet: */ |
|
|
int cycle_accurate; /* Set to non-zero for cycle |
|
|
accurate (slow) emulation. */ |
|
|
|
|
106 |
/* Name set by code in src/machines/machine_*.c: */ |
/* Name set by code in src/machines/machine_*.c: */ |
107 |
char *machine_name; |
char *machine_name; |
108 |
|
|
|
int stable; /* startup warning for non-stable |
|
|
emulation modes. */ |
|
|
|
|
109 |
/* The serial number is mostly used when emulating multiple machines |
/* The serial number is mostly used when emulating multiple machines |
110 |
in a network. nr_of_nics is the current nr of network cards, which |
in a network. nr_of_nics is the current nr of network cards, which |
111 |
is useful when emulating multiple cards in one machine: */ |
is useful when emulating multiple cards in one machine: */ |
115 |
/* TODO: How about multiple cpu familys in one machine? */ |
/* TODO: How about multiple cpu familys in one machine? */ |
116 |
struct cpu_family *cpu_family; |
struct cpu_family *cpu_family; |
117 |
|
|
|
/* |
|
|
* The "mainbus": |
|
|
* |
|
|
* o) memory |
|
|
* o) devices |
|
|
* o) CPUs |
|
|
*/ |
|
|
|
|
118 |
struct memory *memory; |
struct memory *memory; |
119 |
|
|
120 |
int main_console_handle; |
int main_console_handle; |
121 |
|
|
122 |
/* Hardware devices, run every x clock cycles. */ |
/* Tick functions (e.g. hardware devices): */ |
123 |
int n_tick_entries; |
struct tick_functions tick_functions; |
|
int ticks_till_next[MAX_TICK_FUNCTIONS]; |
|
|
int ticks_reset_value[MAX_TICK_FUNCTIONS]; |
|
|
void (*tick_func[MAX_TICK_FUNCTIONS])(struct cpu *, void *); |
|
|
void *tick_extra[MAX_TICK_FUNCTIONS]; |
|
|
double tick_hz[MAX_TICK_FUNCTIONS]; |
|
124 |
|
|
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 */ |
131 |
int ncpus; |
int ncpus; |
132 |
struct cpu **cpus; |
struct cpu **cpus; |
133 |
|
|
|
/* These are used by stuff in cpu.c, mostly: */ |
|
|
/* TODO: Move to cpu.h! */ |
|
|
int64_t ninstrs; |
|
|
int64_t ninstrs_show; |
|
|
int64_t ninstrs_flush; |
|
|
int64_t ninstrs_since_gettimeofday; |
|
|
struct timeval starttime; |
|
|
|
|
134 |
struct diskimage *first_diskimage; |
struct diskimage *first_diskimage; |
135 |
|
|
136 |
struct symbol_context symbol_context; |
struct symbol_context symbol_context; |
148 |
char *bootarg; |
char *bootarg; |
149 |
|
|
150 |
/* Breakpoints: */ |
/* Breakpoints: */ |
151 |
int n_breakpoints; |
struct breakpoints breakpoints; |
|
char *breakpoint_string[MAX_BREAKPOINTS]; |
|
|
uint64_t breakpoint_addr[MAX_BREAKPOINTS]; |
|
|
int breakpoint_flags[MAX_BREAKPOINTS]; |
|
|
|
|
|
/* Cache sizes: (1 << x) x=0 for default values */ |
|
|
/* TODO: these should be _PER CPU_! */ |
|
|
int cache_picache; |
|
|
int cache_pdcache; |
|
|
int cache_secondary; |
|
|
int cache_picache_linesize; |
|
|
int cache_pdcache_linesize; |
|
|
int cache_secondary_linesize; |
|
152 |
|
|
|
int dbe_on_nonexistant_memaccess; |
|
153 |
int halt_on_nonexistant_memaccess; |
int halt_on_nonexistant_memaccess; |
154 |
int instruction_trace; |
int instruction_trace; |
155 |
int show_nr_of_instructions; |
int show_nr_of_instructions; |
156 |
int show_trace_tree; |
int show_trace_tree; |
|
int show_symbolic_register_names; |
|
157 |
int emulated_hz; |
int emulated_hz; |
158 |
int allow_instruction_combinations; |
int allow_instruction_combinations; |
159 |
char *userland_emul; /* NULL for no userland emulation */ |
char *userland_emul; /* NULL for no userland emulation */ |
171 |
int statistics_enabled; |
int statistics_enabled; |
172 |
char *statistics_fields; /* "vpi" etc. */ |
char *statistics_fields; /* "vpi" etc. */ |
173 |
|
|
174 |
|
/* X11/framebuffer stuff (per machine): */ |
175 |
|
struct x11_md x11_md; |
176 |
|
|
177 |
/* Machine-dependent: (PROM stuff, etc.) */ |
/* Machine-dependent: (PROM stuff, etc.) */ |
178 |
union { |
union { |
179 |
struct machine_arcbios arc; |
struct machine_arcbios *arc; |
180 |
struct machine_pmax pmax; |
struct machine_pmax *pmax; |
181 |
struct of_data *of_data; |
struct of_data *of_data; |
182 |
} md; |
} md; |
183 |
|
|
184 |
/* Bus-specific interrupt data: */ |
/* Bus-specific interrupt data: */ |
185 |
/* TODO: Remove! */ |
/* TODO: Remove! */ |
186 |
struct isa_pic_data isa_pic_data; |
struct isa_pic_data isa_pic_data; |
|
|
|
|
/* X11/framebuffer stuff: */ |
|
|
int use_x11; |
|
|
int x11_scaledown; |
|
|
int x11_scaleup; |
|
|
int x11_n_display_names; |
|
|
char **x11_display_names; |
|
|
int x11_current_display_name_nr; /* updated by x11.c */ |
|
|
|
|
|
int n_fb_windows; |
|
|
struct fb_window **fb_windows; |
|
187 |
}; |
}; |
188 |
|
|
189 |
|
|
202 |
#define ARCH_ALPHA 4 |
#define ARCH_ALPHA 4 |
203 |
#define ARCH_ARM 5 |
#define ARCH_ARM 5 |
204 |
#define ARCH_SH 6 |
#define ARCH_SH 6 |
205 |
#define ARCH_AVR 7 |
#define ARCH_M88K 7 |
|
#define ARCH_M88K 8 |
|
206 |
|
|
207 |
/* MIPS: */ |
/* MIPS: */ |
208 |
#define MACHINE_BAREMIPS 1000 |
#define MACHINE_BAREMIPS 1000 |
213 |
#define MACHINE_PS2 1005 |
#define MACHINE_PS2 1005 |
214 |
#define MACHINE_SGI 1006 |
#define MACHINE_SGI 1006 |
215 |
#define MACHINE_ARC 1007 |
#define MACHINE_ARC 1007 |
216 |
#define MACHINE_NETGEAR 1008 |
#define MACHINE_EVBMIPS 1008 |
217 |
#define MACHINE_SONYNEWS 1009 |
#define MACHINE_ALGOR 1009 |
218 |
#define MACHINE_EVBMIPS 1010 |
#define MACHINE_QEMU_MIPS 1010 |
|
#define MACHINE_PSP 1011 |
|
|
#define MACHINE_ALGOR 1012 |
|
|
#define MACHINE_QEMU_MIPS 1013 |
|
219 |
|
|
220 |
/* PPC: */ |
/* PPC: */ |
221 |
#define MACHINE_BAREPPC 2000 |
#define MACHINE_BAREPPC 2000 |
222 |
#define MACHINE_TESTPPC 2001 |
#define MACHINE_TESTPPC 2001 |
223 |
#define MACHINE_PMPPC 2002 |
#define MACHINE_PMPPC 2002 |
224 |
#define MACHINE_SANDPOINT 2003 |
#define MACHINE_BEBOX 2003 |
225 |
#define MACHINE_BEBOX 2004 |
#define MACHINE_PREP 2004 |
226 |
#define MACHINE_PREP 2005 |
#define MACHINE_MACPPC 2005 |
227 |
#define MACHINE_MACPPC 2006 |
#define MACHINE_MVMEPPC 2006 |
|
#define MACHINE_MVMEPPC 2007 |
|
228 |
|
|
229 |
/* SPARC: */ |
/* SPARC: */ |
230 |
#define MACHINE_BARESPARC 3000 |
#define MACHINE_BARESPARC 3000 |
241 |
#define MACHINE_TESTARM 5001 |
#define MACHINE_TESTARM 5001 |
242 |
#define MACHINE_CATS 5002 |
#define MACHINE_CATS 5002 |
243 |
#define MACHINE_HPCARM 5003 |
#define MACHINE_HPCARM 5003 |
244 |
#define MACHINE_ZAURUS 5004 |
#define MACHINE_NETWINDER 5004 |
245 |
#define MACHINE_NETWINDER 5005 |
#define MACHINE_IQ80321 5005 |
246 |
#define MACHINE_SHARK 5006 |
#define MACHINE_QEMU_ARM 5006 |
|
#define MACHINE_IQ80321 5007 |
|
|
#define MACHINE_IYONIX 5008 |
|
|
#define MACHINE_QEMU_ARM 5009 |
|
247 |
|
|
248 |
/* SH: */ |
/* SH: */ |
249 |
#define MACHINE_BARESH 6000 |
#define MACHINE_BARESH 6000 |
252 |
#define MACHINE_DREAMCAST 6003 |
#define MACHINE_DREAMCAST 6003 |
253 |
#define MACHINE_LANDISK 6004 |
#define MACHINE_LANDISK 6004 |
254 |
|
|
|
/* AVR: */ |
|
|
#define MACHINE_BAREAVR 7000 |
|
|
#define MACHINE_AVR_PAL 7001 |
|
|
#define MACHINE_AVR_MAHPONG 7002 |
|
|
|
|
255 |
/* M88K: */ |
/* M88K: */ |
256 |
#define MACHINE_BAREM88K 8000 |
#define MACHINE_BAREM88K 7000 |
257 |
#define MACHINE_TESTM88K 8001 |
#define MACHINE_TESTM88K 7001 |
258 |
|
#define MACHINE_MVME88K 7002 |
259 |
|
|
260 |
/* Other "pseudo"-machines: */ |
/* Other "pseudo"-machines: */ |
261 |
#define MACHINE_NONE 0 |
#define MACHINE_NONE 0 |
298 |
#define MACHINE_HPCSH_JORNADA690 2 |
#define MACHINE_HPCSH_JORNADA690 2 |
299 |
|
|
300 |
/* SGI and ARC: */ |
/* SGI and ARC: */ |
301 |
#define MACHINE_ARC_NEC_RD94 1 |
#define MACHINE_ARC_JAZZ_PICA 1 |
302 |
#define MACHINE_ARC_JAZZ_PICA 2 |
#define MACHINE_ARC_JAZZ_MAGNUM 2 |
|
#define MACHINE_ARC_NEC_R94 3 |
|
|
#define MACHINE_ARC_DESKTECH_TYNE 4 |
|
|
#define MACHINE_ARC_JAZZ_MAGNUM 5 |
|
|
#define MACHINE_ARC_NEC_R98 6 |
|
|
#define MACHINE_ARC_JAZZ_M700 7 |
|
|
#define MACHINE_ARC_NEC_R96 8 |
|
303 |
|
|
304 |
/* Algor: */ |
/* Algor: */ |
305 |
#define MACHINE_ALGOR_P4032 4 |
#define MACHINE_ALGOR_P4032 1 |
306 |
#define MACHINE_ALGOR_P5064 5 |
#define MACHINE_ALGOR_P5064 2 |
307 |
|
|
308 |
/* EVBMIPS: */ |
/* EVBMIPS: */ |
309 |
#define MACHINE_EVBMIPS_MALTA 1 |
#define MACHINE_EVBMIPS_MALTA 1 |
330 |
#define MACHINE_MVMEPPC_2100 2 |
#define MACHINE_MVMEPPC_2100 2 |
331 |
#define MACHINE_MVMEPPC_5500 3 |
#define MACHINE_MVMEPPC_5500 3 |
332 |
|
|
333 |
|
/* MVME88K */ |
334 |
|
#define MACHINE_MVME88K_187 1 |
335 |
|
#define MACHINE_MVME88K_188 2 |
336 |
|
#define MACHINE_MVME88K_197 3 |
337 |
|
|
338 |
|
|
339 |
/* For the automachine system: */ |
/* For the automachine system: */ |
340 |
struct machine_entry_subtype { |
struct machine_entry_subtype { |
382 |
void machine_destroy(struct machine *machine); |
void machine_destroy(struct machine *machine); |
383 |
int machine_name_to_type(char *stype, char *ssubtype, |
int machine_name_to_type(char *stype, char *ssubtype, |
384 |
int *type, int *subtype, int *arch); |
int *type, int *subtype, int *arch); |
385 |
|
void machine_add_breakpoint_string(struct machine *machine, char *str); |
386 |
void machine_add_tickfunction(struct machine *machine, |
void machine_add_tickfunction(struct machine *machine, |
387 |
void (*func)(struct cpu *, void *), void *extra, |
void (*func)(struct cpu *, void *), void *extra, int clockshift); |
|
int clockshift, double hz); |
|
388 |
void machine_statistics_init(struct machine *, char *fname); |
void machine_statistics_init(struct machine *, char *fname); |
389 |
void machine_register(char *name, MACHINE_SETUP_TYPE(setup)); |
void machine_register(char *name, MACHINE_SETUP_TYPE(setup)); |
|
void dump_mem_string(struct cpu *cpu, uint64_t addr); |
|
|
void store_string(struct cpu *cpu, uint64_t addr, char *s); |
|
|
int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64); |
|
|
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32); |
|
|
int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16); |
|
|
void store_byte(struct cpu *cpu, uint64_t addr, uint8_t data); |
|
|
void store_64bit_word_in_host(struct cpu *cpu, unsigned char *data, |
|
|
uint64_t data32); |
|
|
void store_32bit_word_in_host(struct cpu *cpu, unsigned char *data, |
|
|
uint64_t data32); |
|
|
void store_16bit_word_in_host(struct cpu *cpu, unsigned char *data, |
|
|
uint16_t data16); |
|
|
uint64_t load_64bit_word(struct cpu *cpu, uint64_t addr); |
|
|
uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr); |
|
|
uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr); |
|
|
void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len); |
|
|
void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr); |
|
|
void add_environment_string_dual(struct cpu *cpu, |
|
|
uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2); |
|
|
void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp, |
|
|
uint64_t data, int flag64); |
|
390 |
void machine_setup(struct machine *); |
void machine_setup(struct machine *); |
391 |
void machine_memsize_fix(struct machine *); |
void machine_memsize_fix(struct machine *); |
392 |
void machine_default_cputype(struct machine *); |
void machine_default_cputype(struct machine *); |