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

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

revision 4 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC
# Line 28  Line 28 
28   *  SUCH DAMAGE.   *  SUCH DAMAGE.
29   *   *
30   *   *
31   *  $Id: memory.h,v 1.29 2005/02/26 16:53:32 debug Exp $   *  $Id: memory.h,v 1.40 2005/10/23 14:24:15 debug Exp $
32   *   *
33   *  Memory controller related functions.   *  Memory controller related functions.
34   */   */
# Line 64  struct memory { Line 64  struct memory {
64    
65          const char      *dev_name[MAX_DEVICES];          const char      *dev_name[MAX_DEVICES];
66          uint64_t        dev_baseaddr[MAX_DEVICES];          uint64_t        dev_baseaddr[MAX_DEVICES];
67            uint64_t        dev_endaddr[MAX_DEVICES];       /*  after the end!  */
68          uint64_t        dev_length[MAX_DEVICES];          uint64_t        dev_length[MAX_DEVICES];
69          int             dev_flags[MAX_DEVICES];          int             dev_flags[MAX_DEVICES];
70          void            *dev_extra[MAX_DEVICES];          void            *dev_extra[MAX_DEVICES];
# Line 72  struct memory { Line 73  struct memory {
73          int             (*dev_f_state[MAX_DEVICES])(struct cpu *,          int             (*dev_f_state[MAX_DEVICES])(struct cpu *,
74                              struct memory *, void *extra, int wf, int nr,                              struct memory *, void *extra, int wf, int nr,
75                              int *type, char **namep, void **data, size_t *len);                              int *type, char **namep, void **data, size_t *len);
76          unsigned char   *dev_bintrans_data[MAX_DEVICES];          unsigned char   *dev_dyntrans_data[MAX_DEVICES];
77    
78  #ifdef BINTRANS          int             dev_dyntrans_alignment;
79          uint64_t        dev_bintrans_write_low[MAX_DEVICES];  
80          uint64_t        dev_bintrans_write_high[MAX_DEVICES];          uint64_t        dev_dyntrans_write_low[MAX_DEVICES];
81            uint64_t        dev_dyntrans_write_high[MAX_DEVICES];
82    
83    
84            /*
85             *  NOTE/TODO: This bintrans was for MIPS only. Ugly. :-/
86             */
87    
88          /*          /*
89           *  translation_code_chunk_space is a large chunk of (linear) memory           *  translation_code_chunk_space is a large chunk of (linear) memory
# Line 101  struct memory { Line 108  struct memory {
108          int             quick_jump_page_offset[MAX_QUICK_JUMPS];          int             quick_jump_page_offset[MAX_QUICK_JUMPS];
109          int             n_quick_jumps;          int             n_quick_jumps;
110          int             quick_jumps_index;          int             quick_jumps_index;
 #endif  
111  };  };
112    
113  #define BITS_PER_PAGETABLE      20  #define BITS_PER_PAGETABLE      20
# Line 118  struct memory { Line 124  struct memory {
124    
125  #define CACHE_FLAGS_MASK                0x3  #define CACHE_FLAGS_MASK                0x3
126    
127  #define NO_EXCEPTIONS                   8  #define NO_EXCEPTIONS                   16
128  #define PHYSICAL                        16  #define PHYSICAL                        32
129    #define NO_SEGMENTATION                 64      /*  for X86  */
130    #define MEMORY_USER_ACCESS              128     /*  for ARM, at least  */
131    
132    
133  /*  memory.c:  */  /*  memory.c:  */
# Line 129  void memory_writemax64(struct cpu *cpu, Line 137  void memory_writemax64(struct cpu *cpu,
137    
138  void *zeroed_alloc(size_t s);  void *zeroed_alloc(size_t s);
139    
140  struct memory *memory_new(uint64_t physical_max);  struct memory *memory_new(uint64_t physical_max, int arch);
141    
142  int memory_points_to_string(struct cpu *cpu, struct memory *mem,  int memory_points_to_string(struct cpu *cpu, struct memory *mem,
143          uint64_t addr, int min_string_length);          uint64_t addr, int min_string_length);
# Line 143  unsigned char *memory_paddr_to_hostaddr( Line 151  unsigned char *memory_paddr_to_hostaddr(
151  unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr,  unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr,
152          int writeflag);          int writeflag);
153    
154    /*  MIPS stuff:  */
155  int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr,  int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr,
156          uint64_t *return_addr, int flags);          uint64_t *return_addr, int flags);
157  int translate_address_mmu8k(struct cpu *cpu, uint64_t vaddr,  int translate_address_mmu8k(struct cpu *cpu, uint64_t vaddr,
# Line 154  int translate_address_mmu4100(struct cpu Line 163  int translate_address_mmu4100(struct cpu
163  int translate_address_generic(struct cpu *cpu, uint64_t vaddr,  int translate_address_generic(struct cpu *cpu, uint64_t vaddr,
164          uint64_t *return_addr, int flags);          uint64_t *return_addr, int flags);
165    
166    
167  #define FLAG_WRITEFLAG          1  #define FLAG_WRITEFLAG          1
168  #define FLAG_NOEXCEPTIONS       2  #define FLAG_NOEXCEPTIONS       2
169  #define FLAG_INSTR              4  #define FLAG_INSTR              4
170    
171  int userland_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr,  int userland_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr,
172          unsigned char *data, size_t len, int writeflag, int cache);          unsigned char *data, size_t len, int writeflag, int cache);
173  #define MEMORY_ACCESS_FAILED    0  #define MEMORY_ACCESS_FAILED            0
174  #define MEMORY_ACCESS_OK        1  #define MEMORY_ACCESS_OK                1
175    #define MEMORY_ACCESS_OK_WRITE          2
176    #define MEMORY_NOT_FULL_PAGE            256
177    
178  void memory_device_bintrans_access(struct cpu *, struct memory *mem,  void memory_device_dyntrans_access(struct cpu *, struct memory *mem,
179          void *extra, uint64_t *low, uint64_t *high);          void *extra, uint64_t *low, uint64_t *high);
180    
181  void memory_device_register_statefunction(  void memory_device_register_statefunction(
# Line 175  void memory_device_register_statefunctio Line 187  void memory_device_register_statefunctio
187  void memory_device_register(struct memory *mem, const char *,  void memory_device_register(struct memory *mem, const char *,
188          uint64_t baseaddr, uint64_t len, int (*f)(struct cpu *,          uint64_t baseaddr, uint64_t len, int (*f)(struct cpu *,
189              struct memory *,uint64_t,unsigned char *,size_t,int,void *),              struct memory *,uint64_t,unsigned char *,size_t,int,void *),
190          void *extra, int flags, unsigned char *bintrans_data);          void *extra, int flags, unsigned char *dyntrans_data);
191  void memory_device_remove(struct memory *mem, int i);  void memory_device_remove(struct memory *mem, int i);
192    
193  #define MEM_DEFAULT                     0  /*  Bit flags:  */
194  #define MEM_BINTRANS_OK                 1  #define MEM_DEFAULT                             0
195  #define MEM_BINTRANS_WRITE_OK           2  #define MEM_DYNTRANS_OK                         1
196    #define MEM_DYNTRANS_WRITE_OK                   2
197    #define MEM_READING_HAS_NO_SIDE_EFFECTS         4
198    #define MEM_EMULATED_RAM                        8
199    
200    
201  #endif  /*  MEMORY_H  */  #endif  /*  MEMORY_H  */

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

  ViewVC Help
Powered by ViewVC 1.1.26