/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (hide annotations)
Mon Oct 8 16:18:00 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 10757 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.707 2005/04/27 16:37:33 debug Exp $
20050408	Some minor updates to the wdc. Linux now doesn't complain
		anymore if a disk is non-present.
20050409	Various minor fixes (a bintrans bug, and some other things).
		The wdc seems to work with Playstation2 emulation, but there
		is a _long_ annoying delay when disks are detected.
		Fixing a really important bintrans bug (when devices and RAM
		are mixed within 4KB pages), which was triggered with
		NetBSD/playstation2 kernels.
20050410	Adding a dummy dev_ps2_ether (just so that NetBSD doesn't
		complain as much during bootup).
		Symbols starting with '$' are now ignored.
		Renaming dev_ps2_ohci.c to dev_ohci.c, etc.
20050411	Moving the bintrans-cache-isolation check from cpu_mips.c to
		cpu_mips_coproc.c. (I thought this would give a speedup, but
		it's not noticable.)
		Better playstation2 sbus interrupt code.
		Skip ahead many ticks if the count register is read manually.
		(This increases the speed of delay-loops that simply read
		the count register.)
20050412	Updates to the playstation2 timer/interrupt code.
		Some other minor updates.
20050413	NetBSD/cobalt runs from a disk image :-) including userland;
		updating the documentation on how to install NetBSD/cobalt
		using NetBSD/pmax (!).
		Some minor bintrans updates (no real speed improvement) and
		other minor updates (playstation2 now uses the -o options).
20050414	Adding a dummy x86 (and AMD64) mode.
20050415	Adding some (32-bit and 16-bit) x86 instructions.
		Adding some initial support for non-SCSI, non-IDE floppy
		images. (The x86 mode can boot from these, more or less.)
		Moving the devices/ and include/ directories to src/devices/
		and src/include/, respectively.
20050416	Continuing on the x86 stuff. (Adding pc_bios.c and some simple
		support for software interrupts in 16-bit mode.)
20050417	Ripping out most of the x86 instruction decoding stuff, trying
		to rewrite it in a cleaner way.
		Disabling some of the least working CPU families in the
		configure script (sparc, x86, alpha, hppa), so that they are
		not enabled by default.
20050418	Trying to fix the bug which caused problems when turning on
		and off bintrans interactively, by flushing the bintrans cache
		whenever bintrans is manually (re)enabled.
20050419	Adding the 'lswi' ppc instruction.
		Minor updates to the x86 instruction decoding.
20050420	Renaming x86 register name indices from R_xx to X86_R_xx (this
		makes building on Tru64 nicer).
20050422	Adding a check for duplicate MIPS TLB entries on tlbwr/tlbwi.
20050427	Adding screenshots to guestoses.html.
		Some minor fixes and testing for the next release.

==============  RELEASE 0.3.2  ==============


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

  ViewVC Help
Powered by ViewVC 1.1.26