--- trunk/src/include/machine.h 2007/10/08 16:19:37 22 +++ trunk/src/include/machine.h 2007/10/08 16:20:26 28 @@ -28,23 +28,26 @@ * SUCH DAMAGE. * * - * $Id: machine.h,v 1.105 2006/02/18 13:42:39 debug Exp $ + * $Id: machine.h,v 1.126 2006/07/21 16:55:41 debug Exp $ */ #include #include - +#include "debugger_gdb.h" #include "symbol.h" #include "machine_arc.h" +#include "machine_pmax.h" #include "machine_x86.h" #define MAX_BREAKPOINTS 8 #define BREAKPOINT_FLAG_R 1 -#define MAX_TICK_FUNCTIONS 14 +#define MAX_TICK_FUNCTIONS 16 + +#define MAX_STATISTICS_FIELDS 8 struct cpu_family; struct diskimage; @@ -87,8 +90,6 @@ }; -#define MACHINE_NAME_MAXBUF 150 - struct machine { /* Pointer back to the emul struct we are in: */ struct emul *emul; @@ -100,6 +101,9 @@ int machine_type; /* MACHINE_PMAX, .. */ int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ + int cycle_accurate; /* Set to non-zero for cycle + accurate (slow) emulation. */ + /* Name set by code in src/machines/machine_*.c: */ char *machine_name; @@ -112,6 +116,7 @@ int serial_nr; int nr_of_nics; + /* TODO: How about multiple cpu familys in one machine? */ struct cpu_family *cpu_family; /* @@ -132,6 +137,7 @@ 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]; void (*md_interrupt)(struct machine *m, struct cpu *cpu, int irq_nr, int assert); @@ -150,13 +156,11 @@ int n_busses; /* These are used by stuff in cpu.c, mostly: */ - int64_t ncycles; - int64_t ncycles_show; - int64_t ncycles_flush; - int64_t ncycles_since_gettimeofday; + int64_t ninstrs; + int64_t ninstrs_show; + int64_t ninstrs_flush; + int64_t ninstrs_since_gettimeofday; struct timeval starttime; - int a_few_cycles; - int a_few_instrs; struct diskimage *first_diskimage; @@ -174,6 +178,9 @@ char *bootstr; char *bootarg; + struct debugger_gdb gdb; + + /* Breakpoints: */ int n_breakpoints; char *breakpoint_string[MAX_BREAKPOINTS]; uint64_t breakpoint_addr[MAX_BREAKPOINTS]; @@ -189,35 +196,32 @@ int cache_secondary_linesize; int dbe_on_nonexistant_memaccess; - int dyntrans_alignment_check; - int bintrans_enable; - int old_bintrans_enable; - int bintrans_enabled_from_start; - size_t bintrans_size; int instruction_trace; - int single_step_on_bad_addr; int show_nr_of_instructions; + int show_trace_tree; int show_symbolic_register_names; - int64_t max_instructions; int emulated_hz; - int max_random_cycles_per_chunk; - int speed_tricks; + int allow_instruction_combinations; char *userland_emul; /* NULL for no userland emulation */ int force_netboot; int slow_serial_interrupts_hack_for_linux; uint64_t file_loaded_end_addr; char *boot_kernel_filename; char *boot_string_argument; - int automatic_clock_adjustment; int exit_without_entering_debugger; - int show_trace_tree; - int n_gfx_cards; + /* Instruction statistics: */ + char *statistics_filename; + FILE *statistics_file; + int statistics_enabled; + char *statistics_fields; /* "vpi" etc. */ + /* Machine-dependent: (PROM stuff, etc.) */ union { struct machine_arcbios arc; + struct machine_pmax pmax; struct machine_pc pc; } md; @@ -266,6 +270,10 @@ }; +/* Tick function "prototype": */ +#define DEVICE_TICK(x) void dev_ ## x ## _tick(struct cpu *cpu, void *extra) + + /* * Machine emulation types: */ @@ -283,6 +291,7 @@ #define ARCH_HPPA 10 #define ARCH_I960 11 #define ARCH_AVR 12 +#define ARCH_TRANSPUTER 13 /* MIPS: */ #define MACHINE_BAREMIPS 1000 @@ -293,12 +302,12 @@ #define MACHINE_PS2 1005 #define MACHINE_SGI 1006 #define MACHINE_ARC 1007 -#define MACHINE_MESHCUBE 1008 -#define MACHINE_NETGEAR 1009 -#define MACHINE_SONYNEWS 1010 -#define MACHINE_EVBMIPS 1011 -#define MACHINE_PSP 1012 -#define MACHINE_ALGOR 1013 +#define MACHINE_NETGEAR 1008 +#define MACHINE_SONYNEWS 1009 +#define MACHINE_EVBMIPS 1010 +#define MACHINE_PSP 1011 +#define MACHINE_ALGOR 1012 +#define MACHINE_QEMU_MIPS 1013 /* PPC: */ #define MACHINE_BAREPPC 2000 @@ -315,7 +324,7 @@ /* SPARC: */ #define MACHINE_BARESPARC 3000 #define MACHINE_TESTSPARC 3001 -#define MACHINE_ULTRA1 3002 +#define MACHINE_SPARC 3002 /* Alpha: */ #define MACHINE_BAREALPHA 4000 @@ -361,6 +370,11 @@ /* AVR: */ #define MACHINE_BAREAVR 12000 +#define MACHINE_AVR_PAL 12001 +#define MACHINE_AVR_MAHPONG 12002 + +/* TRANSPUTER: */ +#define MACHINE_BARETRANSPUTER 13000 /* Other "pseudo"-machines: */ #define MACHINE_NONE 0 @@ -402,11 +416,6 @@ #define MACHINE_HPCSH_JORNADA680 1 #define MACHINE_HPCSH_JORNADA690 2 -/* Playstation 2: */ -#define PLAYSTATION2_BDA 0xffffffffa0001000ULL -#define PLAYSTATION2_OPTARGS 0xffffffff81fff100ULL -#define PLAYSTATION2_SIFBIOS 0xffffffffbfc10000ULL - /* SGI and ARC: */ #define MACHINE_ARC_NEC_RD94 1 #define MACHINE_ARC_JAZZ_PICA 2 @@ -424,15 +433,23 @@ /* EVBMIPS: */ #define MACHINE_EVBMIPS_MALTA 1 #define MACHINE_EVBMIPS_MALTA_BE 2 -#define MACHINE_EVBMIPS_PB1000 3 +#define MACHINE_EVBMIPS_MESHCUBE 3 +#define MACHINE_EVBMIPS_PB1000 4 /* PReP: */ #define MACHINE_PREP_IBM6050 1 #define MACHINE_PREP_MVME2400 2 +/* Sun SPARC: */ +#define MACHINE_SPARC_SS5 1 +#define MACHINE_SPARC_SS20 2 +#define MACHINE_SPARC_ULTRA1 3 +#define MACHINE_SPARC_ULTRA60 4 + /* MacPPC: TODO: Real model names */ -#define MACHINE_MACPPC_G4 1 -#define MACHINE_MACPPC_G5 2 +#define MACHINE_MACPPC_G3 1 +#define MACHINE_MACPPC_G4 2 +#define MACHINE_MACPPC_G5 3 /* MVMEPPC */ #define MACHINE_MVMEPPC_1600 1 @@ -444,28 +461,6 @@ #define MACHINE_X86_XT 2 -/* - * Problem: kernels seem to be loaded at low addresses in RAM, so - * storing environment strings and memory descriptors there is a bad - * idea. They are stored at 0xbfc..... instead. The ARC SPB must - * be at physical address 0x1000 though. - */ -#define SGI_SPB_ADDR 0xffffffff80001000ULL -/* 0xbfc10000 is firmware callback vector stuff */ -#define ARC_FIRMWARE_VECTORS 0xffffffffbfc80000ULL -#define ARC_FIRMWARE_ENTRIES 0xffffffffbfc88000ULL -#define ARC_ARGV_START 0xffffffffbfc90000ULL -#define ARC_ENV_STRINGS 0xffffffffbfc98000ULL -#define ARC_ENV_POINTERS 0xffffffffbfc9d000ULL -#define SGI_SYSID_ADDR 0xffffffffbfca1800ULL -#define ARC_DSPSTAT_ADDR 0xffffffffbfca1c00ULL -#define ARC_MEMDESC_ADDR 0xffffffffbfca1c80ULL -#define ARC_CONFIG_DATA_ADDR 0xffffffffbfca2000ULL -#define FIRST_ARC_COMPONENT 0xffffffffbfca8000ULL -#define ARC_PRIVATE_VECTORS 0xffffffffbfcb0000ULL -#define ARC_PRIVATE_ENTRIES 0xffffffffbfcb8000ULL - - /* For the automachine system: */ struct machine_entry_subtype { int machine_subtype;/* Old-style subtype */ @@ -499,10 +494,11 @@ #define MACHINE_DEFAULT_CPU(x) void machine_default_cpu_ ## x(struct machine *machine) #define MACHINE_DEFAULT_RAM(x) void machine_default_ram_ ## x(struct machine *machine) #define MACHINE_REGISTER(x) void machine_register_ ## x(void) -#define MR_DEFAULT(x,name,arch,type,n,m) struct machine_entry \ - *me = machine_entry_new(name,arch,type,n,m); \ - me->setup = machine_setup_ ## x; \ - me->set_default_cpu = machine_default_cpu_ ## x; +#define MR_DEFAULT(x,name,arch,type) struct machine_entry \ + *me = machine_entry_new(name,arch,type); \ + me->setup = machine_setup_ ## x; \ + me->set_default_cpu = machine_default_cpu_ ## x; \ + machine_entry_register(me, arch); void automachine_init(void); @@ -511,7 +507,9 @@ int machine_name_to_type(char *stype, char *ssubtype, int *type, int *subtype, int *arch); void machine_add_tickfunction(struct machine *machine, - void (*func)(struct cpu *, void *), void *extra, int clockshift); + void (*func)(struct cpu *, void *), void *extra, + int clockshift, double hz); +void machine_statistics_init(struct machine *, char *fname); 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); @@ -539,12 +537,14 @@ void machine_dumpinfo(struct machine *); void machine_bus_register(struct machine *, char *busname, void (*debug_dump)(void *), void *extra); +int machine_run(struct machine *machine); void machine_list_available_types_and_cpus(void); struct machine_entry *machine_entry_new(const char *name, - int arch, int oldstyle_type, int n_aliases, int n_subtypes); -struct machine_entry_subtype *machine_entry_subtype_new( - const char *name, int oldstyle_type, int n_aliases); -void machine_entry_add(struct machine_entry *me, int arch); + int arch, int oldstyle_type); +void machine_entry_add_alias(struct machine_entry *me, const char *name); +void machine_entry_add_subtype(struct machine_entry *me, const char *name, + int oldstyle_subtype, ...); +void machine_entry_register(struct machine_entry *me, int arch); void machine_init(void);