/[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 26 by dpavlin, Mon Oct 8 16:20:10 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 28  Line 28 
28   *  SUCH DAMAGE.   *  SUCH DAMAGE.
29   *   *
30   *   *
31   *  $Id: cpu.h,v 1.79 2006/06/25 00:27:36 debug Exp $   *  $Id: cpu.h,v 1.84 2006/07/20 21:53:00 debug Exp $
32   *   *
33   *  CPU-related definitions.   *  CPU-related definitions.
34   */   */
# Line 54  Line 54 
54   *  instruction can "nullify" (skip) the delay-slot. If the end-of-page   *  instruction can "nullify" (skip) the delay-slot. If the end-of-page
55   *  slot is skipped, then we end up one step after that. That's where the   *  slot is skipped, then we end up one step after that. That's where the
56   *  end_of_page2 slot is. :)   *  end_of_page2 slot is. :)
57     *
58     *  next_ofs points to the next page in a chain of possible pages.
59     *  (several pages can be in the same chain, but only one matches the
60     *  specific physaddr.)
61     *
62     *  flags contains special flags. Currently only COMBINATIONS, which indicates
63     *  that the page has instruction combinations.
64     *
65     *  translations is a tiny bitmap indicating which parts of the page have
66     *  actual translations. Bit 0 corresponds to the lowest 1/32th of the page,
67     *  bit 1 to the second-lowest 1/32th, and so on.
68   */   */
69  #define DYNTRANS_MISC_DECLARATIONS(arch,ARCH,addrtype)  struct \  #define DYNTRANS_MISC_DECLARATIONS(arch,ARCH,addrtype)  struct \
70          arch ## _instr_call {                                   \          arch ## _instr_call {                                   \
# Line 65  Line 76 
76          struct arch ## _tc_physpage {                                   \          struct arch ## _tc_physpage {                                   \
77                  struct arch ## _instr_call ics[ARCH ## _IC_ENTRIES_PER_PAGE+2];\                  struct arch ## _instr_call ics[ARCH ## _IC_ENTRIES_PER_PAGE+2];\
78                  uint32_t        next_ofs;       /*  (0 for end of chain)  */ \                  uint32_t        next_ofs;       /*  (0 for end of chain)  */ \
79                    uint32_t        translations;                           \
80                  int             flags;                                  \                  int             flags;                                  \
81                  addrtype        physaddr;                               \                  addrtype        physaddr;                               \
82          };                                                              \          };                                                              \
# Line 148  Line 160 
160   *   *
161   *  phys_page points to translation cache physpages.   *  phys_page points to translation cache physpages.
162   *   *
  *  phystranslation is a bitmap which tells us whether a physical page has  
  *  a code translation.  
  *  
163   *  vaddr_to_tlbindex is a virtual address to tlb index hint table.   *  vaddr_to_tlbindex is a virtual address to tlb index hint table.
164   *  The values in this array are the tlb index plus 1, so a value of, say,   *  The values in this array are the tlb index plus 1, so a value of, say,
165   *  3 means tlb index 2. A value of 0 would mean a tlb index of -1, which   *  3 means tlb index 2. A value of 0 would mean a tlb index of -1, which
# Line 162  Line 171 
171          unsigned char           *host_store[N_VPH32_ENTRIES];           \          unsigned char           *host_store[N_VPH32_ENTRIES];           \
172          paddrtype               phys_addr[N_VPH32_ENTRIES];             \          paddrtype               phys_addr[N_VPH32_ENTRIES];             \
173          struct arch ## _tc_physpage  *phys_page[N_VPH32_ENTRIES];       \          struct arch ## _tc_physpage  *phys_page[N_VPH32_ENTRIES];       \
         uint32_t                phystranslation[N_VPH32_ENTRIES/32];    \  
174          tlbindextype            vaddr_to_tlbindex[N_VPH32_ENTRIES];          tlbindextype            vaddr_to_tlbindex[N_VPH32_ENTRIES];
175    
176  /*  /*
# Line 199  Line 207 
207  #include "cpu_ppc.h"  #include "cpu_ppc.h"
208  #include "cpu_sh.h"  #include "cpu_sh.h"
209  #include "cpu_sparc.h"  #include "cpu_sparc.h"
210    #include "cpu_transputer.h"
211  #include "cpu_x86.h"  #include "cpu_x86.h"
212    
213  struct cpu;  struct cpu;
# Line 225  struct cpu_family { Line 234  struct cpu_family {
234                                      uint64_t dumpaddr);                                      uint64_t dumpaddr);
235          void                    (*register_dump)(struct cpu *cpu,          void                    (*register_dump)(struct cpu *cpu,
236                                      int gprs, int coprocs);                                      int gprs, int coprocs);
         int                     (*run_instr)(struct emul *emul,  
                                     struct cpu *cpu);  
237          void                    (*dumpinfo)(struct cpu *cpu);          void                    (*dumpinfo)(struct cpu *cpu);
238          void                    (*tlbdump)(struct machine *m, int x,          void                    (*tlbdump)(struct machine *m, int x,
239                                      int rawflag);                                      int rawflag);
# Line 248  struct cpu_family { Line 255  struct cpu_family {
255   */   */
256    
257  /*  Physpage flags:  */  /*  Physpage flags:  */
258  #define TRANSLATIONS                    1  #define COMBINATIONS                    1
 #define COMBINATIONS                    2  
259    
260  /*  Meaning of delay_slot:  */  /*  Meaning of delay_slot:  */
261  #define NOT_DELAYED                     0  #define NOT_DELAYED                     0
# Line 260  struct cpu_family { Line 266  struct cpu_family {
266  #define N_SAFE_DYNTRANS_LIMIT_SHIFT     14  #define N_SAFE_DYNTRANS_LIMIT_SHIFT     14
267  #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)
268    
269  #define DYNTRANS_CACHE_SIZE             (24*1048576)  #define DYNTRANS_CACHE_SIZE             (32*1048576)
270  #define DYNTRANS_CACHE_MARGIN           350000  #define DYNTRANS_CACHE_MARGIN           350000
271    
272  #define N_BASE_TABLE_ENTRIES            32768  #define N_BASE_TABLE_ENTRIES            32768
# Line 284  struct cpu { Line 290  struct cpu {
290          char            *name;          char            *name;
291    
292          struct memory   *mem;          struct memory   *mem;
293    
294            int             (*run_instr)(struct cpu *cpu);
295          int             (*memory_rw)(struct cpu *cpu,          int             (*memory_rw)(struct cpu *cpu,
296                              struct memory *mem, uint64_t vaddr,                              struct memory *mem, uint64_t vaddr,
297                              unsigned char *data, size_t len,                              unsigned char *data, size_t len,
# Line 320  struct cpu { Line 328  struct cpu {
328           *  CPU-family dependent:           *  CPU-family dependent:
329           */           */
330          union {          union {
331                  struct alpha_cpu   alpha;                  struct alpha_cpu      alpha;
332                  struct arm_cpu     arm;                  struct arm_cpu        arm;
333                  struct avr_cpu     avr;                  struct avr_cpu        avr;
334                  struct hppa_cpu    hppa;                  struct hppa_cpu       hppa;
335                  struct i960_cpu    i960;                  struct i960_cpu       i960;
336                  struct ia64_cpu    ia64;                  struct ia64_cpu       ia64;
337                  struct m68k_cpu    m68k;                  struct m68k_cpu       m68k;
338                  struct mips_cpu    mips;                  struct mips_cpu       mips;
339                  struct ppc_cpu     ppc;                  struct ppc_cpu        ppc;
340                  struct sh_cpu      sh;                  struct sh_cpu         sh;
341                  struct sparc_cpu   sparc;                  struct sparc_cpu      sparc;
342                  struct x86_cpu     x86;                  struct transputer_cpu transputer;
343                    struct x86_cpu        x86;
344          } cd;          } cd;
345  };  };
346    
# Line 383  void cpu_init(void); Line 392  void cpu_init(void);
392          fp->functioncall_trace = n ## _cpu_functioncall_trace;          \          fp->functioncall_trace = n ## _cpu_functioncall_trace;          \
393          fp->gdb_stub = n ## _cpu_gdb_stub;                              \          fp->gdb_stub = n ## _cpu_gdb_stub;                              \
394          fp->tlbdump = n ## _cpu_tlbdump;                                \          fp->tlbdump = n ## _cpu_tlbdump;                                \
         fp->run_instr = n ## _cpu_run_instr;                            \  
395          fp->init_tables = n ## _cpu_init_tables;                        \          fp->init_tables = n ## _cpu_init_tables;                        \
396          return 1;                                                       \          return 1;                                                       \
397          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.26