/[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 14 by dpavlin, Mon Oct 8 16:18:51 2007 UTC revision 24 by dpavlin, Mon Oct 8 16:19:56 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.78 2005/09/21 19:10:35 debug Exp $   *  $Id: machine.h,v 1.118 2006/06/22 13:22:41 debug Exp $
32   */   */
33    
34  #include <sys/types.h>  #include <sys/types.h>
35  #include <sys/time.h>  #include <sys/time.h>
36    
37    #include "debugger_gdb.h"
38  #include "symbol.h"  #include "symbol.h"
39    
40  #include "machine_arc.h"  #include "machine_arc.h"
41    #include "machine_pmax.h"
42  #include "machine_x86.h"  #include "machine_x86.h"
43    
44    
45  #define MAX_BREAKPOINTS         8  #define MAX_BREAKPOINTS         8
46  #define BREAKPOINT_FLAG_R       1  #define BREAKPOINT_FLAG_R       1
47    
48  #define MAX_TICK_FUNCTIONS      14  #define MAX_TICK_FUNCTIONS      16
49    
50  struct cpu_family;  struct cpu_family;
51  struct diskimage;  struct diskimage;
52  struct emul;  struct emul;
53  struct fb_window;  struct fb_window;
54  struct memory;  struct memory;
55    struct of_data;
56    
57  /*  Ugly:  */  /*  Ugly:  */
58  struct kn230_csr;  struct kn230_csr;
# Line 68  struct sgi_ip20_data; Line 71  struct sgi_ip20_data;
71  struct sgi_ip22_data;  struct sgi_ip22_data;
72  struct sgi_ip30_data;  struct sgi_ip30_data;
73  struct isa_pic_data {  struct isa_pic_data {
74          struct pic8259_data *pic1;          struct pic8259_data     *pic1;
75          struct pic8259_data *pic2;          struct pic8259_data     *pic2;
76            int                     last_int;
77            int                     native_irq;
78  };  };
79    
80    
81  #define MACHINE_NAME_MAXBUF             200  struct machine_bus {
82            struct machine_bus *next;
83    
84            char            *name;
85    
86            void            (*debug_dump)(void *);
87            void            *extra;
88    };
89    
90    
91    #define MACHINE_NAME_MAXBUF             150
92    
93  struct machine {  struct machine {
94          /*  Pointer back to the emul struct we are in:  */          /*  Pointer back to the emul struct we are in:  */
# Line 83  struct machine { Line 98  struct machine {
98          char    *name;          char    *name;
99    
100          int     arch;                   /*  ARCH_MIPS, ARCH_PPC, ..  */          int     arch;                   /*  ARCH_MIPS, ARCH_PPC, ..  */
101          int     machine_type;           /*  MACHINE_DEC, ..  */          int     machine_type;           /*  MACHINE_PMAX, ..  */
102          int     machine_subtype;        /*  MACHINE_DEC_3MAX_5000, ..  */          int     machine_subtype;        /*  MACHINE_DEC_3MAX_5000, ..  */
103    
104            int     cycle_accurate;         /*  Set to non-zero for cycle
105                                                accurate (slow) emulation.  */
106    
107            /*  Name set by code in src/machines/machine_*.c:  */
108          char    *machine_name;          char    *machine_name;
109    
110            int     stable;                 /*  startup warning for non-stable
111                                                emulation modes.  */
112    
113          /*  The serial number is mostly used when emulating multiple machines          /*  The serial number is mostly used when emulating multiple machines
114              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
115              is useful when emulating multiple cards in one machine:  */              is useful when emulating multiple cards in one machine:  */
# Line 114  struct machine { Line 136  struct machine {
136          int     ticks_reset_value[MAX_TICK_FUNCTIONS];          int     ticks_reset_value[MAX_TICK_FUNCTIONS];
137          void    (*tick_func[MAX_TICK_FUNCTIONS])(struct cpu *, void *);          void    (*tick_func[MAX_TICK_FUNCTIONS])(struct cpu *, void *);
138          void    *tick_extra[MAX_TICK_FUNCTIONS];          void    *tick_extra[MAX_TICK_FUNCTIONS];
139            double  tick_hz[MAX_TICK_FUNCTIONS];
140    
141          void    (*md_interrupt)(struct machine *m, struct cpu *cpu,          void    (*md_interrupt)(struct machine *m, struct cpu *cpu,
142                      int irq_nr, int assert);                      int irq_nr, int assert);
# Line 127  struct machine { Line 150  struct machine {
150          int     ncpus;          int     ncpus;
151          struct cpu **cpus;          struct cpu **cpus;
152    
153            /*  Registered busses:  */
154            struct machine_bus *first_bus;
155            int     n_busses;
156    
157          /*  These are used by stuff in cpu.c, mostly:  */          /*  These are used by stuff in cpu.c, mostly:  */
158          int64_t ncycles;          int64_t ncycles;
159          int64_t ncycles_show;          int64_t ncycles_show;
# Line 147  struct machine { Line 174  struct machine {
174          int     register_dump;          int     register_dump;
175          int     arch_pagesize;          int     arch_pagesize;
176    
177            int     bootdev_type;
178            int     bootdev_id;
179            char    *bootstr;
180            char    *bootarg;
181    
182            struct debugger_gdb gdb;
183    
184          int     n_breakpoints;          int     n_breakpoints;
185          char    *breakpoint_string[MAX_BREAKPOINTS];          char    *breakpoint_string[MAX_BREAKPOINTS];
186          uint64_t breakpoint_addr[MAX_BREAKPOINTS];          uint64_t breakpoint_addr[MAX_BREAKPOINTS];
# Line 163  struct machine { Line 197  struct machine {
197    
198          int     dbe_on_nonexistant_memaccess;          int     dbe_on_nonexistant_memaccess;
199          int     dyntrans_alignment_check;          int     dyntrans_alignment_check;
         int     bintrans_enable;  
         int     old_bintrans_enable;  
         int     bintrans_enabled_from_start;  
         int     bintrans_size;  
200          int     instruction_trace;          int     instruction_trace;
         int     single_step_on_bad_addr;  
201          int     show_nr_of_instructions;          int     show_nr_of_instructions;
202          int     show_symbolic_register_names;          int     show_symbolic_register_names;
         int64_t max_instructions;  
203          int     emulated_hz;          int     emulated_hz;
         int     max_random_cycles_per_chunk;  
204          int     speed_tricks;          int     speed_tricks;
205          char    *userland_emul;         /*  NULL for no userland emulation  */          char    *userland_emul;         /*  NULL for no userland emulation  */
206          int     force_netboot;          int     force_netboot;
# Line 191  struct machine { Line 218  struct machine {
218          /*  Machine-dependent: (PROM stuff, etc.)  */          /*  Machine-dependent: (PROM stuff, etc.)  */
219          union {          union {
220                  struct machine_arcbios  arc;                  struct machine_arcbios  arc;
221                    struct machine_pmax     pmax;
222                  struct machine_pc       pc;                  struct machine_pc       pc;
223          } md;          } md;
224    
225            /*  OpenFirmware:  */
226            struct of_data *of_data;
227    
228          /*  Bus-specific interrupt data:  */          /*  Bus-specific interrupt data:  */
229          struct isa_pic_data isa_pic_data;          struct isa_pic_data isa_pic_data;
230    
# Line 216  struct machine { Line 247  struct machine {
247                          struct mace_data *mace_data;                          struct mace_data *mace_data;
248                  } ip32;                  } ip32;
249                  struct footbridge_data *footbridge_data;                  struct footbridge_data *footbridge_data;
250                    struct bebox_data *bebox_data;
251                    struct prep_data *prep_data;
252                    struct cpc700_data *cpc700_data;
253                    struct gc_data *gc_data;
254                    struct v3_data *v3_data;
255          } md_int;          } md_int;
256    
257          /*  X11/framebuffer stuff:  */          /*  X11/framebuffer stuff:  */
258          int     use_x11;          int     use_x11;
259          int     x11_scaledown;          int     x11_scaledown;
260            int     x11_scaleup;
261          int     x11_n_display_names;          int     x11_n_display_names;
262          char    **x11_display_names;          char    **x11_display_names;
263          int     x11_current_display_name_nr;    /*  updated by x11.c  */          int     x11_current_display_name_nr;    /*  updated by x11.c  */
# Line 251  struct machine { Line 288  struct machine {
288  /*  MIPS:  */  /*  MIPS:  */
289  #define MACHINE_BAREMIPS        1000  #define MACHINE_BAREMIPS        1000
290  #define MACHINE_TESTMIPS        1001  #define MACHINE_TESTMIPS        1001
291  #define MACHINE_DEC             1002  #define MACHINE_PMAX            1002
292  #define MACHINE_COBALT          1003  #define MACHINE_COBALT          1003
293  #define MACHINE_HPCMIPS         1004  #define MACHINE_HPCMIPS         1004
294  #define MACHINE_PS2             1005  #define MACHINE_PS2             1005
295  #define MACHINE_SGI             1006  #define MACHINE_SGI             1006
296  #define MACHINE_ARC             1007  #define MACHINE_ARC             1007
297  #define MACHINE_MESHCUBE        1008  #define MACHINE_NETGEAR         1008
298  #define MACHINE_NETGEAR         1009  #define MACHINE_SONYNEWS        1009
299  #define MACHINE_SONYNEWS        1010  #define MACHINE_EVBMIPS         1010
300  #define MACHINE_EVBMIPS         1011  #define MACHINE_PSP             1011
301  #define MACHINE_PSP             1012  #define MACHINE_ALGOR           1012
302    
303  /*  PPC:  */  /*  PPC:  */
304  #define MACHINE_BAREPPC         2000  #define MACHINE_BAREPPC         2000
# Line 273  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_TESTSPARC       3001  #define MACHINE_TESTSPARC       3001
318  #define MACHINE_ULTRA1          3002  #define MACHINE_SPARC           3002
319    
320  /*  Alpha:  */  /*  Alpha:  */
321  #define MACHINE_BAREALPHA       4000  #define MACHINE_BAREALPHA       4000
# Line 298  struct machine { Line 336  struct machine {
336  #define MACHINE_SHARK           6006  #define MACHINE_SHARK           6006
337  #define MACHINE_IQ80321         6007  #define MACHINE_IQ80321         6007
338  #define MACHINE_IYONIX          6008  #define MACHINE_IYONIX          6008
339    #define MACHINE_TS7200          6009
340    
341  /*  IA64:  */  /*  IA64:  */
342  #define MACHINE_BAREIA64        7000  #define MACHINE_BAREIA64        7000
# Line 322  struct machine { Line 361  struct machine {
361    
362  /*  AVR:  */  /*  AVR:  */
363  #define MACHINE_BAREAVR         12000  #define MACHINE_BAREAVR         12000
364    #define MACHINE_AVR_PAL         12001
365    #define MACHINE_AVR_MAHPONG     12002
366    
367  /*  Other "pseudo"-machines:  */  /*  Other "pseudo"-machines:  */
368  #define MACHINE_NONE            0  #define MACHINE_NONE            0
# Line 378  struct machine { Line 419  struct machine {
419  #define MACHINE_ARC_JAZZ_M700           7  #define MACHINE_ARC_JAZZ_M700           7
420  #define MACHINE_ARC_NEC_R96             8  #define MACHINE_ARC_NEC_R96             8
421    
422    /*  Algor:  */
423    #define MACHINE_ALGOR_P4032             4
424    #define MACHINE_ALGOR_P5064             5
425    
426  /*  EVBMIPS:  */  /*  EVBMIPS:  */
427  #define MACHINE_EVBMIPS_MALTA           1  #define MACHINE_EVBMIPS_MALTA           1
428  #define MACHINE_EVBMIPS_MALTA_BE        2  #define MACHINE_EVBMIPS_MALTA_BE        2
429  #define MACHINE_EVBMIPS_PB1000          3  #define MACHINE_EVBMIPS_MESHCUBE        3
430    #define MACHINE_EVBMIPS_PB1000          4
431    
432    /*  PReP:  */
433    #define MACHINE_PREP_IBM6050            1
434    #define MACHINE_PREP_MVME2400           2
435    
436    /*  Sun SPARC:  */
437    #define MACHINE_SPARC_SS5               1
438    #define MACHINE_SPARC_SS20              2
439    #define MACHINE_SPARC_ULTRA1            3
440    #define MACHINE_SPARC_ULTRA60           4
441    
442  /*  MacPPC:  TODO: Real model names  */  /*  MacPPC:  TODO: Real model names  */
443  #define MACHINE_MACPPC_G4               1  #define MACHINE_MACPPC_G3               1
444  #define MACHINE_MACPPC_G5               2  #define MACHINE_MACPPC_G4               2
445    #define MACHINE_MACPPC_G5               3
446    
447    /*  MVMEPPC  */
448    #define MACHINE_MVMEPPC_1600            1
449    #define MACHINE_MVMEPPC_2100            2
450    #define MACHINE_MVMEPPC_5500            3
451    
452  /*  X86:  */  /*  X86:  */
453  #define MACHINE_X86_GENERIC             1  #define MACHINE_X86_GENERIC             1
# Line 414  struct machine { Line 476  struct machine {
476  #define ARC_PRIVATE_ENTRIES     0xffffffffbfcb8000ULL  #define ARC_PRIVATE_ENTRIES     0xffffffffbfcb8000ULL
477    
478    
479    /*  For the automachine system:  */
480    struct machine_entry_subtype {
481            int                     machine_subtype;/*  Old-style subtype  */
482            const char              *name;          /*  Official name  */
483            int                     n_aliases;
484            char                    **aliases;      /*  Aliases  */
485    };
486    
487    struct machine_entry {
488            struct machine_entry    *next;
489    
490            /*  Machine type:  */
491            int                     arch;
492            int                     machine_type;   /*  Old-style type  */
493            const char              *name;          /*  Official name  */
494            int                     n_aliases;
495            char                    **aliases;      /*  Aliases  */
496    
497            void                    (*setup)(struct machine *, struct cpu *);
498            void                    (*set_default_cpu)(struct machine *);
499            void                    (*set_default_ram)(struct machine *);
500    
501            /*  Machine subtypes:  */
502            int                     n_subtypes;
503            struct machine_entry_subtype **subtype;
504    };
505    
506    #define MACHINE_SETUP_TYPE(n)   void (*n)(struct machine *, struct cpu *)
507    #define MACHINE_SETUP(x)        void machine_setup_ ## x(struct machine *machine, \
508                                        struct cpu *cpu)
509    #define MACHINE_DEFAULT_CPU(x)  void machine_default_cpu_ ## x(struct machine *machine)
510    #define MACHINE_DEFAULT_RAM(x)  void machine_default_ram_ ## x(struct machine *machine)
511    #define MACHINE_REGISTER(x)     void machine_register_ ## x(void)
512    #define MR_DEFAULT(x,name,arch,type,n,m) struct machine_entry \
513                *me = machine_entry_new(name,arch,type,n,m);        \
514            me->setup = machine_setup_ ## x;        \
515            me->set_default_cpu = machine_default_cpu_ ## x;
516    void automachine_init(void);
517    
518    
519  /*  machine.c:  */  /*  machine.c:  */
520  struct machine *machine_new(char *name, struct emul *emul);  struct machine *machine_new(char *name, struct emul *emul);
521  int machine_name_to_type(char *stype, char *ssubtype,  int machine_name_to_type(char *stype, char *ssubtype,
522          int *type, int *subtype, int *arch);          int *type, int *subtype, int *arch);
523  void machine_add_tickfunction(struct machine *machine,  void machine_add_tickfunction(struct machine *machine,
524          void (*func)(struct cpu *, void *), void *extra, int clockshift);          void (*func)(struct cpu *, void *), void *extra,
525            int clockshift, double hz);
526    void machine_register(char *name, MACHINE_SETUP_TYPE(setup));
527  void dump_mem_string(struct cpu *cpu, uint64_t addr);  void dump_mem_string(struct cpu *cpu, uint64_t addr);
528  void store_string(struct cpu *cpu, uint64_t addr, char *s);  void store_string(struct cpu *cpu, uint64_t addr, char *s);
529  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 435  void store_16bit_word_in_host(struct cpu Line 539  void store_16bit_word_in_host(struct cpu
539  uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);  uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);
540  uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);  uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);
541  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);
542    void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr);
543    void add_environment_string_dual(struct cpu *cpu,
544            uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2);
545    void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp,
546            uint64_t data, int flag64);
547  void machine_setup(struct machine *);  void machine_setup(struct machine *);
548  void machine_memsize_fix(struct machine *);  void machine_memsize_fix(struct machine *);
549  void machine_default_cputype(struct machine *);  void machine_default_cputype(struct machine *);
550  void machine_dumpinfo(struct machine *);  void machine_dumpinfo(struct machine *);
551    void machine_bus_register(struct machine *, char *busname,
552            void (*debug_dump)(void *), void *extra);
553  void machine_list_available_types_and_cpus(void);  void machine_list_available_types_and_cpus(void);
554    struct machine_entry *machine_entry_new(const char *name,
555            int arch, int oldstyle_type, int n_aliases, int n_subtypes);
556    struct machine_entry_subtype *machine_entry_subtype_new(
557            const char *name, int oldstyle_type, int n_aliases);
558    void machine_entry_add(struct machine_entry *me, int arch);
559  void machine_init(void);  void machine_init(void);
560    
561    

Legend:
Removed from v.14  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26