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

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

revision 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 2  Line 2 
2  #define CPU_ALPHA_H  #define CPU_ALPHA_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: cpu_alpha.h,v 1.25 2005/10/22 17:24:22 debug Exp $   *  $Id: cpu_alpha.h,v 1.39 2006/07/16 13:32:27 debug Exp $
32   */   */
33    
34  #include "misc.h"  #include "misc.h"
35    
36    
37    /*  ALPHA CPU types:  */
38    struct alpha_cpu_type_def {
39            char            *name;
40            int             features;
41            int             icache_shift;
42            int             ilinesize;
43            int             iway;
44            int             dcache_shift;
45            int             dlinesize;
46            int             dway;
47            int             l2cache_shift;
48            int             l2linesize;
49            int             l2way;
50    };
51    
52    /*  TODO: More features  */
53    #define ALPHA_FEATURE_BWX               1
54    
55    #define ALPHA_CPU_TYPE_DEFS     {                                       \
56            { "21064",      0,       16,5,2, 16,5,2,  0,0,0 },              \
57            { "21066",      0,       16,5,2, 16,5,2,  0,0,0 },              \
58            { "21164",      0,       16,5,2, 16,5,2,  0,0,0 },              \
59            { "21164A-2",   0,       16,5,2, 16,5,2,  0,0,0 },              \
60            { "21164PC",    0,       16,5,2, 16,5,2,  0,0,0 },              \
61            { "21264",      0,       16,5,2, 16,5,2,  0,0,0 },              \
62            { "21364",      0,       16,5,2, 16,5,2,  0,0,0 },              \
63            { NULL,         0,        0,0,0,  0,0,0,   0,0,0 }              }
64    
65    
66  struct cpu_family;  struct cpu_family;
67    
68  #define ALPHA_V0                0  #define ALPHA_V0                0
# Line 65  struct cpu_family; Line 94  struct cpu_family;
94  #define ALPHA_ADDR_TO_PAGENR(a)         ((a) >> (ALPHA_IC_ENTRIES_SHIFT \  #define ALPHA_ADDR_TO_PAGENR(a)         ((a) >> (ALPHA_IC_ENTRIES_SHIFT \
95                                          + ALPHA_INSTR_ALIGNMENT_SHIFT))                                          + ALPHA_INSTR_ALIGNMENT_SHIFT))
96    
97  struct alpha_instr_call {  #define ALPHA_MAX_VPH_TLB_ENTRIES       128
         void    (*f)(struct cpu *, struct alpha_instr_call *);  
         size_t  arg[ALPHA_N_IC_ARGS];  
 };  
   
 /*  Translation cache struct for each physical page:  */  
 struct alpha_tc_physpage {  
         struct alpha_instr_call ics[ALPHA_IC_ENTRIES_PER_PAGE + 1];  
         uint32_t        next_ofs;       /*  or 0 for end of chain  */  
         uint32_t        physaddr;  
         int             flags;  
 };  
98    
99    #define ALPHA_L2N               17
100    #define ALPHA_L3N               17
101    
102  /*  DYNTRANS_MISC_DECLARATIONS(alpha,ALPHA,uint64_t)
103   *  Virtual->physical->host page entry:  DYNTRANS_MISC64_DECLARATIONS(alpha,ALPHA,uint8_t)
  *  
  *      13 + 13 + 13 bits = 39 bits (should be enough for most userspace  
  *      applications)  
  *  
  *  There is also an additional check for kernel space addresses.  
  */  
 #define ALPHA_TOPSHIFT                  39  
 #define ALPHA_TOP_KERNEL                0x1fffff8  
 #define ALPHA_LEVEL0_SHIFT              26  
 #define ALPHA_LEVEL0                    8192  
 #define ALPHA_LEVEL1_SHIFT              13  
 #define ALPHA_LEVEL1                    8192  
 struct alpha_vph_page {  
         void            *host_load[ALPHA_LEVEL1];  
         void            *host_store[ALPHA_LEVEL1];  
         uint64_t        phys_addr[ALPHA_LEVEL1];  
         struct alpha_tc_physpage *phys_page[ALPHA_LEVEL1];  
         int             refcount;  
         struct alpha_vph_page   *next;  /*  Freelist, used if refcount = 0.  */  
 };  
104    
 #define ALPHA_MAX_VPH_TLB_ENTRIES       128  
 struct alpha_vpg_tlb_entry {  
         int             valid;  
         int             writeflag;  
         int64_t         timestamp;  
         unsigned char   *host_page;  
         uint64_t        vaddr_page;  
         uint64_t        paddr_page;  
 };  
105    
106  struct alpha_cpu {  struct alpha_cpu {
107          /*          /*
# Line 120  struct alpha_cpu { Line 111  struct alpha_cpu {
111          uint64_t                r[N_ALPHA_REGS];        /*  Integer  */          uint64_t                r[N_ALPHA_REGS];        /*  Integer  */
112          uint64_t                f[N_ALPHA_REGS];        /*  Floating Point  */          uint64_t                f[N_ALPHA_REGS];        /*  Floating Point  */
113    
114            uint64_t                fpcr;                   /*  FP Control Reg.  */
115    
116          /*  Misc.:  */          /*  Misc.:  */
117          uint64_t                pcc;                    /*  Cycle Counter  */          uint64_t                pcc;                    /*  Cycle Counter  */
# Line 127  struct alpha_cpu { Line 119  struct alpha_cpu {
119          uint64_t                load_linked_addr;          uint64_t                load_linked_addr;
120          int                     ll_flag;          int                     ll_flag;
121    
122            /*  PALcode specific:  */
123          /*          uint64_t                wrvptptr;
124           *  Instruction translation cache:          uint64_t                sysvalue;
          */  
   
         /*  cur_ic_page is a pointer to an array of ALPHA_IC_ENTRIES_PER_PAGE  
             instruction call entries. next_ic points to the next such  
             call to be executed.  */  
         struct alpha_tc_physpage *cur_physpage;  
         struct alpha_instr_call *cur_ic_page;  
         struct alpha_instr_call *next_ic;  
125    
126    
127          /*          /*
128           *  Virtual -> physical -> host address translation:           *  Instruction translation cache and Virtual->Physical->Host
129             *  address translation:
130           */           */
131            DYNTRANS_ITC(alpha)
132          struct alpha_vpg_tlb_entry vph_tlb_entry[ALPHA_MAX_VPH_TLB_ENTRIES];          VPH_TLBS(alpha,ALPHA)
133          struct alpha_vph_page   *vph_default_page;          VPH64(alpha,ALPHA,uint8_t)
         struct alpha_vph_page   *vph_next_free_page;  
         struct alpha_vph_table  *vph_next_free_table;  
         struct alpha_vph_page   *vph_table0[ALPHA_LEVEL0];  
         struct alpha_vph_page   *vph_table0_kernel[ALPHA_LEVEL0];  
134  };  };
135    
136    
# Line 158  void alpha_update_translation_table(stru Line 139  void alpha_update_translation_table(stru
139          unsigned char *host_page, int writeflag, uint64_t paddr_page);          unsigned char *host_page, int writeflag, uint64_t paddr_page);
140  void alpha_invalidate_translation_caches(struct cpu *cpu, uint64_t, int);  void alpha_invalidate_translation_caches(struct cpu *cpu, uint64_t, int);
141  void alpha_invalidate_code_translation(struct cpu *cpu, uint64_t, int);  void alpha_invalidate_code_translation(struct cpu *cpu, uint64_t, int);
142    void alpha_init_64bit_dummy_tables(struct cpu *cpu);
143    int alpha_run_instr(struct cpu *cpu);
144  int alpha_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr,  int alpha_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr,
145          unsigned char *data, size_t len, int writeflag, int cache_flags);          unsigned char *data, size_t len, int writeflag, int cache_flags);
146  int alpha_userland_memory_rw(struct cpu *cpu, struct memory *mem,  int alpha_userland_memory_rw(struct cpu *cpu, struct memory *mem,
# Line 169  int alpha_cpu_family_init(struct cpu_fam Line 152  int alpha_cpu_family_init(struct cpu_fam
152  void alpha_palcode_name(uint32_t palcode, char *buf, size_t buflen);  void alpha_palcode_name(uint32_t palcode, char *buf, size_t buflen);
153  void alpha_palcode(struct cpu *cpu, uint32_t palcode);  void alpha_palcode(struct cpu *cpu, uint32_t palcode);
154    
155    /*  memory_alpha.c:  */
156    int alpha_translate_v2p(struct cpu *cpu, uint64_t vaddr,
157            uint64_t *return_addr, int flags);
158    
159    
160  #endif  /*  CPU_ALPHA_H  */  #endif  /*  CPU_ALPHA_H  */

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

  ViewVC Help
Powered by ViewVC 1.1.26