--- trunk/src/include/machine.h 2007/10/08 16:18:27 10 +++ trunk/src/include/machine.h 2007/10/08 16:19:37 22 @@ -2,7 +2,7 @@ #define MACHINE_H /* - * Copyright (C) 2005 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2006 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,17 +28,19 @@ * SUCH DAMAGE. * * - * $Id: machine.h,v 1.58 2005/06/24 19:15:08 debug Exp $ + * $Id: machine.h,v 1.105 2006/02/18 13:42:39 debug Exp $ */ #include #include + #include "symbol.h" -#include "arcbios.h" +#include "machine_arc.h" #include "machine_x86.h" + #define MAX_BREAKPOINTS 8 #define BREAKPOINT_FLAG_R 1 @@ -49,12 +51,14 @@ struct emul; struct fb_window; struct memory; +struct of_data; /* 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; @@ -65,8 +69,25 @@ struct sgi_ip20_data; struct sgi_ip22_data; struct sgi_ip30_data; +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; +}; -#define MACHINE_NAME_MAXBUF 200 + +#define MACHINE_NAME_MAXBUF 150 struct machine { /* Pointer back to the emul struct we are in: */ @@ -76,11 +97,15 @@ char *name; int arch; /* ARCH_MIPS, ARCH_PPC, .. */ - int machine_type; /* MACHINE_DEC, .. */ + int machine_type; /* MACHINE_PMAX, .. */ int machine_subtype; /* MACHINE_DEC_3MAX_5000, .. */ + /* 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: */ @@ -120,6 +145,10 @@ int ncpus; struct cpu **cpus; + /* Registered busses: */ + struct machine_bus *first_bus; + int n_busses; + /* These are used by stuff in cpu.c, mostly: */ int64_t ncycles; int64_t ncycles_show; @@ -138,6 +167,12 @@ int memory_offset_in_mb; int prom_emulation; int register_dump; + int arch_pagesize; + + int bootdev_type; + int bootdev_id; + char *bootstr; + char *bootarg; int n_breakpoints; char *breakpoint_string[MAX_BREAKPOINTS]; @@ -154,10 +189,11 @@ 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; - int bintrans_size; + size_t bintrans_size; int instruction_trace; int single_step_on_bad_addr; int show_nr_of_instructions; @@ -185,6 +221,12 @@ struct machine_pc pc; } md; + /* OpenFirmware: */ + struct of_data *of_data; + + /* Bus-specific interrupt data: */ + struct isa_pic_data isa_pic_data; + /* Machine-dependent interrupt specific structs: */ union { struct kn230_csr *kn230_csr; @@ -203,11 +245,18 @@ 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; + int x11_scaleup; int x11_n_display_names; char **x11_display_names; int x11_current_display_name_nr; /* updated by x11.c */ @@ -225,16 +274,20 @@ #define ARCH_MIPS 1 #define ARCH_PPC 2 #define ARCH_SPARC 3 -#define ARCH_URISC 4 -#define ARCH_HPPA 5 -#define ARCH_ALPHA 6 -#define ARCH_X86 7 -#define ARCH_ARM 8 +#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 /* MIPS: */ #define MACHINE_BAREMIPS 1000 #define MACHINE_TESTMIPS 1001 -#define MACHINE_DEC 1002 +#define MACHINE_PMAX 1002 #define MACHINE_COBALT 1003 #define MACHINE_HPCMIPS 1004 #define MACHINE_PS2 1005 @@ -245,6 +298,7 @@ #define MACHINE_SONYNEWS 1010 #define MACHINE_EVBMIPS 1011 #define MACHINE_PSP 1012 +#define MACHINE_ALGOR 1013 /* PPC: */ #define MACHINE_BAREPPC 2000 @@ -256,30 +310,57 @@ #define MACHINE_PREP 2006 #define MACHINE_MACPPC 2007 #define MACHINE_DB64360 2008 +#define MACHINE_MVMEPPC 2009 /* SPARC: */ #define MACHINE_BARESPARC 3000 -#define MACHINE_ULTRA1 3001 - -/* URISC: */ -#define MACHINE_BAREURISC 4000 -#define MACHINE_TESTURISC 4001 - -/* HPPA: */ -#define MACHINE_BAREHPPA 5000 -#define MACHINE_TESTHPPA 5001 +#define MACHINE_TESTSPARC 3001 +#define MACHINE_ULTRA1 3002 /* Alpha: */ -#define MACHINE_BAREALPHA 6000 -#define MACHINE_TESTALPHA 6001 +#define MACHINE_BAREALPHA 4000 +#define MACHINE_TESTALPHA 4001 +#define MACHINE_ALPHA 4002 /* X86: */ -#define MACHINE_BAREX86 7000 -#define MACHINE_X86 7001 +#define MACHINE_BAREX86 5000 +#define MACHINE_X86 5001 /* ARM: */ -#define MACHINE_BAREARM 8000 -#define MACHINE_TESTARM 8001 +#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 + +/* M68K: */ +#define MACHINE_BAREM68K 8000 +#define MACHINE_TESTM68K 8001 + +/* 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 + +/* AVR: */ +#define MACHINE_BAREAVR 12000 /* Other "pseudo"-machines: */ #define MACHINE_NONE 0 @@ -313,6 +394,14 @@ #define MACHINE_HPCMIPS_AGENDA_VR3 7 #define MACHINE_HPCMIPS_IBM_WORKPAD_Z50 8 +/* HPCarm: */ +#define MACHINE_HPCARM_IPAQ 1 +#define MACHINE_HPCARM_JORNADA720 2 + +/* HPCsh: */ +#define MACHINE_HPCSH_JORNADA680 1 +#define MACHINE_HPCSH_JORNADA690 2 + /* Playstation 2: */ #define PLAYSTATION2_BDA 0xffffffffa0001000ULL #define PLAYSTATION2_OPTARGS 0xffffffff81fff100ULL @@ -328,14 +417,28 @@ #define MACHINE_ARC_JAZZ_M700 7 #define MACHINE_ARC_NEC_R96 8 +/* Algor: */ +#define MACHINE_ALGOR_P4032 4 +#define MACHINE_ALGOR_P5064 5 + /* EVBMIPS: */ #define MACHINE_EVBMIPS_MALTA 1 -#define MACHINE_EVBMIPS_PB1000 2 +#define MACHINE_EVBMIPS_MALTA_BE 2 +#define MACHINE_EVBMIPS_PB1000 3 + +/* PReP: */ +#define MACHINE_PREP_IBM6050 1 +#define MACHINE_PREP_MVME2400 2 /* MacPPC: TODO: Real model names */ #define MACHINE_MACPPC_G4 1 #define MACHINE_MACPPC_G5 2 +/* MVMEPPC */ +#define MACHINE_MVMEPPC_1600 1 +#define MACHINE_MVMEPPC_2100 2 +#define MACHINE_MVMEPPC_5500 3 + /* X86: */ #define MACHINE_X86_GENERIC 1 #define MACHINE_X86_XT 2 @@ -363,12 +466,53 @@ #define ARC_PRIVATE_ENTRIES 0xffffffffbfcb8000ULL +/* For the automachine system: */ +struct machine_entry_subtype { + int machine_subtype;/* Old-style subtype */ + const char *name; /* Official name */ + int n_aliases; + char **aliases; /* Aliases */ +}; + +struct machine_entry { + struct machine_entry *next; + + /* Machine type: */ + int arch; + int machine_type; /* Old-style type */ + const char *name; /* Official name */ + int n_aliases; + char **aliases; /* Aliases */ + + void (*setup)(struct machine *, struct cpu *); + void (*set_default_cpu)(struct machine *); + void (*set_default_ram)(struct machine *); + + /* Machine subtypes: */ + int n_subtypes; + struct machine_entry_subtype **subtype; +}; + +#define MACHINE_SETUP_TYPE(n) void (*n)(struct machine *, struct cpu *) +#define MACHINE_SETUP(x) void machine_setup_ ## x(struct machine *machine, \ + struct cpu *cpu) +#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; +void automachine_init(void); + + /* machine.c: */ struct machine *machine_new(char *name, struct emul *emul); 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 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); @@ -384,11 +528,23 @@ 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 *); void machine_dumpinfo(struct machine *); +void machine_bus_register(struct machine *, char *busname, + void (*debug_dump)(void *), void *extra); 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); void machine_init(void);