/[gxemul]/trunk/src/include/cpu.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/cpu.h

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

revision 31 by dpavlin, Mon Oct 8 16:20:40 2007 UTC revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC
# Line 28  Line 28 
28   *  SUCH DAMAGE.   *  SUCH DAMAGE.
29   *   *
30   *   *
31   *  $Id: cpu.h,v 1.90 2006/08/12 11:43:13 debug Exp $   *  $Id: cpu.h,v 1.100 2006/10/25 09:24:06 debug Exp $
32   *   *
33   *  CPU-related definitions.   *  CPU-related definitions.
34   */   */
# Line 194  Line 194 
194  #include "cpu_alpha.h"  #include "cpu_alpha.h"
195  #include "cpu_arm.h"  #include "cpu_arm.h"
196  #include "cpu_avr.h"  #include "cpu_avr.h"
197    #include "cpu_avr32.h"
198  #include "cpu_hppa.h"  #include "cpu_hppa.h"
199  #include "cpu_i960.h"  #include "cpu_i960.h"
200  #include "cpu_ia64.h"  #include "cpu_ia64.h"
201  #include "cpu_m68k.h"  #include "cpu_m68k.h"
202  #include "cpu_mips.h"  #include "cpu_mips.h"
203  #include "cpu_ppc.h"  #include "cpu_ppc.h"
204    #include "cpu_rca180x.h"
205  #include "cpu_sh.h"  #include "cpu_sh.h"
206  #include "cpu_sparc.h"  #include "cpu_sparc.h"
207  #include "cpu_transputer.h"  #include "cpu_transputer.h"
# Line 209  struct cpu; Line 211  struct cpu;
211  struct emul;  struct emul;
212  struct machine;  struct machine;
213  struct memory;  struct memory;
214    struct settings;
215    
216    
217  /*  /*
# Line 239  struct cpu_family { Line 242  struct cpu_family {
242          /*  List available CPU types for this architecture.  */          /*  List available CPU types for this architecture.  */
243          void                    (*list_available_types)(void);          void                    (*list_available_types)(void);
244    
         /*  Read or write a CPU register, given a name.  */  
         void                    (*register_match)(struct machine *m,  
                                     char *name, int writeflag,  
                                     uint64_t *valuep, int *match_register);  
   
245          /*  Disassemble an instruction.  */          /*  Disassemble an instruction.  */
246          int                     (*disassemble_instr)(struct cpu *cpu,          int                     (*disassemble_instr)(struct cpu *cpu,
247                                      unsigned char *instr, int running,                                      unsigned char *instr, int running,
# Line 293  struct cpu_family { Line 291  struct cpu_family {
291  #define N_SAFE_DYNTRANS_LIMIT_SHIFT     14  #define N_SAFE_DYNTRANS_LIMIT_SHIFT     14
292  #define N_SAFE_DYNTRANS_LIMIT   ((1 << (N_SAFE_DYNTRANS_LIMIT_SHIFT - 1)) - 1)  #define N_SAFE_DYNTRANS_LIMIT   ((1 << (N_SAFE_DYNTRANS_LIMIT_SHIFT - 1)) - 1)
293    
294  #define DYNTRANS_CACHE_SIZE             (24*1048576)  #define DYNTRANS_CACHE_SIZE             (32*1048576)
295  #define DYNTRANS_CACHE_MARGIN           300000  #define DYNTRANS_CACHE_MARGIN           200000
296    
297  #define N_BASE_TABLE_ENTRIES            32768  #define N_BASE_TABLE_ENTRIES            32768
298  #define PAGENR_TO_TABLE_INDEX(a)        ((a) & (N_BASE_TABLE_ENTRIES-1))  #define PAGENR_TO_TABLE_INDEX(a)        ((a) & (N_BASE_TABLE_ENTRIES-1))
# Line 308  struct cpu { Line 306  struct cpu {
306          /*  Pointer back to the machine this CPU is in:  */          /*  Pointer back to the machine this CPU is in:  */
307          struct machine  *machine;          struct machine  *machine;
308    
309            /*  Settings:  */
310            struct settings *settings;
311    
312          /*  CPU-specific name, e.g. "R2000", "21164PC", etc.  */          /*  CPU-specific name, e.g. "R2000", "21164PC", etc.  */
313          char            *name;          char            *name;
314    
# Line 357  struct cpu { Line 358  struct cpu {
358           *  If is_halted is true when an interrupt trap occurs, the pointer           *  If is_halted is true when an interrupt trap occurs, the pointer
359           *  to the next instruction to execute will be the instruction           *  to the next instruction to execute will be the instruction
360           *  following the halt instruction, not the halt instrucion itself.           *  following the halt instruction, not the halt instrucion itself.
361             *
362             *  If has_been_idling is true when printing the number of executed
363             *  instructions per second, "idling" is printed instead. (The number
364             *  of instrs per second when idling is meaningless anyway.)
365           */           */
366          int             is_halted;          int             is_halted;
367            int             has_been_idling;
368    
369          /*          /*
370           *  Dynamic translation:           *  Dynamic translation:
# Line 390  struct cpu { Line 396  struct cpu {
396                  struct alpha_cpu      alpha;                  struct alpha_cpu      alpha;
397                  struct arm_cpu        arm;                  struct arm_cpu        arm;
398                  struct avr_cpu        avr;                  struct avr_cpu        avr;
399                    struct avr32_cpu      avr32;
400                  struct hppa_cpu       hppa;                  struct hppa_cpu       hppa;
401                  struct i960_cpu       i960;                  struct i960_cpu       i960;
402                  struct ia64_cpu       ia64;                  struct ia64_cpu       ia64;
403                  struct m68k_cpu       m68k;                  struct m68k_cpu       m68k;
404                  struct mips_cpu       mips;                  struct mips_cpu       mips;
405                  struct ppc_cpu        ppc;                  struct ppc_cpu        ppc;
406                    struct rca180x_cpu    rca180x;
407                  struct sh_cpu         sh;                  struct sh_cpu         sh;
408                  struct sparc_cpu      sparc;                  struct sparc_cpu      sparc;
409                  struct transputer_cpu transputer;                  struct transputer_cpu transputer;
# Line 407  struct cpu { Line 415  struct cpu {
415  /*  cpu.c:  */  /*  cpu.c:  */
416  struct cpu *cpu_new(struct memory *mem, struct machine *machine,  struct cpu *cpu_new(struct memory *mem, struct machine *machine,
417          int cpu_id, char *cpu_type_name);          int cpu_id, char *cpu_type_name);
418    void cpu_destroy(struct cpu *cpu);
419    
420  void cpu_tlbdump(struct machine *m, int x, int rawflag);  void cpu_tlbdump(struct machine *m, int x, int rawflag);
 void cpu_register_match(struct machine *m, char *name,  
         int writeflag, uint64_t *valuep, int *match_register);  
421  void cpu_register_dump(struct machine *m, struct cpu *cpu,  void cpu_register_dump(struct machine *m, struct cpu *cpu,
422          int gprs, int coprocs);          int gprs, int coprocs);
423  int cpu_disassemble_instr(struct machine *m, struct cpu *cpu,  int cpu_disassemble_instr(struct machine *m, struct cpu *cpu,
424          unsigned char *instr, int running, uint64_t addr);          unsigned char *instr, int running, uint64_t addr);
425  char *cpu_gdb_stub(struct cpu *cpu, char *cmd);  char *cpu_gdb_stub(struct cpu *cpu, char *cmd);
426    
427  int cpu_interrupt(struct cpu *cpu, uint64_t irq_nr);  int cpu_interrupt(struct cpu *cpu, uint64_t irq_nr);
428  int cpu_interrupt_ack(struct cpu *cpu, uint64_t irq_nr);  int cpu_interrupt_ack(struct cpu *cpu, uint64_t irq_nr);
429  void cpu_functioncall_trace(struct cpu *cpu, uint64_t f);  void cpu_functioncall_trace(struct cpu *cpu, uint64_t f);
430  void cpu_functioncall_trace_return(struct cpu *cpu);  void cpu_functioncall_trace_return(struct cpu *cpu);
431    
432  void cpu_create_or_reset_tc(struct cpu *cpu);  void cpu_create_or_reset_tc(struct cpu *cpu);
433    
434  void cpu_run_init(struct machine *machine);  void cpu_run_init(struct machine *machine);
435  void cpu_run_deinit(struct machine *machine);  void cpu_run_deinit(struct machine *machine);
436    
437  void cpu_dumpinfo(struct machine *m, struct cpu *cpu);  void cpu_dumpinfo(struct machine *m, struct cpu *cpu);
438  void cpu_list_available_types(void);  void cpu_list_available_types(void);
439  void cpu_show_cycles(struct machine *machine, int forced);  void cpu_show_cycles(struct machine *machine, int forced);
440    
441  struct cpu_family *cpu_family_ptr_by_number(int arch);  struct cpu_family *cpu_family_ptr_by_number(int arch);
442  void cpu_init(void);  void cpu_init(void);
443    
# Line 436  void cpu_init(void); Line 449  void cpu_init(void);
449  #define INVALIDATE_VADDR_UPPER4         16      /*  useful for PPC emulation  */  #define INVALIDATE_VADDR_UPPER4         16      /*  useful for PPC emulation  */
450    
451    
452    /*  Note: 64-bit processors running in 32-bit mode use a 32-bit
453        display format, even though the underlying data is 64-bits.  */
454    #define CPU_SETTINGS_ADD_REGISTER64(name, var)                             \
455            settings_add(cpu->settings, name, 1, SETTINGS_TYPE_UINT64,         \
456                cpu->is_32bit? SETTINGS_FORMAT_HEX32 : SETTINGS_FORMAT_HEX64,  \
457                (void *) &(var));
458    #define CPU_SETTINGS_ADD_REGISTER32(name, var)                             \
459            settings_add(cpu->settings, name, 1, SETTINGS_TYPE_UINT32,         \
460                SETTINGS_FORMAT_HEX32, (void *) &(var));
461    #define CPU_SETTINGS_ADD_REGISTER16(name, var)                             \
462            settings_add(cpu->settings, name, 1, SETTINGS_TYPE_UINT16,         \
463                SETTINGS_FORMAT_HEX16, (void *) &(var));
464    #define CPU_SETTINGS_ADD_REGISTER8(name, var)                              \
465            settings_add(cpu->settings, name, 1, SETTINGS_TYPE_UINT8,          \
466                SETTINGS_FORMAT_HEX8, (void *) &(var));
467    
468    
469  #define CPU_FAMILY_INIT(n,s)    int n ## _cpu_family_init(              \  #define CPU_FAMILY_INIT(n,s)    int n ## _cpu_family_init(              \
470          struct cpu_family *fp) {                                        \          struct cpu_family *fp) {                                        \
471          /*  Fill in the cpu_family struct with valid data for this arch.  */ \          /*  Fill in the cpu_family struct with valid data for this arch.  */ \
472          fp->name = s;                                                   \          fp->name = s;                                                   \
473          fp->cpu_new = n ## _cpu_new;                                    \          fp->cpu_new = n ## _cpu_new;                                    \
474          fp->list_available_types = n ## _cpu_list_available_types;      \          fp->list_available_types = n ## _cpu_list_available_types;      \
         fp->register_match = n ## _cpu_register_match;                  \  
475          fp->disassemble_instr = n ## _cpu_disassemble_instr;            \          fp->disassemble_instr = n ## _cpu_disassemble_instr;            \
476          fp->register_dump = n ## _cpu_register_dump;                    \          fp->register_dump = n ## _cpu_register_dump;                    \
477          fp->dumpinfo = n ## _cpu_dumpinfo;                              \          fp->dumpinfo = n ## _cpu_dumpinfo;                              \

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

  ViewVC Help
Powered by ViewVC 1.1.26