/[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 26 by dpavlin, Mon Oct 8 16:20:10 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.120 2006/06/24 19:52:28 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 "arcbios.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;
59  struct kn02_csr;  struct kn02_csr;
60  struct dec_ioasic_data;  struct dec_ioasic_data;
61  struct ps2_data;  struct ps2_data;
62    struct footbridge_data;
63  struct dec5800_data;  struct dec5800_data;
64  struct au1x00_ic_data;  struct au1x00_ic_data;
65  struct malta_data;  struct malta_data;
# Line 65  struct mace_data; Line 70  struct mace_data;
70  struct sgi_ip20_data;  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 {
74            struct pic8259_data     *pic1;
75            struct pic8259_data     *pic2;
76            int                     last_int;
77            int                     native_irq;
78    };
79    
80    
81    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             200  #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 76  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 107  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 120  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 138  struct machine { Line 172  struct machine {
172          int     memory_offset_in_mb;          int     memory_offset_in_mb;
173          int     prom_emulation;          int     prom_emulation;
174          int     register_dump;          int     register_dump;
175            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];
# Line 154  struct machine { Line 196  struct machine {
196          int     cache_secondary_linesize;          int     cache_secondary_linesize;
197    
198          int     dbe_on_nonexistant_memaccess;          int     dbe_on_nonexistant_memaccess;
199          int     bintrans_enable;          int     dyntrans_alignment_check;
         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 182  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:  */
229            struct isa_pic_data isa_pic_data;
230    
231          /*  Machine-dependent interrupt specific structs:  */          /*  Machine-dependent interrupt specific structs:  */
232          union {          union {
233                  struct kn230_csr *kn230_csr;                  struct kn230_csr *kn230_csr;
# Line 203  struct machine { Line 246  struct machine {
246                          struct crime_data *crime_data;                          struct crime_data *crime_data;
247                          struct mace_data *mace_data;                          struct mace_data *mace_data;
248                  } ip32;                  } ip32;
249                    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 225  struct machine { Line 275  struct machine {
275  #define ARCH_MIPS               1  #define ARCH_MIPS               1
276  #define ARCH_PPC                2  #define ARCH_PPC                2
277  #define ARCH_SPARC              3  #define ARCH_SPARC              3
278  #define ARCH_URISC              4  #define ARCH_ALPHA              4
279  #define ARCH_HPPA               5  #define ARCH_X86                5
280  #define ARCH_ALPHA              6  #define ARCH_ARM                6
281  #define ARCH_X86                7  #define ARCH_IA64               7
282  #define ARCH_ARM                8  #define ARCH_M68K               8
283    #define ARCH_SH                 9
284    #define ARCH_HPPA               10
285    #define ARCH_I960               11
286    #define ARCH_AVR                12
287    
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 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_SPARC           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    #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 313  struct machine { Line 396  struct machine {
396  #define MACHINE_HPCMIPS_AGENDA_VR3              7  #define MACHINE_HPCMIPS_AGENDA_VR3              7
397  #define MACHINE_HPCMIPS_IBM_WORKPAD_Z50         8  #define MACHINE_HPCMIPS_IBM_WORKPAD_Z50         8
398    
399    /*  HPCarm:  */
400    #define MACHINE_HPCARM_IPAQ                     1
401    #define MACHINE_HPCARM_JORNADA720               2
402    
403    /*  HPCsh:  */
404    #define MACHINE_HPCSH_JORNADA680                1
405    #define MACHINE_HPCSH_JORNADA690                2
406    
407  /*  Playstation 2:  */  /*  Playstation 2:  */
408  #define PLAYSTATION2_BDA        0xffffffffa0001000ULL  #define PLAYSTATION2_BDA        0xffffffffa0001000ULL
409  #define PLAYSTATION2_OPTARGS    0xffffffff81fff100ULL  #define PLAYSTATION2_OPTARGS    0xffffffff81fff100ULL
# Line 328  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_PB1000          2  #define MACHINE_EVBMIPS_MALTA_BE        2
429    #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 363  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) struct machine_entry               \
513                *me = machine_entry_new(name,arch,type);                    \
514            me->setup = machine_setup_ ## x;                                \
515            me->set_default_cpu = machine_default_cpu_ ## x;                \
516            machine_entry_register(me, arch);
517    void automachine_init(void);
518    
519    
520  /*  machine.c:  */  /*  machine.c:  */
521  struct machine *machine_new(char *name, struct emul *emul);  struct machine *machine_new(char *name, struct emul *emul);
522  int machine_name_to_type(char *stype, char *ssubtype,  int machine_name_to_type(char *stype, char *ssubtype,
523          int *type, int *subtype, int *arch);          int *type, int *subtype, int *arch);
524  void machine_add_tickfunction(struct machine *machine,  void machine_add_tickfunction(struct machine *machine,
525          void (*func)(struct cpu *, void *), void *extra, int clockshift);          void (*func)(struct cpu *, void *), void *extra,
526            int clockshift, double hz);
527    void machine_register(char *name, MACHINE_SETUP_TYPE(setup));
528  void dump_mem_string(struct cpu *cpu, uint64_t addr);  void dump_mem_string(struct cpu *cpu, uint64_t addr);
529  void store_string(struct cpu *cpu, uint64_t addr, char *s);  void store_string(struct cpu *cpu, uint64_t addr, char *s);
530  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 540  void store_16bit_word_in_host(struct cpu
540  uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);  uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr);
541  uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);  uint16_t load_16bit_word(struct cpu *cpu, uint64_t addr);
542  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);
543    void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr);
544    void add_environment_string_dual(struct cpu *cpu,
545            uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2);
546    void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp,
547            uint64_t data, int flag64);
548  void machine_setup(struct machine *);  void machine_setup(struct machine *);
549  void machine_memsize_fix(struct machine *);  void machine_memsize_fix(struct machine *);
550  void machine_default_cputype(struct machine *);  void machine_default_cputype(struct machine *);
551  void machine_dumpinfo(struct machine *);  void machine_dumpinfo(struct machine *);
552    void machine_bus_register(struct machine *, char *busname,
553            void (*debug_dump)(void *), void *extra);
554    int machine_run(struct machine *machine);
555  void machine_list_available_types_and_cpus(void);  void machine_list_available_types_and_cpus(void);
556    struct machine_entry *machine_entry_new(const char *name,
557            int arch, int oldstyle_type);
558    void machine_entry_add_alias(struct machine_entry *me, const char *name);
559    void machine_entry_add_subtype(struct machine_entry *me, const char *name,
560            int oldstyle_subtype, ...);
561    void machine_entry_register(struct machine_entry *me, int arch);
562  void machine_init(void);  void machine_init(void);
563    
564    

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

  ViewVC Help
Powered by ViewVC 1.1.26