/[gxemul]/trunk/src/include/machine.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/src/include/machine.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations)
Mon Oct 8 16:18:19 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 11294 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.777 2005/06/12 12:31:52 debug Exp $
==============  RELEASE 0.3.3.1  ==============

20050609	Adding simple MIPS IPIs (to dev_mp).
20050611	Adding an ugly hack to track down low-reference bugs
		(define TRACE_NULL_CRASHES, or configure --tracenull).
		Other minor updates.
20050612	Adding a dummy evbmips mode.

==============  RELEASE 0.3.3.2  ==============


1 #ifndef MACHINE_H
2 #define MACHINE_H
3
4 /*
5 * Copyright (C) 2005 Anders Gavare. All rights reserved.
6 *
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 * $Id: machine.h,v 1.54 2005/06/12 12:31:55 debug Exp $
32 */
33
34 #include <sys/types.h>
35 #include <sys/time.h>
36
37 #include "symbol.h"
38
39 #include "arcbios.h"
40 #include "machine_x86.h"
41
42 #define MAX_BREAKPOINTS 8
43 #define BREAKPOINT_FLAG_R 1
44
45 #define MAX_TICK_FUNCTIONS 14
46
47 struct cpu_family;
48 struct diskimage;
49 struct emul;
50 struct fb_window;
51 struct memory;
52
53 /* Ugly: */
54 struct kn230_csr;
55 struct kn02_csr;
56 struct dec_ioasic_data;
57 struct ps2_data;
58 struct dec5800_data;
59 struct au1x00_ic_data;
60 struct vr41xx_data;
61 struct jazz_data;
62 struct crime_data;
63 struct mace_data;
64 struct sgi_ip20_data;
65 struct sgi_ip22_data;
66 struct sgi_ip30_data;
67
68 struct machine {
69 /* Pointer back to the emul struct we are in: */
70 struct emul *emul;
71
72 /* Name as choosen by the user: */
73 char *name;
74
75 int arch; /* ARCH_MIPS, ARCH_PPC, .. */
76 int machine_type; /* MACHINE_DEC, .. */
77 int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */
78
79 char *machine_name;
80
81 /* The serial number is mostly used when emulating multiple machines
82 in a network. nr_of_nics is the current nr of network cards, which
83 is useful when emulating multiple cards in one machine: */
84 int serial_nr;
85 int nr_of_nics;
86
87 struct cpu_family *cpu_family;
88
89 /*
90 * The "mainbus":
91 *
92 * o) memory
93 * o) devices
94 * o) CPUs
95 */
96
97 struct memory *memory;
98
99 int main_console_handle;
100
101 /* Hardware devices, run every x clock cycles. */
102 int n_tick_entries;
103 int ticks_till_next[MAX_TICK_FUNCTIONS];
104 int ticks_reset_value[MAX_TICK_FUNCTIONS];
105 void (*tick_func[MAX_TICK_FUNCTIONS])(struct cpu *, void *);
106 void *tick_extra[MAX_TICK_FUNCTIONS];
107
108 void (*md_interrupt)(struct machine *m, struct cpu *cpu,
109 int irq_nr, int assert);
110
111 char *cpu_name; /* TODO: remove this, there could be several
112 cpus with different names in a machine */
113 int byte_order_override;
114 int bootstrap_cpu;
115 int use_random_bootstrap_cpu;
116 int start_paused;
117 int ncpus;
118 struct cpu **cpus;
119
120 /* These are used by stuff in cpu.c, mostly: */
121 struct timeval starttime;
122 int64_t ncycles;
123 int64_t ncycles_show;
124 int64_t ncycles_flush;
125 int a_few_cycles;
126 int a_few_instrs;
127
128 struct diskimage *first_diskimage;
129
130 struct symbol_context symbol_context;
131
132 int random_mem_contents;
133 int physical_ram_in_mb;
134 int memory_offset_in_mb;
135 int prom_emulation;
136 int register_dump;
137
138 int n_breakpoints;
139 char *breakpoint_string[MAX_BREAKPOINTS];
140 uint64_t breakpoint_addr[MAX_BREAKPOINTS];
141 int breakpoint_flags[MAX_BREAKPOINTS];
142
143 /* Cache sizes: (1 << x) x=0 for default values */
144 /* TODO: these are _PER CPU_! */
145 int cache_picache;
146 int cache_pdcache;
147 int cache_secondary;
148 int cache_picache_linesize;
149 int cache_pdcache_linesize;
150 int cache_secondary_linesize;
151
152 int dbe_on_nonexistant_memaccess;
153 int bintrans_enable;
154 int old_bintrans_enable;
155 int bintrans_enabled_from_start;
156 int bintrans_size;
157 int instruction_trace;
158 int single_step_on_bad_addr;
159 int show_nr_of_instructions;
160 int show_symbolic_register_names;
161 int64_t max_instructions;
162 int emulated_hz;
163 int max_random_cycles_per_chunk;
164 int speed_tricks;
165 char *userland_emul; /* NULL for no userland emulation */
166 int force_netboot;
167 int slow_serial_interrupts_hack_for_linux;
168 uint64_t file_loaded_end_addr;
169 char *boot_kernel_filename;
170 char *boot_string_argument;
171
172 int automatic_clock_adjustment;
173 int exit_without_entering_debugger;
174 int show_trace_tree;
175
176 int n_gfx_cards;
177
178 /* Machine-dependent: (PROM stuff, etc.) */
179 union {
180 struct machine_arcbios arc;
181 struct machine_pc pc;
182 } md;
183
184 /* Machine-dependent interrupt specific structs: */
185 union {
186 struct kn230_csr *kn230_csr;
187 struct kn02_csr *kn02_csr;
188 struct dec_ioasic_data *dec_ioasic_data;
189 struct ps2_data *ps2_data;
190 struct dec5800_data *dec5800_csr;
191 struct au1x00_ic_data *au1x00_ic_data;
192 struct vr41xx_data *vr41xx_data;
193 struct jazz_data *jazz_data;
194 struct sgi_ip20_data *sgi_ip20_data;
195 struct sgi_ip22_data *sgi_ip22_data;
196 struct sgi_ip30_data *sgi_ip30_data;
197 struct {
198 struct crime_data *crime_data;
199 struct mace_data *mace_data;
200 } ip32;
201 } md_int;
202
203 /* X11/framebuffer stuff: */
204 int use_x11;
205 int x11_scaledown;
206 int x11_n_display_names;
207 char **x11_display_names;
208 int x11_current_display_name_nr; /* updated by x11.c */
209
210 int n_fb_windows;
211 struct fb_window **fb_windows;
212 };
213
214
215 /*
216 * Machine emulation types:
217 */
218
219 #define ARCH_NOARCH 0
220 #define ARCH_MIPS 1
221 #define ARCH_PPC 2
222 #define ARCH_SPARC 3
223 #define ARCH_URISC 4
224 #define ARCH_HPPA 5
225 #define ARCH_ALPHA 6
226 #define ARCH_X86 7
227 #define ARCH_ARM 8
228
229 /* MIPS: */
230 #define MACHINE_BAREMIPS 1000
231 #define MACHINE_TESTMIPS 1001
232 #define MACHINE_DEC 1002
233 #define MACHINE_COBALT 1003
234 #define MACHINE_HPCMIPS 1004
235 #define MACHINE_PS2 1005
236 #define MACHINE_SGI 1006
237 #define MACHINE_ARC 1007
238 #define MACHINE_MESHCUBE 1008
239 #define MACHINE_NETGEAR 1009
240 #define MACHINE_SONYNEWS 1010
241 #define MACHINE_EVBMIPS 1011
242
243 /* PPC: */
244 #define MACHINE_BAREPPC 2000
245 #define MACHINE_TESTPPC 2001
246 #define MACHINE_WALNUT 2002
247 #define MACHINE_PMPPC 2003
248 #define MACHINE_SANDPOINT 2004
249 #define MACHINE_BEBOX 2005
250 #define MACHINE_PREP 2006
251 #define MACHINE_MACPPC 2007
252 #define MACHINE_DB64360 2008
253
254 /* SPARC: */
255 #define MACHINE_BARESPARC 3000
256 #define MACHINE_ULTRA1 3001
257
258 /* URISC: */
259 #define MACHINE_BAREURISC 4000
260 #define MACHINE_TESTURISC 4001
261
262 /* HPPA: */
263 #define MACHINE_BAREHPPA 5000
264 #define MACHINE_TESTHPPA 5001
265
266 /* Alpha: */
267 #define MACHINE_BAREALPHA 6000
268 #define MACHINE_TESTALPHA 6001
269
270 /* X86: */
271 #define MACHINE_BAREX86 7000
272 #define MACHINE_X86 7001
273
274 /* ARM: */
275 #define MACHINE_BAREARM 8000
276 #define MACHINE_TESTARM 8001
277
278 /* Other "pseudo"-machines: */
279 #define MACHINE_NONE 0
280 #define MACHINE_USERLAND 100000
281
282 /* DEC: */
283 #define MACHINE_DEC_PMAX_3100 1
284 #define MACHINE_DEC_3MAX_5000 2
285 #define MACHINE_DEC_3MIN_5000 3
286 #define MACHINE_DEC_3MAXPLUS_5000 4
287 #define MACHINE_DEC_5800 5
288 #define MACHINE_DEC_5400 6
289 #define MACHINE_DEC_MAXINE_5000 7
290 #define MACHINE_DEC_5500 11
291 #define MACHINE_DEC_MIPSMATE_5100 12
292
293 #define DEC_PROM_CALLBACK_STRUCT 0xffffffffbfc04000ULL
294 #define DEC_PROM_EMULATION 0xffffffffbfc08000ULL
295 #define DEC_PROM_INITIAL_ARGV (INITIAL_STACK_POINTER + 0x80)
296 #define DEC_PROM_STRINGS 0xffffffffbfc20000ULL
297 #define DEC_PROM_TCINFO 0xffffffffbfc2c000ULL
298 #define DEC_MEMMAP_ADDR 0xffffffffbfc30000ULL
299
300 /* HPCmips: */
301 #define MACHINE_HPCMIPS_CASIO_BE300 1
302 #define MACHINE_HPCMIPS_CASIO_E105 2
303 #define MACHINE_HPCMIPS_NEC_MOBILEPRO_770 3
304 #define MACHINE_HPCMIPS_NEC_MOBILEPRO_780 4
305 #define MACHINE_HPCMIPS_NEC_MOBILEPRO_800 5
306 #define MACHINE_HPCMIPS_NEC_MOBILEPRO_880 6
307 #define MACHINE_HPCMIPS_AGENDA_VR3 7
308 #define MACHINE_HPCMIPS_IBM_WORKPAD_Z50 8
309
310 /* Playstation 2: */
311 #define PLAYSTATION2_BDA 0xffffffffa0001000ULL
312 #define PLAYSTATION2_OPTARGS 0xffffffff81fff100ULL
313 #define PLAYSTATION2_SIFBIOS 0xffffffffbfc10000ULL
314
315 /* SGI and ARC: */
316 #define MACHINE_ARC_NEC_RD94 1
317 #define MACHINE_ARC_JAZZ_PICA 2
318 #define MACHINE_ARC_NEC_R94 3
319 #define MACHINE_ARC_DESKTECH_TYNE 4
320 #define MACHINE_ARC_JAZZ_MAGNUM 5
321 #define MACHINE_ARC_NEC_R98 6
322 #define MACHINE_ARC_JAZZ_M700 7
323 #define MACHINE_ARC_NEC_R96 8
324
325 /* EVBMIPS: */
326 #define MACHINE_EVBMIPS_MALTA 1
327 #define MACHINE_EVBMIPS_PB1000 2
328
329 /* MacPPC: TODO: Real model names */
330 #define MACHINE_MACPPC_G4 1
331 #define MACHINE_MACPPC_G5 2
332
333 /* X86: */
334 #define MACHINE_X86_GENERIC 1
335 #define MACHINE_X86_XT 2
336
337
338 /*
339 * Problem: kernels seem to be loaded at low addresses in RAM, so
340 * storing environment strings and memory descriptors there is a bad
341 * idea. They are stored at 0xbfc..... instead. The ARC SPB must
342 * be at physical address 0x1000 though.
343 */
344 #define SGI_SPB_ADDR 0xffffffff80001000ULL
345 /* 0xbfc10000 is firmware callback vector stuff */
346 #define ARC_FIRMWARE_VECTORS 0xffffffffbfc80000ULL
347 #define ARC_FIRMWARE_ENTRIES 0xffffffffbfc88000ULL
348 #define ARC_ARGV_START 0xffffffffbfc90000ULL
349 #define ARC_ENV_STRINGS 0xffffffffbfc98000ULL
350 #define ARC_ENV_POINTERS 0xffffffffbfc9d000ULL
351 #define SGI_SYSID_ADDR 0xffffffffbfca1800ULL
352 #define ARC_DSPSTAT_ADDR 0xffffffffbfca1c00ULL
353 #define ARC_MEMDESC_ADDR 0xffffffffbfca1c80ULL
354 #define ARC_CONFIG_DATA_ADDR 0xffffffffbfca2000ULL
355 #define FIRST_ARC_COMPONENT 0xffffffffbfca8000ULL
356 #define ARC_PRIVATE_VECTORS 0xffffffffbfcb0000ULL
357 #define ARC_PRIVATE_ENTRIES 0xffffffffbfcb8000ULL
358
359
360 /* machine.c: */
361 struct machine *machine_new(char *name, struct emul *emul);
362 int machine_name_to_type(char *stype, char *ssubtype,
363 int *type, int *subtype, int *arch);
364 void machine_add_tickfunction(struct machine *machine,
365 void (*func)(struct cpu *, void *), void *extra, int clockshift);
366 void dump_mem_string(struct cpu *cpu, uint64_t addr);
367 void store_string(struct cpu *cpu, uint64_t addr, char *s);
368 int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64);
369 int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32);
370 int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16);
371 void store_byte(struct cpu *cpu, uint64_t addr, uint8_t data);
372 void store_64bit_word_in_host(struct cpu *cpu, unsigned char *data,
373 uint64_t data32);
374 void store_32bit_word_in_host(struct cpu *cpu, unsigned char *data,
375 uint64_t data32);
376 void store_16bit_word_in_host(struct cpu *cpu, unsigned char *data,
377 uint16_t data16);
378 uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);
379 uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);
380 void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len);
381 void machine_setup(struct machine *);
382 void machine_memsize_fix(struct machine *);
383 void machine_default_cputype(struct machine *);
384 void machine_dumpinfo(struct machine *);
385 void machine_list_available_types_and_cpus(void);
386 void machine_init(void);
387
388
389 #endif /* MACHINE_H */

  ViewVC Help
Powered by ViewVC 1.1.26