/[gxemul]/trunk/src/include/machine.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/include/machine.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 2  Line 2 
2  #define MACHINE_H  #define MACHINE_H
3    
4  /*  /*
5   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2007  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:
# Line 28  Line 28 
28   *  SUCH DAMAGE.   *  SUCH DAMAGE.
29   *   *
30   *   *
31   *  $Id: machine.h,v 1.136 2006/10/25 09:24:06 debug Exp $   *  $Id: machine.h,v 1.179 2007/06/15 17:02:39 debug Exp $
32   */   */
33    
34  #include <sys/types.h>  #include <sys/types.h>
 #include <sys/time.h>  
35    
 #include "debugger_gdb.h"  
36  #include "symbol.h"  #include "symbol.h"
37    
 #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  
   
 #define MAX_STATISTICS_FIELDS   8  
   
38  struct cpu_family;  struct cpu_family;
39  struct diskimage;  struct diskimage;
40  struct emul;  struct emul;
41  struct fb_window;  struct fb_window;
42    struct machine_arcbios;
43    struct machine_pmax;
44  struct memory;  struct memory;
45  struct of_data;  struct of_data;
46  struct settings;  struct settings;
47    
 /*  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;  
48    
49    /*  TODO: This should probably go away...  */
50  struct isa_pic_data {  struct isa_pic_data {
51          struct pic8259_data     *pic1;          struct pic8259_data     *pic1;
52          struct pic8259_data     *pic2;          struct pic8259_data     *pic2;
53    
54          int                     *pending_timer_interrupts;          int                     *pending_timer_interrupts;
55          int                     last_int;          int                     last_int;
   
         int                     native_irq;  
         int                     native_secondary_irq;  
         uint8_t                 secondary_mask1;  
56  };  };
57    
58    struct breakpoints {
59            int             n;
60    
61  struct machine_bus {          /*  Arrays, with one element for each entry:  */
62          struct machine_bus *next;          char            **string;
63            uint64_t        *addr;
64    };
65    
66          char            *name;  struct tick_functions {
67            int     n_entries;
68    
69          void            (*debug_dump)(void *);          /*  Arrays, with one element for each entry:  */
70          void            *extra;          int     *ticks_till_next;
71            int     *ticks_reset_value;
72            void    (*(*f))(struct cpu *, void *);
73            void    **extra;
74  };  };
75    
76    struct x11_md {
77            /*  X11/framebuffer stuff:  */
78            int     in_use;
79            int     scaledown;
80            int     scaleup;
81            int     n_display_names;
82            char    **display_names;
83            int     current_display_name_nr;        /*  updated by x11.c  */
84    
85            int     n_fb_windows;
86            struct fb_window **fb_windows;
87    };
88    
89  struct machine {  struct machine {
90          /*  Pointer back to the emul struct we are in:  */          /*  Pointer back to the emul struct we are in:  */
# Line 107  struct machine { Line 96  struct machine {
96          /*  Name as choosen by the user:  */          /*  Name as choosen by the user:  */
97          char    *name;          char    *name;
98    
99            /*  Full "path" to the machine, e.g. "emul[0].machine[0]":  */
100            char    *path;
101    
102          int     arch;                   /*  ARCH_MIPS, ARCH_PPC, ..  */          int     arch;                   /*  ARCH_MIPS, ARCH_PPC, ..  */
103          int     machine_type;           /*  MACHINE_PMAX, ..  */          int     machine_type;           /*  MACHINE_PMAX, ..  */
104          int     machine_subtype;        /*  MACHINE_DEC_3MAX_5000, ..  */          int     machine_subtype;        /*  MACHINE_DEC_3MAX_5000, ..  */
105    
         int     cycle_accurate;         /*  Set to non-zero for cycle  
                                             accurate (slow) emulation.  */  
   
106          /*  Name set by code in src/machines/machine_*.c:  */          /*  Name set by code in src/machines/machine_*.c:  */
107          char    *machine_name;          char    *machine_name;
108    
         int     stable;                 /*  startup warning for non-stable  
                                             emulation modes.  */  
   
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:  */
# Line 129  struct machine { Line 115  struct machine {
115          /*  TODO: How about multiple cpu familys in one machine?  */          /*  TODO: How about multiple cpu familys in one machine?  */
116          struct cpu_family *cpu_family;          struct cpu_family *cpu_family;
117    
         /*  
          *  The "mainbus":  
          *  
          *      o)  memory  
          *      o)  devices  
          *      o)  CPUs  
          */  
   
118          struct memory *memory;          struct memory *memory;
119    
120          int     main_console_handle;          int     main_console_handle;
121    
122          /*  Hardware devices, run every x clock cycles.  */          /*  Tick functions (e.g. hardware devices):  */
123          int     n_tick_entries;          struct tick_functions tick_functions;
         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];  
   
         void    (*md_interrupt)(struct machine *m, struct cpu *cpu,  
                     int irq_nr, int assert);  
124    
125          char    *cpu_name;  /*  TODO: remove this, there could be several          char    *cpu_name;  /*  TODO: remove this, there could be several
126                                  cpus with different names in a machine  */                                  cpus with different names in a machine  */
# Line 161  struct machine { Line 131  struct machine {
131          int     ncpus;          int     ncpus;
132          struct cpu **cpus;          struct cpu **cpus;
133    
         /*  Registered busses:  */  
         struct machine_bus *first_bus;  
         int     n_busses;  
   
         /*  These are used by stuff in cpu.c, mostly:  */  
         int64_t ninstrs;  
         int64_t ninstrs_show;  
         int64_t ninstrs_flush;  
         int64_t ninstrs_since_gettimeofday;  
         struct timeval starttime;  
   
134          struct diskimage *first_diskimage;          struct diskimage *first_diskimage;
135    
136          struct symbol_context symbol_context;          struct symbol_context symbol_context;
# Line 188  struct machine { Line 147  struct machine {
147          char    *bootstr;          char    *bootstr;
148          char    *bootarg;          char    *bootarg;
149    
         struct debugger_gdb gdb;  
   
150          /*  Breakpoints:  */          /*  Breakpoints:  */
151          int     n_breakpoints;          struct breakpoints 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 are _PER CPU_!  */  
         int     cache_picache;  
         int     cache_pdcache;  
         int     cache_secondary;  
         int     cache_picache_linesize;  
         int     cache_pdcache_linesize;  
         int     cache_secondary_linesize;  
152    
153          int     dbe_on_nonexistant_memaccess;          int     halt_on_nonexistant_memaccess;
154          int     instruction_trace;          int     instruction_trace;
155          int     show_nr_of_instructions;          int     show_nr_of_instructions;
156          int     show_trace_tree;          int     show_trace_tree;
         int     show_symbolic_register_names;  
157          int     emulated_hz;          int     emulated_hz;
158          int     allow_instruction_combinations;          int     allow_instruction_combinations;
159          char    *userland_emul;         /*  NULL for no userland emulation  */          char    *userland_emul;         /*  NULL for no userland emulation  */
# Line 227  struct machine { Line 171  struct machine {
171          int     statistics_enabled;          int     statistics_enabled;
172          char    *statistics_fields;     /*  "vpi" etc.  */          char    *statistics_fields;     /*  "vpi" etc.  */
173    
174            /*  X11/framebuffer stuff (per machine):  */
175            struct x11_md x11_md;
176    
177          /*  Machine-dependent: (PROM stuff, etc.)  */          /*  Machine-dependent: (PROM stuff, etc.)  */
178          union {          union {
179                  struct machine_arcbios  arc;                  struct machine_arcbios  *arc;
180                  struct machine_pmax     pmax;                  struct machine_pmax     *pmax;
181                  struct machine_pc       pc;                  struct of_data          *of_data;
182          } md;          } md;
183    
         /*  OpenFirmware:  */  
         struct of_data *of_data;  
   
184          /*  Bus-specific interrupt data:  */          /*  Bus-specific interrupt data:  */
185            /*  TODO: Remove!  */
186          struct isa_pic_data isa_pic_data;          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;  
         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;  
187  };  };
188    
189    
# Line 292  struct machine { Line 200  struct machine {
200  #define ARCH_PPC                2  #define ARCH_PPC                2
201  #define ARCH_SPARC              3  #define ARCH_SPARC              3
202  #define ARCH_ALPHA              4  #define ARCH_ALPHA              4
203  #define ARCH_X86                5  #define ARCH_ARM                5
204  #define ARCH_ARM                6  #define ARCH_SH                 6
205  #define ARCH_IA64               7  #define ARCH_M88K               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_RCA180X            14  
 #define ARCH_AVR32              15  
206    
207  /*  MIPS:  */  /*  MIPS:  */
208  #define MACHINE_BAREMIPS        1000  #define MACHINE_BAREMIPS        1000
# Line 313  struct machine { Line 213  struct machine {
213  #define MACHINE_PS2             1005  #define MACHINE_PS2             1005
214  #define MACHINE_SGI             1006  #define MACHINE_SGI             1006
215  #define MACHINE_ARC             1007  #define MACHINE_ARC             1007
216  #define MACHINE_NETGEAR         1008  #define MACHINE_EVBMIPS         1008
217  #define MACHINE_SONYNEWS        1009  #define MACHINE_ALGOR           1009
218  #define MACHINE_EVBMIPS         1010  #define MACHINE_QEMU_MIPS       1010
 #define MACHINE_PSP             1011  
 #define MACHINE_ALGOR           1012  
 #define MACHINE_QEMU_MIPS       1013  
219    
220  /*  PPC:  */  /*  PPC:  */
221  #define MACHINE_BAREPPC         2000  #define MACHINE_BAREPPC         2000
222  #define MACHINE_TESTPPC         2001  #define MACHINE_TESTPPC         2001
223  #define MACHINE_WALNUT          2002  #define MACHINE_PMPPC           2002
224  #define MACHINE_PMPPC           2003  #define MACHINE_BEBOX           2003
225  #define MACHINE_SANDPOINT       2004  #define MACHINE_PREP            2004
226  #define MACHINE_BEBOX           2005  #define MACHINE_MACPPC          2005
227  #define MACHINE_PREP            2006  #define MACHINE_MVMEPPC         2006
 #define MACHINE_MACPPC          2007  
 #define MACHINE_DB64360         2008  
 #define MACHINE_MVMEPPC         2009  
228    
229  /*  SPARC:  */  /*  SPARC:  */
230  #define MACHINE_BARESPARC       3000  #define MACHINE_BARESPARC       3000
# Line 342  struct machine { Line 236  struct machine {
236  #define MACHINE_TESTALPHA       4001  #define MACHINE_TESTALPHA       4001
237  #define MACHINE_ALPHA           4002  #define MACHINE_ALPHA           4002
238    
 /*  X86:  */  
 #define MACHINE_BAREX86         5000  
 #define MACHINE_X86             5001  
   
239  /*  ARM:  */  /*  ARM:  */
240  #define MACHINE_BAREARM         6000  #define MACHINE_BAREARM         5000
241  #define MACHINE_TESTARM         6001  #define MACHINE_TESTARM         5001
242  #define MACHINE_CATS            6002  #define MACHINE_CATS            5002
243  #define MACHINE_HPCARM          6003  #define MACHINE_HPCARM          5003
244  #define MACHINE_ZAURUS          6004  #define MACHINE_NETWINDER       5004
245  #define MACHINE_NETWINDER       6005  #define MACHINE_IQ80321         5005
246  #define MACHINE_SHARK           6006  #define MACHINE_QEMU_ARM        5006
 #define MACHINE_IQ80321         6007  
 #define MACHINE_IYONIX          6008  
 #define MACHINE_TS7200          6009  
 #define MACHINE_QEMU_ARM        6010  
   
 /*  IA64:  */  
 #define MACHINE_BAREIA64        7000  
 #define MACHINE_TESTIA64        7001  
   
 /*  M68K:  */  
 #define MACHINE_BAREM68K        8000  
 #define MACHINE_TESTM68K        8001  
247    
248  /*  SH:  */  /*  SH:  */
249  #define MACHINE_BARESH          9000  #define MACHINE_BARESH          6000
250  #define MACHINE_TESTSH          9001  #define MACHINE_TESTSH          6001
251  #define MACHINE_HPCSH           9002  #define MACHINE_HPCSH           6002
252  #define MACHINE_DREAMCAST       9003  #define MACHINE_DREAMCAST       6003
253    #define MACHINE_LANDISK         6004
254  /*  HPPA:  */  
255  #define MACHINE_BAREHPPA        10000  /*  M88K:  */
256  #define MACHINE_TESTHPPA        10001  #define MACHINE_BAREM88K        7000
257    #define MACHINE_TESTM88K        7001
258  /*  I960:  */  #define MACHINE_MVME88K         7002
 #define MACHINE_BAREI960        11000  
 #define MACHINE_TESTI960        11001  
   
 /*  AVR:  */  
 #define MACHINE_BAREAVR         12000  
 #define MACHINE_AVR_PAL         12001  
 #define MACHINE_AVR_MAHPONG     12002  
   
 /*  TRANSPUTER:  */  
 #define MACHINE_BARETRANSPUTER  13000  
   
 /*  ARCH_RCA180X:  */  
 #define MACHINE_BARE180X        14000  
 #define MACHINE_CHIP8           14001  
   
 /*  AVR32:  */  
 #define MACHINE_BAREAVR32       15000  
 #define MACHINE_TESTAVR32       15001  
259    
260  /*  Other "pseudo"-machines:  */  /*  Other "pseudo"-machines:  */
261  #define MACHINE_NONE            0  #define MACHINE_NONE            0
# Line 438  struct machine { Line 298  struct machine {
298  #define MACHINE_HPCSH_JORNADA690                2  #define MACHINE_HPCSH_JORNADA690                2
299    
300  /*  SGI and ARC:  */  /*  SGI and ARC:  */
301  #define MACHINE_ARC_NEC_RD94            1  #define MACHINE_ARC_JAZZ_PICA           1
302  #define MACHINE_ARC_JAZZ_PICA           2  #define MACHINE_ARC_JAZZ_MAGNUM         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  
303    
304  /*  Algor:  */  /*  Algor:  */
305  #define MACHINE_ALGOR_P4032             4  #define MACHINE_ALGOR_P4032             1
306  #define MACHINE_ALGOR_P5064             5  #define MACHINE_ALGOR_P5064             2
307    
308  /*  EVBMIPS:  */  /*  EVBMIPS:  */
309  #define MACHINE_EVBMIPS_MALTA           1  #define MACHINE_EVBMIPS_MALTA           1
310  #define MACHINE_EVBMIPS_MALTA_BE        2  #define MACHINE_EVBMIPS_MALTA_BE        2
 #define MACHINE_EVBMIPS_MESHCUBE        3  
 #define MACHINE_EVBMIPS_PB1000          4  
311    
312  /*  PReP:  */  /*  PReP:  */
313  #define MACHINE_PREP_IBM6050            1  #define MACHINE_PREP_IBM6050            1
# Line 466  struct machine { Line 318  struct machine {
318  #define MACHINE_SPARC_SS20              2  #define MACHINE_SPARC_SS20              2
319  #define MACHINE_SPARC_ULTRA1            3  #define MACHINE_SPARC_ULTRA1            3
320  #define MACHINE_SPARC_ULTRA60           4  #define MACHINE_SPARC_ULTRA60           4
321    #define MACHINE_SPARC_SUN4V             5
322    
323  /*  MacPPC:  TODO: Real model names  */  /*  MacPPC:  TODO: Real model names  */
324  #define MACHINE_MACPPC_G3               1  #define MACHINE_MACPPC_G3               1
# Line 477  struct machine { Line 330  struct machine {
330  #define MACHINE_MVMEPPC_2100            2  #define MACHINE_MVMEPPC_2100            2
331  #define MACHINE_MVMEPPC_5500            3  #define MACHINE_MVMEPPC_5500            3
332    
333  /*  X86:  */  /*  MVME88K  */
334  #define MACHINE_X86_GENERIC             1  #define MACHINE_MVME88K_187             1
335  #define MACHINE_X86_XT                  2  #define MACHINE_MVME88K_188             2
336    #define MACHINE_MVME88K_197             3
337    
338    
339  /*  For the automachine system:  */  /*  For the automachine system:  */
# Line 524  void automachine_init(void); Line 378  void automachine_init(void);
378    
379    
380  /*  machine.c:  */  /*  machine.c:  */
381  struct machine *machine_new(char *name, struct emul *emul);  struct machine *machine_new(char *name, struct emul *emul, int id);
382  void machine_destroy(struct machine *machine);  void machine_destroy(struct machine *machine);
383  int machine_name_to_type(char *stype, char *ssubtype,  int machine_name_to_type(char *stype, char *ssubtype,
384          int *type, int *subtype, int *arch);          int *type, int *subtype, int *arch);
385    void machine_add_breakpoint_string(struct machine *machine, char *str);
386  void machine_add_tickfunction(struct machine *machine,  void machine_add_tickfunction(struct machine *machine,
387          void (*func)(struct cpu *, void *), void *extra,          void (*func)(struct cpu *, void *), void *extra, int clockshift);
         int clockshift, double hz);  
388  void machine_statistics_init(struct machine *, char *fname);  void machine_statistics_init(struct machine *, char *fname);
389  void machine_register(char *name, MACHINE_SETUP_TYPE(setup));  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);  
390  void machine_setup(struct machine *);  void machine_setup(struct machine *);
391  void machine_memsize_fix(struct machine *);  void machine_memsize_fix(struct machine *);
392  void machine_default_cputype(struct machine *);  void machine_default_cputype(struct machine *);
393  void machine_dumpinfo(struct machine *);  void machine_dumpinfo(struct machine *);
 void machine_bus_register(struct machine *, char *busname,  
         void (*debug_dump)(void *), void *extra);  
394  int machine_run(struct machine *machine);  int machine_run(struct machine *machine);
395  void machine_list_available_types_and_cpus(void);  void machine_list_available_types_and_cpus(void);
396  struct machine_entry *machine_entry_new(const char *name,  struct machine_entry *machine_entry_new(const char *name,

Legend:
Removed from v.32  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26