2 |
#define MACHINE_H |
#define MACHINE_H |
3 |
|
|
4 |
/* |
/* |
5 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2006 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.86 2005/11/22 02:07:40 debug Exp $ |
* $Id: machine.h,v 1.105 2006/02/18 13:42:39 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include <sys/types.h> |
#include <sys/types.h> |
35 |
#include <sys/time.h> |
#include <sys/time.h> |
36 |
|
|
37 |
|
|
38 |
#include "symbol.h" |
#include "symbol.h" |
39 |
|
|
40 |
#include "machine_arc.h" |
#include "machine_arc.h" |
51 |
struct emul; |
struct emul; |
52 |
struct fb_window; |
struct fb_window; |
53 |
struct memory; |
struct memory; |
54 |
|
struct of_data; |
55 |
|
|
56 |
/* Ugly: */ |
/* Ugly: */ |
57 |
struct kn230_csr; |
struct kn230_csr; |
77 |
}; |
}; |
78 |
|
|
79 |
|
|
80 |
|
struct machine_bus { |
81 |
|
struct machine_bus *next; |
82 |
|
|
83 |
|
char *name; |
84 |
|
|
85 |
|
void (*debug_dump)(void *); |
86 |
|
void *extra; |
87 |
|
}; |
88 |
|
|
89 |
|
|
90 |
#define MACHINE_NAME_MAXBUF 150 |
#define MACHINE_NAME_MAXBUF 150 |
91 |
|
|
92 |
struct machine { |
struct machine { |
97 |
char *name; |
char *name; |
98 |
|
|
99 |
int arch; /* ARCH_MIPS, ARCH_PPC, .. */ |
int arch; /* ARCH_MIPS, ARCH_PPC, .. */ |
100 |
int machine_type; /* MACHINE_DEC, .. */ |
int machine_type; /* MACHINE_PMAX, .. */ |
101 |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ |
102 |
|
|
103 |
|
/* Name set by code in src/machines/machine_*.c: */ |
104 |
char *machine_name; |
char *machine_name; |
105 |
|
|
106 |
|
int stable; /* startup warning for non-stable |
107 |
|
emulation modes. */ |
108 |
|
|
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: */ |
145 |
int ncpus; |
int ncpus; |
146 |
struct cpu **cpus; |
struct cpu **cpus; |
147 |
|
|
148 |
|
/* Registered busses: */ |
149 |
|
struct machine_bus *first_bus; |
150 |
|
int n_busses; |
151 |
|
|
152 |
/* These are used by stuff in cpu.c, mostly: */ |
/* These are used by stuff in cpu.c, mostly: */ |
153 |
int64_t ncycles; |
int64_t ncycles; |
154 |
int64_t ncycles_show; |
int64_t ncycles_show; |
169 |
int register_dump; |
int register_dump; |
170 |
int arch_pagesize; |
int arch_pagesize; |
171 |
|
|
172 |
|
int bootdev_type; |
173 |
|
int bootdev_id; |
174 |
|
char *bootstr; |
175 |
|
char *bootarg; |
176 |
|
|
177 |
int n_breakpoints; |
int n_breakpoints; |
178 |
char *breakpoint_string[MAX_BREAKPOINTS]; |
char *breakpoint_string[MAX_BREAKPOINTS]; |
179 |
uint64_t breakpoint_addr[MAX_BREAKPOINTS]; |
uint64_t breakpoint_addr[MAX_BREAKPOINTS]; |
193 |
int bintrans_enable; |
int bintrans_enable; |
194 |
int old_bintrans_enable; |
int old_bintrans_enable; |
195 |
int bintrans_enabled_from_start; |
int bintrans_enabled_from_start; |
196 |
int bintrans_size; |
size_t bintrans_size; |
197 |
int instruction_trace; |
int instruction_trace; |
198 |
int single_step_on_bad_addr; |
int single_step_on_bad_addr; |
199 |
int show_nr_of_instructions; |
int show_nr_of_instructions; |
221 |
struct machine_pc pc; |
struct machine_pc pc; |
222 |
} md; |
} md; |
223 |
|
|
224 |
|
/* OpenFirmware: */ |
225 |
|
struct of_data *of_data; |
226 |
|
|
227 |
/* Bus-specific interrupt data: */ |
/* Bus-specific interrupt data: */ |
228 |
struct isa_pic_data isa_pic_data; |
struct isa_pic_data isa_pic_data; |
229 |
|
|
249 |
struct bebox_data *bebox_data; |
struct bebox_data *bebox_data; |
250 |
struct prep_data *prep_data; |
struct prep_data *prep_data; |
251 |
struct cpc700_data *cpc700_data; |
struct cpc700_data *cpc700_data; |
252 |
|
struct gc_data *gc_data; |
253 |
|
struct v3_data *v3_data; |
254 |
} md_int; |
} md_int; |
255 |
|
|
256 |
/* X11/framebuffer stuff: */ |
/* X11/framebuffer stuff: */ |
283 |
#define ARCH_HPPA 10 |
#define ARCH_HPPA 10 |
284 |
#define ARCH_I960 11 |
#define ARCH_I960 11 |
285 |
#define ARCH_AVR 12 |
#define ARCH_AVR 12 |
|
#define ARCH_NEWMIPS 13 |
|
286 |
|
|
287 |
/* MIPS: */ |
/* MIPS: */ |
288 |
#define MACHINE_BAREMIPS 1000 |
#define MACHINE_BAREMIPS 1000 |
289 |
#define MACHINE_TESTMIPS 1001 |
#define MACHINE_TESTMIPS 1001 |
290 |
#define MACHINE_DEC 1002 |
#define MACHINE_PMAX 1002 |
291 |
#define MACHINE_COBALT 1003 |
#define MACHINE_COBALT 1003 |
292 |
#define MACHINE_HPCMIPS 1004 |
#define MACHINE_HPCMIPS 1004 |
293 |
#define MACHINE_PS2 1005 |
#define MACHINE_PS2 1005 |
310 |
#define MACHINE_PREP 2006 |
#define MACHINE_PREP 2006 |
311 |
#define MACHINE_MACPPC 2007 |
#define MACHINE_MACPPC 2007 |
312 |
#define MACHINE_DB64360 2008 |
#define MACHINE_DB64360 2008 |
313 |
|
#define MACHINE_MVMEPPC 2009 |
314 |
|
|
315 |
/* SPARC: */ |
/* SPARC: */ |
316 |
#define MACHINE_BARESPARC 3000 |
#define MACHINE_BARESPARC 3000 |
336 |
#define MACHINE_SHARK 6006 |
#define MACHINE_SHARK 6006 |
337 |
#define MACHINE_IQ80321 6007 |
#define MACHINE_IQ80321 6007 |
338 |
#define MACHINE_IYONIX 6008 |
#define MACHINE_IYONIX 6008 |
339 |
|
#define MACHINE_TS7200 6009 |
340 |
|
|
341 |
/* IA64: */ |
/* IA64: */ |
342 |
#define MACHINE_BAREIA64 7000 |
#define MACHINE_BAREIA64 7000 |
362 |
/* AVR: */ |
/* AVR: */ |
363 |
#define MACHINE_BAREAVR 12000 |
#define MACHINE_BAREAVR 12000 |
364 |
|
|
|
/* NEWMIPS: */ |
|
|
#define MACHINE_BARENEWMIPS 13000 |
|
|
#define MACHINE_TESTNEWMIPS 13001 |
|
|
|
|
365 |
/* Other "pseudo"-machines: */ |
/* Other "pseudo"-machines: */ |
366 |
#define MACHINE_NONE 0 |
#define MACHINE_NONE 0 |
367 |
#define MACHINE_USERLAND 100000 |
#define MACHINE_USERLAND 100000 |
426 |
#define MACHINE_EVBMIPS_MALTA_BE 2 |
#define MACHINE_EVBMIPS_MALTA_BE 2 |
427 |
#define MACHINE_EVBMIPS_PB1000 3 |
#define MACHINE_EVBMIPS_PB1000 3 |
428 |
|
|
429 |
|
/* PReP: */ |
430 |
|
#define MACHINE_PREP_IBM6050 1 |
431 |
|
#define MACHINE_PREP_MVME2400 2 |
432 |
|
|
433 |
/* MacPPC: TODO: Real model names */ |
/* MacPPC: TODO: Real model names */ |
434 |
#define MACHINE_MACPPC_G4 1 |
#define MACHINE_MACPPC_G4 1 |
435 |
#define MACHINE_MACPPC_G5 2 |
#define MACHINE_MACPPC_G5 2 |
436 |
|
|
437 |
|
/* MVMEPPC */ |
438 |
|
#define MACHINE_MVMEPPC_1600 1 |
439 |
|
#define MACHINE_MVMEPPC_2100 2 |
440 |
|
#define MACHINE_MVMEPPC_5500 3 |
441 |
|
|
442 |
/* X86: */ |
/* X86: */ |
443 |
#define MACHINE_X86_GENERIC 1 |
#define MACHINE_X86_GENERIC 1 |
444 |
#define MACHINE_X86_XT 2 |
#define MACHINE_X86_XT 2 |
466 |
#define ARC_PRIVATE_ENTRIES 0xffffffffbfcb8000ULL |
#define ARC_PRIVATE_ENTRIES 0xffffffffbfcb8000ULL |
467 |
|
|
468 |
|
|
469 |
|
/* For the automachine system: */ |
470 |
|
struct machine_entry_subtype { |
471 |
|
int machine_subtype;/* Old-style subtype */ |
472 |
|
const char *name; /* Official name */ |
473 |
|
int n_aliases; |
474 |
|
char **aliases; /* Aliases */ |
475 |
|
}; |
476 |
|
|
477 |
|
struct machine_entry { |
478 |
|
struct machine_entry *next; |
479 |
|
|
480 |
|
/* Machine type: */ |
481 |
|
int arch; |
482 |
|
int machine_type; /* Old-style type */ |
483 |
|
const char *name; /* Official name */ |
484 |
|
int n_aliases; |
485 |
|
char **aliases; /* Aliases */ |
486 |
|
|
487 |
|
void (*setup)(struct machine *, struct cpu *); |
488 |
|
void (*set_default_cpu)(struct machine *); |
489 |
|
void (*set_default_ram)(struct machine *); |
490 |
|
|
491 |
|
/* Machine subtypes: */ |
492 |
|
int n_subtypes; |
493 |
|
struct machine_entry_subtype **subtype; |
494 |
|
}; |
495 |
|
|
496 |
|
#define MACHINE_SETUP_TYPE(n) void (*n)(struct machine *, struct cpu *) |
497 |
|
#define MACHINE_SETUP(x) void machine_setup_ ## x(struct machine *machine, \ |
498 |
|
struct cpu *cpu) |
499 |
|
#define MACHINE_DEFAULT_CPU(x) void machine_default_cpu_ ## x(struct machine *machine) |
500 |
|
#define MACHINE_DEFAULT_RAM(x) void machine_default_ram_ ## x(struct machine *machine) |
501 |
|
#define MACHINE_REGISTER(x) void machine_register_ ## x(void) |
502 |
|
#define MR_DEFAULT(x,name,arch,type,n,m) struct machine_entry \ |
503 |
|
*me = machine_entry_new(name,arch,type,n,m); \ |
504 |
|
me->setup = machine_setup_ ## x; \ |
505 |
|
me->set_default_cpu = machine_default_cpu_ ## x; |
506 |
|
void automachine_init(void); |
507 |
|
|
508 |
|
|
509 |
/* machine.c: */ |
/* machine.c: */ |
510 |
struct machine *machine_new(char *name, struct emul *emul); |
struct machine *machine_new(char *name, struct emul *emul); |
511 |
int machine_name_to_type(char *stype, char *ssubtype, |
int machine_name_to_type(char *stype, char *ssubtype, |
512 |
int *type, int *subtype, int *arch); |
int *type, int *subtype, int *arch); |
513 |
void machine_add_tickfunction(struct machine *machine, |
void machine_add_tickfunction(struct machine *machine, |
514 |
void (*func)(struct cpu *, void *), void *extra, int clockshift); |
void (*func)(struct cpu *, void *), void *extra, int clockshift); |
515 |
|
void machine_register(char *name, MACHINE_SETUP_TYPE(setup)); |
516 |
void dump_mem_string(struct cpu *cpu, uint64_t addr); |
void dump_mem_string(struct cpu *cpu, uint64_t addr); |
517 |
void store_string(struct cpu *cpu, uint64_t addr, char *s); |
void store_string(struct cpu *cpu, uint64_t addr, char *s); |
518 |
int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64); |
int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64); |
528 |
uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr); |
uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr); |
529 |
uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr); |
uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr); |
530 |
void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len); |
void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len); |
531 |
|
void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr); |
532 |
|
void add_environment_string_dual(struct cpu *cpu, |
533 |
|
uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2); |
534 |
|
void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp, |
535 |
|
uint64_t data, int flag64); |
536 |
void machine_setup(struct machine *); |
void machine_setup(struct machine *); |
537 |
void machine_memsize_fix(struct machine *); |
void machine_memsize_fix(struct machine *); |
538 |
void machine_default_cputype(struct machine *); |
void machine_default_cputype(struct machine *); |
539 |
void machine_dumpinfo(struct machine *); |
void machine_dumpinfo(struct machine *); |
540 |
|
void machine_bus_register(struct machine *, char *busname, |
541 |
|
void (*debug_dump)(void *), void *extra); |
542 |
void machine_list_available_types_and_cpus(void); |
void machine_list_available_types_and_cpus(void); |
543 |
|
struct machine_entry *machine_entry_new(const char *name, |
544 |
|
int arch, int oldstyle_type, int n_aliases, int n_subtypes); |
545 |
|
struct machine_entry_subtype *machine_entry_subtype_new( |
546 |
|
const char *name, int oldstyle_type, int n_aliases); |
547 |
|
void machine_entry_add(struct machine_entry *me, int arch); |
548 |
void machine_init(void); |
void machine_init(void); |
549 |
|
|
550 |
|
|