--- trunk/src/include/machine.h 2007/10/08 16:22:11 40 +++ trunk/src/include/machine.h 2007/10/08 16:22:32 42 @@ -28,28 +28,19 @@ * SUCH DAMAGE. * * - * $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 $ */ #include -#include #include "symbol.h" -#include "machine_arc.h" -#include "machine_pmax.h" - - -#define MAX_BREAKPOINTS 8 - -#define MAX_TICK_FUNCTIONS 16 - -#define MAX_STATISTICS_FIELDS 8 - struct cpu_family; struct diskimage; struct emul; struct fb_window; +struct machine_arcbios; +struct machine_pmax; struct memory; struct of_data; struct settings; @@ -64,6 +55,36 @@ int last_int; }; +struct breakpoints { + int n; + + /* Arrays, with one element for each entry: */ + char **string; + uint64_t *addr; +}; + +struct tick_functions { + int n_entries; + + /* Arrays, with one element for each entry: */ + int *ticks_till_next; + int *ticks_reset_value; + void (*(*f))(struct cpu *, void *); + void **extra; +}; + +struct x11_md { + /* X11/framebuffer stuff: */ + int in_use; + int scaledown; + int scaleup; + int n_display_names; + char **display_names; + int current_display_name_nr; /* updated by x11.c */ + + int n_fb_windows; + struct fb_window **fb_windows; +}; struct machine { /* Pointer back to the emul struct we are in: */ @@ -82,16 +103,9 @@ int machine_type; /* MACHINE_PMAX, .. */ int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ - /* NOTE/TODO: This isn't working yet: */ - int cycle_accurate; /* Set to non-zero for cycle - accurate (slow) emulation. */ - /* Name set by code in src/machines/machine_*.c: */ char *machine_name; - int stable; /* startup warning for non-stable - emulation modes. */ - /* The serial number is mostly used when emulating multiple machines in a network. nr_of_nics is the current nr of network cards, which is useful when emulating multiple cards in one machine: */ @@ -101,25 +115,12 @@ /* TODO: How about multiple cpu familys in one machine? */ struct cpu_family *cpu_family; - /* - * The "mainbus": - * - * o) memory - * o) devices - * o) CPUs - */ - struct memory *memory; int main_console_handle; - /* Hardware devices, run every x clock cycles. */ - int n_tick_entries; - 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]; + /* Tick functions (e.g. hardware devices): */ + struct tick_functions tick_functions; char *cpu_name; /* TODO: remove this, there could be several cpus with different names in a machine */ @@ -130,14 +131,6 @@ int ncpus; struct cpu **cpus; - /* 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; - struct diskimage *first_diskimage; struct symbol_context symbol_context; @@ -155,26 +148,12 @@ char *bootarg; /* Breakpoints: */ - int n_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; + struct breakpoints breakpoints; - int dbe_on_nonexistant_memaccess; int halt_on_nonexistant_memaccess; int instruction_trace; int show_nr_of_instructions; int show_trace_tree; - int show_symbolic_register_names; int emulated_hz; int allow_instruction_combinations; char *userland_emul; /* NULL for no userland emulation */ @@ -192,27 +171,19 @@ int statistics_enabled; char *statistics_fields; /* "vpi" etc. */ + /* X11/framebuffer stuff (per machine): */ + struct x11_md x11_md; + /* Machine-dependent: (PROM stuff, etc.) */ union { - struct machine_arcbios arc; - struct machine_pmax pmax; + struct machine_arcbios *arc; + struct machine_pmax *pmax; struct of_data *of_data; } md; /* Bus-specific interrupt data: */ /* TODO: Remove! */ 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; }; @@ -231,8 +202,7 @@ #define ARCH_ALPHA 4 #define ARCH_ARM 5 #define ARCH_SH 6 -#define ARCH_AVR 7 -#define ARCH_M88K 8 +#define ARCH_M88K 7 /* MIPS: */ #define MACHINE_BAREMIPS 1000 @@ -243,22 +213,18 @@ #define MACHINE_PS2 1005 #define MACHINE_SGI 1006 #define MACHINE_ARC 1007 -#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 +#define MACHINE_EVBMIPS 1008 +#define MACHINE_ALGOR 1009 +#define MACHINE_QEMU_MIPS 1010 /* PPC: */ #define MACHINE_BAREPPC 2000 #define MACHINE_TESTPPC 2001 #define MACHINE_PMPPC 2002 -#define MACHINE_SANDPOINT 2003 -#define MACHINE_BEBOX 2004 -#define MACHINE_PREP 2005 -#define MACHINE_MACPPC 2006 -#define MACHINE_MVMEPPC 2007 +#define MACHINE_BEBOX 2003 +#define MACHINE_PREP 2004 +#define MACHINE_MACPPC 2005 +#define MACHINE_MVMEPPC 2006 /* SPARC: */ #define MACHINE_BARESPARC 3000 @@ -275,12 +241,9 @@ #define MACHINE_TESTARM 5001 #define MACHINE_CATS 5002 #define MACHINE_HPCARM 5003 -#define MACHINE_ZAURUS 5004 -#define MACHINE_NETWINDER 5005 -#define MACHINE_SHARK 5006 -#define MACHINE_IQ80321 5007 -#define MACHINE_IYONIX 5008 -#define MACHINE_QEMU_ARM 5009 +#define MACHINE_NETWINDER 5004 +#define MACHINE_IQ80321 5005 +#define MACHINE_QEMU_ARM 5006 /* SH: */ #define MACHINE_BARESH 6000 @@ -289,14 +252,10 @@ #define MACHINE_DREAMCAST 6003 #define MACHINE_LANDISK 6004 -/* AVR: */ -#define MACHINE_BAREAVR 7000 -#define MACHINE_AVR_PAL 7001 -#define MACHINE_AVR_MAHPONG 7002 - /* M88K: */ -#define MACHINE_BAREM88K 8000 -#define MACHINE_TESTM88K 8001 +#define MACHINE_BAREM88K 7000 +#define MACHINE_TESTM88K 7001 +#define MACHINE_MVME88K 7002 /* Other "pseudo"-machines: */ #define MACHINE_NONE 0 @@ -339,18 +298,12 @@ #define MACHINE_HPCSH_JORNADA690 2 /* SGI and ARC: */ -#define MACHINE_ARC_NEC_RD94 1 -#define MACHINE_ARC_JAZZ_PICA 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 +#define MACHINE_ARC_JAZZ_PICA 1 +#define MACHINE_ARC_JAZZ_MAGNUM 2 /* Algor: */ -#define MACHINE_ALGOR_P4032 4 -#define MACHINE_ALGOR_P5064 5 +#define MACHINE_ALGOR_P4032 1 +#define MACHINE_ALGOR_P5064 2 /* EVBMIPS: */ #define MACHINE_EVBMIPS_MALTA 1 @@ -377,6 +330,11 @@ #define MACHINE_MVMEPPC_2100 2 #define MACHINE_MVMEPPC_5500 3 +/* MVME88K */ +#define MACHINE_MVME88K_187 1 +#define MACHINE_MVME88K_188 2 +#define MACHINE_MVME88K_197 3 + /* For the automachine system: */ struct machine_entry_subtype { @@ -424,32 +382,11 @@ void machine_destroy(struct machine *machine); int machine_name_to_type(char *stype, char *ssubtype, int *type, int *subtype, int *arch); +void machine_add_breakpoint_string(struct machine *machine, char *str); void machine_add_tickfunction(struct machine *machine, - void (*func)(struct cpu *, void *), void *extra, - int clockshift, double hz); + void (*func)(struct cpu *, void *), void *extra, int clockshift); 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); -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); void machine_setup(struct machine *); void machine_memsize_fix(struct machine *); void machine_default_cputype(struct machine *);