--- trunk/src/include/machine.h 2007/10/08 16:20:26 28 +++ trunk/src/include/machine.h 2007/10/08 16:21:53 38 @@ -2,7 +2,7 @@ #define MACHINE_H /* - * Copyright (C) 2005-2006 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -28,22 +28,19 @@ * SUCH DAMAGE. * * - * $Id: machine.h,v 1.126 2006/07/21 16:55:41 debug Exp $ + * $Id: machine.h,v 1.160 2007/04/10 17:26:20 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 16 @@ -55,38 +52,16 @@ struct fb_window; struct memory; struct of_data; +struct settings; -/* Ugly: */ -struct kn230_csr; -struct kn02_csr; -struct dec_ioasic_data; -struct ps2_data; -struct footbridge_data; -struct dec5800_data; -struct au1x00_ic_data; -struct malta_data; -struct vr41xx_data; -struct jazz_data; -struct crime_data; -struct mace_data; -struct sgi_ip20_data; -struct sgi_ip22_data; -struct sgi_ip30_data; + +/* TODO: This should probably go away... */ struct isa_pic_data { struct pic8259_data *pic1; struct pic8259_data *pic2; - int last_int; - int native_irq; -}; - - -struct machine_bus { - struct machine_bus *next; - char *name; - - void (*debug_dump)(void *); - void *extra; + int *pending_timer_interrupts; + int last_int; }; @@ -94,13 +69,20 @@ /* Pointer back to the emul struct we are in: */ struct emul *emul; + /* Settings: */ + struct settings *settings; + /* Name as choosen by the user: */ char *name; + /* Full "path" to the machine, e.g. "emul[0].machine[0]": */ + char *path; + int arch; /* ARCH_MIPS, ARCH_PPC, .. */ 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. */ @@ -139,9 +121,6 @@ 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); - char *cpu_name; /* TODO: remove this, there could be several cpus with different names in a machine */ int byte_order_override; @@ -151,11 +130,8 @@ int ncpus; struct cpu **cpus; - /* Registered busses: */ - struct machine_bus *first_bus; - int n_busses; - /* 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; @@ -178,8 +154,6 @@ char *bootstr; char *bootarg; - struct debugger_gdb gdb; - /* Breakpoints: */ int n_breakpoints; char *breakpoint_string[MAX_BREAKPOINTS]; @@ -187,7 +161,7 @@ int breakpoint_flags[MAX_BREAKPOINTS]; /* Cache sizes: (1 << x) x=0 for default values */ - /* TODO: these are _PER CPU_! */ + /* TODO: these should be _PER CPU_! */ int cache_picache; int cache_pdcache; int cache_secondary; @@ -196,6 +170,7 @@ int cache_secondary_linesize; int dbe_on_nonexistant_memaccess; + int halt_on_nonexistant_memaccess; int instruction_trace; int show_nr_of_instructions; int show_trace_tree; @@ -208,7 +183,6 @@ uint64_t file_loaded_end_addr; char *boot_kernel_filename; char *boot_string_argument; - int automatic_clock_adjustment; int exit_without_entering_debugger; int n_gfx_cards; @@ -222,41 +196,13 @@ union { struct machine_arcbios arc; struct machine_pmax pmax; - struct machine_pc pc; + struct of_data *of_data; } md; - /* OpenFirmware: */ - struct of_data *of_data; - /* Bus-specific interrupt data: */ + /* TODO: Remove! */ struct isa_pic_data isa_pic_data; - /* Machine-dependent interrupt specific structs: */ - union { - struct kn230_csr *kn230_csr; - struct kn02_csr *kn02_csr; - struct dec_ioasic_data *dec_ioasic_data; - struct ps2_data *ps2_data; - struct dec5800_data *dec5800_csr; - struct au1x00_ic_data *au1x00_ic_data; - struct vr41xx_data *vr41xx_data; - struct jazz_data *jazz_data; - struct malta_data *malta_data; - struct sgi_ip20_data *sgi_ip20_data; - struct sgi_ip22_data *sgi_ip22_data; - struct sgi_ip30_data *sgi_ip30_data; - struct { - struct crime_data *crime_data; - struct mace_data *mace_data; - } ip32; - struct footbridge_data *footbridge_data; - struct bebox_data *bebox_data; - struct prep_data *prep_data; - struct cpc700_data *cpc700_data; - struct gc_data *gc_data; - struct v3_data *v3_data; - } md_int; - /* X11/framebuffer stuff: */ int use_x11; int x11_scaledown; @@ -283,15 +229,10 @@ #define ARCH_PPC 2 #define ARCH_SPARC 3 #define ARCH_ALPHA 4 -#define ARCH_X86 5 -#define ARCH_ARM 6 -#define ARCH_IA64 7 -#define ARCH_M68K 8 -#define ARCH_SH 9 -#define ARCH_HPPA 10 -#define ARCH_I960 11 -#define ARCH_AVR 12 -#define ARCH_TRANSPUTER 13 +#define ARCH_ARM 5 +#define ARCH_M68K 6 +#define ARCH_SH 7 +#define ARCH_AVR 8 /* MIPS: */ #define MACHINE_BAREMIPS 1000 @@ -312,14 +253,12 @@ /* PPC: */ #define MACHINE_BAREPPC 2000 #define MACHINE_TESTPPC 2001 -#define MACHINE_WALNUT 2002 -#define MACHINE_PMPPC 2003 -#define MACHINE_SANDPOINT 2004 -#define MACHINE_BEBOX 2005 -#define MACHINE_PREP 2006 -#define MACHINE_MACPPC 2007 -#define MACHINE_DB64360 2008 -#define MACHINE_MVMEPPC 2009 +#define MACHINE_PMPPC 2002 +#define MACHINE_SANDPOINT 2003 +#define MACHINE_BEBOX 2004 +#define MACHINE_PREP 2005 +#define MACHINE_MACPPC 2006 +#define MACHINE_MVMEPPC 2007 /* SPARC: */ #define MACHINE_BARESPARC 3000 @@ -331,50 +270,33 @@ #define MACHINE_TESTALPHA 4001 #define MACHINE_ALPHA 4002 -/* X86: */ -#define MACHINE_BAREX86 5000 -#define MACHINE_X86 5001 - /* ARM: */ -#define MACHINE_BAREARM 6000 -#define MACHINE_TESTARM 6001 -#define MACHINE_CATS 6002 -#define MACHINE_HPCARM 6003 -#define MACHINE_ZAURUS 6004 -#define MACHINE_NETWINDER 6005 -#define MACHINE_SHARK 6006 -#define MACHINE_IQ80321 6007 -#define MACHINE_IYONIX 6008 -#define MACHINE_TS7200 6009 - -/* IA64: */ -#define MACHINE_BAREIA64 7000 -#define MACHINE_TESTIA64 7001 +#define MACHINE_BAREARM 5000 +#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 /* M68K: */ -#define MACHINE_BAREM68K 8000 -#define MACHINE_TESTM68K 8001 +#define MACHINE_BAREM68K 6000 +#define MACHINE_TESTM68K 6001 /* SH: */ -#define MACHINE_BARESH 9000 -#define MACHINE_TESTSH 9001 -#define MACHINE_HPCSH 9002 - -/* HPPA: */ -#define MACHINE_BAREHPPA 10000 -#define MACHINE_TESTHPPA 10001 - -/* I960: */ -#define MACHINE_BAREI960 11000 -#define MACHINE_TESTI960 11001 +#define MACHINE_BARESH 7000 +#define MACHINE_TESTSH 7001 +#define MACHINE_HPCSH 7002 +#define MACHINE_DREAMCAST 7003 +#define MACHINE_LANDISK 7004 /* AVR: */ -#define MACHINE_BAREAVR 12000 -#define MACHINE_AVR_PAL 12001 -#define MACHINE_AVR_MAHPONG 12002 - -/* TRANSPUTER: */ -#define MACHINE_BARETRANSPUTER 13000 +#define MACHINE_BAREAVR 8000 +#define MACHINE_AVR_PAL 8001 +#define MACHINE_AVR_MAHPONG 8002 /* Other "pseudo"-machines: */ #define MACHINE_NONE 0 @@ -433,8 +355,6 @@ /* EVBMIPS: */ #define MACHINE_EVBMIPS_MALTA 1 #define MACHINE_EVBMIPS_MALTA_BE 2 -#define MACHINE_EVBMIPS_MESHCUBE 3 -#define MACHINE_EVBMIPS_PB1000 4 /* PReP: */ #define MACHINE_PREP_IBM6050 1 @@ -445,6 +365,7 @@ #define MACHINE_SPARC_SS20 2 #define MACHINE_SPARC_ULTRA1 3 #define MACHINE_SPARC_ULTRA60 4 +#define MACHINE_SPARC_SUN4V 5 /* MacPPC: TODO: Real model names */ #define MACHINE_MACPPC_G3 1 @@ -456,10 +377,6 @@ #define MACHINE_MVMEPPC_2100 2 #define MACHINE_MVMEPPC_5500 3 -/* X86: */ -#define MACHINE_X86_GENERIC 1 -#define MACHINE_X86_XT 2 - /* For the automachine system: */ struct machine_entry_subtype { @@ -503,7 +420,8 @@ /* machine.c: */ -struct machine *machine_new(char *name, struct emul *emul); +struct machine *machine_new(char *name, struct emul *emul, int id); +void machine_destroy(struct machine *machine); int machine_name_to_type(char *stype, char *ssubtype, int *type, int *subtype, int *arch); void machine_add_tickfunction(struct machine *machine, @@ -523,6 +441,7 @@ 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); @@ -535,8 +454,6 @@ void machine_memsize_fix(struct machine *); void machine_default_cputype(struct machine *); 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,