/[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 10 by dpavlin, Mon Oct 8 16:18:27 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 2  Line 2 
2  #define MACHINE_H  #define MACHINE_H
3    
4  /*  /*
5   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2006  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.58 2005/06/24 19:15:08 debug Exp $   *  $Id: machine.h,v 1.105 2006/02/18 13:42:39 debug Exp $
32   */   */
33    
34  #include <sys/types.h>  #include <sys/types.h>
35  #include <sys/time.h>  #include <sys/time.h>
36    
37    
38  #include "symbol.h"  #include "symbol.h"
39    
40  #include "arcbios.h"  #include "machine_arc.h"
41  #include "machine_x86.h"  #include "machine_x86.h"
42    
43    
44  #define MAX_BREAKPOINTS         8  #define MAX_BREAKPOINTS         8
45  #define BREAKPOINT_FLAG_R       1  #define BREAKPOINT_FLAG_R       1
46    
# Line 49  struct diskimage; Line 51  struct diskimage;
51  struct emul;  struct emul;
52  struct fb_window;  struct fb_window;
53  struct memory;  struct memory;
54    struct of_data;
55    
56  /*  Ugly:  */  /*  Ugly:  */
57  struct kn230_csr;  struct kn230_csr;
58  struct kn02_csr;  struct kn02_csr;
59  struct dec_ioasic_data;  struct dec_ioasic_data;
60  struct ps2_data;  struct ps2_data;
61    struct footbridge_data;
62  struct dec5800_data;  struct dec5800_data;
63  struct au1x00_ic_data;  struct au1x00_ic_data;
64  struct malta_data;  struct malta_data;
# Line 65  struct mace_data; Line 69  struct mace_data;
69  struct sgi_ip20_data;  struct sgi_ip20_data;
70  struct sgi_ip22_data;  struct sgi_ip22_data;
71  struct sgi_ip30_data;  struct sgi_ip30_data;
72    struct isa_pic_data {
73            struct pic8259_data     *pic1;
74            struct pic8259_data     *pic2;
75            int                     last_int;
76            int                     native_irq;
77    };
78    
79    
80    struct machine_bus {
81            struct machine_bus *next;
82    
83            char            *name;
84    
85            void            (*debug_dump)(void *);
86            void            *extra;
87    };
88    
89  #define MACHINE_NAME_MAXBUF             200  
90    #define MACHINE_NAME_MAXBUF             150
91    
92  struct machine {  struct machine {
93          /*  Pointer back to the emul struct we are in:  */          /*  Pointer back to the emul struct we are in:  */
# Line 76  struct machine { Line 97  struct machine {
97          char    *name;          char    *name;
98    
99          int     arch;                   /*  ARCH_MIPS, ARCH_PPC, ..  */          int     arch;                   /*  ARCH_MIPS, ARCH_PPC, ..  */
100          int     machine_type;           /*  MACHINE_DEC, ..  */          int     machine_type;           /*  MACHINE_PMAX, ..  */
101          int     machine_subtype;        /*  MACHINE_DEC_3MAX_5000, ..  */          int     machine_subtype;        /*  MACHINE_DEC_3MAX_5000, ..  */
102    
103            /*  Name set by code in src/machines/machine_*.c:  */
104          char    *machine_name;          char    *machine_name;
105    
106            int     stable;                 /*  startup warning for non-stable
107                                                emulation modes.  */
108    
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 120  struct machine { Line 145  struct machine {
145          int     ncpus;          int     ncpus;
146          struct cpu **cpus;          struct cpu **cpus;
147    
148            /*  Registered busses:  */
149            struct machine_bus *first_bus;
150            int     n_busses;
151    
152          /*  These are used by stuff in cpu.c, mostly:  */          /*  These are used by stuff in cpu.c, mostly:  */
153          int64_t ncycles;          int64_t ncycles;
154          int64_t ncycles_show;          int64_t ncycles_show;
# Line 138  struct machine { Line 167  struct machine {
167          int     memory_offset_in_mb;          int     memory_offset_in_mb;
168          int     prom_emulation;          int     prom_emulation;
169          int     register_dump;          int     register_dump;
170            int     arch_pagesize;
171    
172            int     bootdev_type;
173            int     bootdev_id;
174            char    *bootstr;
175            char    *bootarg;
176    
177          int     n_breakpoints;          int     n_breakpoints;
178          char    *breakpoint_string[MAX_BREAKPOINTS];          char    *breakpoint_string[MAX_BREAKPOINTS];
# Line 154  struct machine { Line 189  struct machine {
189          int     cache_secondary_linesize;          int     cache_secondary_linesize;
190    
191          int     dbe_on_nonexistant_memaccess;          int     dbe_on_nonexistant_memaccess;
192            int     dyntrans_alignment_check;
193          int     bintrans_enable;          int     bintrans_enable;
194          int     old_bintrans_enable;          int     old_bintrans_enable;
195          int     bintrans_enabled_from_start;          int     bintrans_enabled_from_start;
196          int     bintrans_size;          size_t  bintrans_size;
197          int     instruction_trace;          int     instruction_trace;
198          int     single_step_on_bad_addr;          int     single_step_on_bad_addr;
199          int     show_nr_of_instructions;          int     show_nr_of_instructions;
# Line 185  struct machine { Line 221  struct machine {
221                  struct machine_pc       pc;                  struct machine_pc       pc;
222          } md;          } md;
223    
224            /*  OpenFirmware:  */
225            struct of_data *of_data;
226    
227            /*  Bus-specific interrupt data:  */
228            struct isa_pic_data isa_pic_data;
229    
230          /*  Machine-dependent interrupt specific structs:  */          /*  Machine-dependent interrupt specific structs:  */
231          union {          union {
232                  struct kn230_csr *kn230_csr;                  struct kn230_csr *kn230_csr;
# Line 203  struct machine { Line 245  struct machine {
245                          struct crime_data *crime_data;                          struct crime_data *crime_data;
246                          struct mace_data *mace_data;                          struct mace_data *mace_data;
247                  } ip32;                  } ip32;
248                    struct footbridge_data *footbridge_data;
249                    struct bebox_data *bebox_data;
250                    struct prep_data *prep_data;
251                    struct cpc700_data *cpc700_data;
252                    struct gc_data *gc_data;
253                    struct v3_data *v3_data;
254          } md_int;          } md_int;
255    
256          /*  X11/framebuffer stuff:  */          /*  X11/framebuffer stuff:  */
257          int     use_x11;          int     use_x11;
258          int     x11_scaledown;          int     x11_scaledown;
259            int     x11_scaleup;
260          int     x11_n_display_names;          int     x11_n_display_names;
261          char    **x11_display_names;          char    **x11_display_names;
262          int     x11_current_display_name_nr;    /*  updated by x11.c  */          int     x11_current_display_name_nr;    /*  updated by x11.c  */
# Line 225  struct machine { Line 274  struct machine {
274  #define ARCH_MIPS               1  #define ARCH_MIPS               1
275  #define ARCH_PPC                2  #define ARCH_PPC                2
276  #define ARCH_SPARC              3  #define ARCH_SPARC              3
277  #define ARCH_URISC              4  #define ARCH_ALPHA              4
278  #define ARCH_HPPA               5  #define ARCH_X86                5
279  #define ARCH_ALPHA              6  #define ARCH_ARM                6
280  #define ARCH_X86                7  #define ARCH_IA64               7
281  #define ARCH_ARM                8  #define ARCH_M68K               8
282    #define ARCH_SH                 9
283    #define ARCH_HPPA               10
284    #define ARCH_I960               11
285    #define ARCH_AVR                12
286    
287  /*  MIPS:  */  /*  MIPS:  */
288  #define MACHINE_BAREMIPS        1000  #define MACHINE_BAREMIPS        1000
289  #define MACHINE_TESTMIPS        1001  #define MACHINE_TESTMIPS        1001
290  #define MACHINE_DEC             1002  #define MACHINE_PMAX            1002
291  #define MACHINE_COBALT          1003  #define MACHINE_COBALT          1003
292  #define MACHINE_HPCMIPS         1004  #define MACHINE_HPCMIPS         1004
293  #define MACHINE_PS2             1005  #define MACHINE_PS2             1005
# Line 245  struct machine { Line 298  struct machine {
298  #define MACHINE_SONYNEWS        1010  #define MACHINE_SONYNEWS        1010
299  #define MACHINE_EVBMIPS         1011  #define MACHINE_EVBMIPS         1011
300  #define MACHINE_PSP             1012  #define MACHINE_PSP             1012
301    #define MACHINE_ALGOR           1013
302    
303  /*  PPC:  */  /*  PPC:  */
304  #define MACHINE_BAREPPC         2000  #define MACHINE_BAREPPC         2000
# Line 256  struct machine { Line 310  struct machine {
310  #define MACHINE_PREP            2006  #define MACHINE_PREP            2006
311  #define MACHINE_MACPPC          2007  #define MACHINE_MACPPC          2007
312  #define MACHINE_DB64360         2008  #define MACHINE_DB64360         2008
313    #define MACHINE_MVMEPPC         2009
314    
315  /*  SPARC:  */  /*  SPARC:  */
316  #define MACHINE_BARESPARC       3000  #define MACHINE_BARESPARC       3000
317  #define MACHINE_ULTRA1          3001  #define MACHINE_TESTSPARC       3001
318    #define MACHINE_ULTRA1          3002
 /*  URISC:  */  
 #define MACHINE_BAREURISC       4000  
 #define MACHINE_TESTURISC       4001  
   
 /*  HPPA:  */  
 #define MACHINE_BAREHPPA        5000  
 #define MACHINE_TESTHPPA        5001  
319    
320  /*  Alpha:  */  /*  Alpha:  */
321  #define MACHINE_BAREALPHA       6000  #define MACHINE_BAREALPHA       4000
322  #define MACHINE_TESTALPHA       6001  #define MACHINE_TESTALPHA       4001
323    #define MACHINE_ALPHA           4002
324    
325  /*  X86:  */  /*  X86:  */
326  #define MACHINE_BAREX86         7000  #define MACHINE_BAREX86         5000
327  #define MACHINE_X86             7001  #define MACHINE_X86             5001
328    
329  /*  ARM:  */  /*  ARM:  */
330  #define MACHINE_BAREARM         8000  #define MACHINE_BAREARM         6000
331  #define MACHINE_TESTARM         8001  #define MACHINE_TESTARM         6001
332    #define MACHINE_CATS            6002
333    #define MACHINE_HPCARM          6003
334    #define MACHINE_ZAURUS          6004
335    #define MACHINE_NETWINDER       6005
336    #define MACHINE_SHARK           6006
337    #define MACHINE_IQ80321         6007
338    #define MACHINE_IYONIX          6008
339    #define MACHINE_TS7200          6009
340    
341    /*  IA64:  */
342    #define MACHINE_BAREIA64        7000
343    #define MACHINE_TESTIA64        7001
344    
345    /*  M68K:  */
346    #define MACHINE_BAREM68K        8000
347    #define MACHINE_TESTM68K        8001
348    
349    /*  SH:  */
350    #define MACHINE_BARESH          9000
351    #define MACHINE_TESTSH          9001
352    #define MACHINE_HPCSH           9002
353    
354    /*  HPPA:  */
355    #define MACHINE_BAREHPPA        10000
356    #define MACHINE_TESTHPPA        10001
357    
358    /*  I960:  */
359    #define MACHINE_BAREI960        11000
360    #define MACHINE_TESTI960        11001
361    
362    /*  AVR:  */
363    #define MACHINE_BAREAVR         12000
364    
365  /*  Other "pseudo"-machines:  */  /*  Other "pseudo"-machines:  */
366  #define MACHINE_NONE            0  #define MACHINE_NONE            0
# Line 313  struct machine { Line 394  struct machine {
394  #define MACHINE_HPCMIPS_AGENDA_VR3              7  #define MACHINE_HPCMIPS_AGENDA_VR3              7
395  #define MACHINE_HPCMIPS_IBM_WORKPAD_Z50         8  #define MACHINE_HPCMIPS_IBM_WORKPAD_Z50         8
396    
397    /*  HPCarm:  */
398    #define MACHINE_HPCARM_IPAQ                     1
399    #define MACHINE_HPCARM_JORNADA720               2
400    
401    /*  HPCsh:  */
402    #define MACHINE_HPCSH_JORNADA680                1
403    #define MACHINE_HPCSH_JORNADA690                2
404    
405  /*  Playstation 2:  */  /*  Playstation 2:  */
406  #define PLAYSTATION2_BDA        0xffffffffa0001000ULL  #define PLAYSTATION2_BDA        0xffffffffa0001000ULL
407  #define PLAYSTATION2_OPTARGS    0xffffffff81fff100ULL  #define PLAYSTATION2_OPTARGS    0xffffffff81fff100ULL
# Line 328  struct machine { Line 417  struct machine {
417  #define MACHINE_ARC_JAZZ_M700           7  #define MACHINE_ARC_JAZZ_M700           7
418  #define MACHINE_ARC_NEC_R96             8  #define MACHINE_ARC_NEC_R96             8
419    
420    /*  Algor:  */
421    #define MACHINE_ALGOR_P4032             4
422    #define MACHINE_ALGOR_P5064             5
423    
424  /*  EVBMIPS:  */  /*  EVBMIPS:  */
425  #define MACHINE_EVBMIPS_MALTA           1  #define MACHINE_EVBMIPS_MALTA           1
426  #define MACHINE_EVBMIPS_PB1000          2  #define MACHINE_EVBMIPS_MALTA_BE        2
427    #define MACHINE_EVBMIPS_PB1000          3
428    
429    /*  PReP:  */
430    #define MACHINE_PREP_IBM6050            1
431    #define MACHINE_PREP_MVME2400           2
432    
433  /*  MacPPC:  TODO: Real model names  */  /*  MacPPC:  TODO: Real model names  */
434  #define MACHINE_MACPPC_G4               1  #define MACHINE_MACPPC_G4               1
435  #define MACHINE_MACPPC_G5               2  #define MACHINE_MACPPC_G5               2
436    
437    /*  MVMEPPC  */
438    #define MACHINE_MVMEPPC_1600            1
439    #define MACHINE_MVMEPPC_2100            2
440    #define MACHINE_MVMEPPC_5500            3
441    
442  /*  X86:  */  /*  X86:  */
443  #define MACHINE_X86_GENERIC             1  #define MACHINE_X86_GENERIC             1
444  #define MACHINE_X86_XT                  2  #define MACHINE_X86_XT                  2
# Line 363  struct machine { Line 466  struct machine {
466  #define ARC_PRIVATE_ENTRIES     0xffffffffbfcb8000ULL  #define ARC_PRIVATE_ENTRIES     0xffffffffbfcb8000ULL
467    
468    
469    /*  For the automachine system:  */
470    struct machine_entry_subtype {
471            int                     machine_subtype;/*  Old-style subtype  */
472            const char              *name;          /*  Official name  */
473            int                     n_aliases;
474            char                    **aliases;      /*  Aliases  */
475    };
476    
477    struct machine_entry {
478            struct machine_entry    *next;
479    
480            /*  Machine type:  */
481            int                     arch;
482            int                     machine_type;   /*  Old-style type  */
483            const char              *name;          /*  Official name  */
484            int                     n_aliases;
485            char                    **aliases;      /*  Aliases  */
486    
487            void                    (*setup)(struct machine *, struct cpu *);
488            void                    (*set_default_cpu)(struct machine *);
489            void                    (*set_default_ram)(struct machine *);
490    
491            /*  Machine subtypes:  */
492            int                     n_subtypes;
493            struct machine_entry_subtype **subtype;
494    };
495    
496    #define MACHINE_SETUP_TYPE(n)   void (*n)(struct machine *, struct cpu *)
497    #define MACHINE_SETUP(x)        void machine_setup_ ## x(struct machine *machine, \
498                                        struct cpu *cpu)
499    #define MACHINE_DEFAULT_CPU(x)  void machine_default_cpu_ ## x(struct machine *machine)
500    #define MACHINE_DEFAULT_RAM(x)  void machine_default_ram_ ## x(struct machine *machine)
501    #define MACHINE_REGISTER(x)     void machine_register_ ## x(void)
502    #define MR_DEFAULT(x,name,arch,type,n,m) struct machine_entry \
503                *me = machine_entry_new(name,arch,type,n,m);        \
504            me->setup = machine_setup_ ## x;        \
505            me->set_default_cpu = machine_default_cpu_ ## x;
506    void automachine_init(void);
507    
508    
509  /*  machine.c:  */  /*  machine.c:  */
510  struct machine *machine_new(char *name, struct emul *emul);  struct machine *machine_new(char *name, struct emul *emul);
511  int machine_name_to_type(char *stype, char *ssubtype,  int machine_name_to_type(char *stype, char *ssubtype,
512          int *type, int *subtype, int *arch);          int *type, int *subtype, int *arch);
513  void machine_add_tickfunction(struct machine *machine,  void machine_add_tickfunction(struct machine *machine,
514          void (*func)(struct cpu *, void *), void *extra, int clockshift);          void (*func)(struct cpu *, void *), void *extra, int clockshift);
515    void machine_register(char *name, MACHINE_SETUP_TYPE(setup));
516  void dump_mem_string(struct cpu *cpu, uint64_t addr);  void dump_mem_string(struct cpu *cpu, uint64_t addr);
517  void store_string(struct cpu *cpu, uint64_t addr, char *s);  void store_string(struct cpu *cpu, uint64_t addr, char *s);
518  int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64);  int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64);
# Line 384  void store_16bit_word_in_host(struct cpu Line 528  void store_16bit_word_in_host(struct cpu
528  uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);  uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);
529  uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);  uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);
530  void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len);  void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len);
531    void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr);
532    void add_environment_string_dual(struct cpu *cpu,
533            uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2);
534    void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp,
535            uint64_t data, int flag64);
536  void machine_setup(struct machine *);  void machine_setup(struct machine *);
537  void machine_memsize_fix(struct machine *);  void machine_memsize_fix(struct machine *);
538  void machine_default_cputype(struct machine *);  void machine_default_cputype(struct machine *);
539  void machine_dumpinfo(struct machine *);  void machine_dumpinfo(struct machine *);
540    void machine_bus_register(struct machine *, char *busname,
541            void (*debug_dump)(void *), void *extra);
542  void machine_list_available_types_and_cpus(void);  void machine_list_available_types_and_cpus(void);
543    struct machine_entry *machine_entry_new(const char *name,
544            int arch, int oldstyle_type, int n_aliases, int n_subtypes);
545    struct machine_entry_subtype *machine_entry_subtype_new(
546            const char *name, int oldstyle_type, int n_aliases);
547    void machine_entry_add(struct machine_entry *me, int arch);
548  void machine_init(void);  void machine_init(void);
549    
550    

Legend:
Removed from v.10  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26