/[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 14 by dpavlin, Mon Oct 8 16:18:51 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.37 2005/09/22 09:07:00 debug Exp $
32   *   *
33   *  Memory controller related functions.   *  Memory controller related functions.
34   */   */
# Line 72  struct memory { Line 72  struct memory {
72          int             (*dev_f_state[MAX_DEVICES])(struct cpu *,          int             (*dev_f_state[MAX_DEVICES])(struct cpu *,
73                              struct memory *, void *extra, int wf, int nr,                              struct memory *, void *extra, int wf, int nr,
74                              int *type, char **namep, void **data, size_t *len);                              int *type, char **namep, void **data, size_t *len);
75          unsigned char   *dev_bintrans_data[MAX_DEVICES];          unsigned char   *dev_dyntrans_data[MAX_DEVICES];
76    
77  #ifdef BINTRANS          int             dev_dyntrans_alignment;
78          uint64_t        dev_bintrans_write_low[MAX_DEVICES];  
79          uint64_t        dev_bintrans_write_high[MAX_DEVICES];          uint64_t        dev_dyntrans_write_low[MAX_DEVICES];
80            uint64_t        dev_dyntrans_write_high[MAX_DEVICES];
81    
82    
83            /*
84             *  NOTE/TODO: This bintrans was for MIPS only. Ugly. :-/
85             */
86    
87          /*          /*
88           *  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 107  struct memory {
107          int             quick_jump_page_offset[MAX_QUICK_JUMPS];          int             quick_jump_page_offset[MAX_QUICK_JUMPS];
108          int             n_quick_jumps;          int             n_quick_jumps;
109          int             quick_jumps_index;          int             quick_jumps_index;
 #endif  
110  };  };
111    
112  #define BITS_PER_PAGETABLE      20  #define BITS_PER_PAGETABLE      20
# Line 118  struct memory { Line 123  struct memory {
123    
124  #define CACHE_FLAGS_MASK                0x3  #define CACHE_FLAGS_MASK                0x3
125    
126  #define NO_EXCEPTIONS                   8  #define NO_EXCEPTIONS                   16
127  #define PHYSICAL                        16  #define PHYSICAL                        32
128    #define NO_SEGMENTATION                 64      /*  for X86  */
129    #define MEMORY_USER_ACCESS              128     /*  for ARM, at least  */
130    
131    
132  /*  memory.c:  */  /*  memory.c:  */
# Line 129  void memory_writemax64(struct cpu *cpu, Line 136  void memory_writemax64(struct cpu *cpu,
136    
137  void *zeroed_alloc(size_t s);  void *zeroed_alloc(size_t s);
138    
139  struct memory *memory_new(uint64_t physical_max);  struct memory *memory_new(uint64_t physical_max, int arch);
140    
141  int memory_points_to_string(struct cpu *cpu, struct memory *mem,  int memory_points_to_string(struct cpu *cpu, struct memory *mem,
142          uint64_t addr, int min_string_length);          uint64_t addr, int min_string_length);
# Line 143  unsigned char *memory_paddr_to_hostaddr( Line 150  unsigned char *memory_paddr_to_hostaddr(
150  unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr,  unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr,
151          int writeflag);          int writeflag);
152    
153    /*  MIPS stuff:  */
154  int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr,  int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr,
155          uint64_t *return_addr, int flags);          uint64_t *return_addr, int flags);
156  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 162  int translate_address_mmu4100(struct cpu
162  int translate_address_generic(struct cpu *cpu, uint64_t vaddr,  int translate_address_generic(struct cpu *cpu, uint64_t vaddr,
163          uint64_t *return_addr, int flags);          uint64_t *return_addr, int flags);
164    
165    
166  #define FLAG_WRITEFLAG          1  #define FLAG_WRITEFLAG          1
167  #define FLAG_NOEXCEPTIONS       2  #define FLAG_NOEXCEPTIONS       2
168  #define FLAG_INSTR              4  #define FLAG_INSTR              4
# Line 163  int userland_memory_rw(struct cpu *cpu, Line 172  int userland_memory_rw(struct cpu *cpu,
172  #define MEMORY_ACCESS_FAILED    0  #define MEMORY_ACCESS_FAILED    0
173  #define MEMORY_ACCESS_OK        1  #define MEMORY_ACCESS_OK        1
174    
175  void memory_device_bintrans_access(struct cpu *, struct memory *mem,  void memory_device_dyntrans_access(struct cpu *, struct memory *mem,
176          void *extra, uint64_t *low, uint64_t *high);          void *extra, uint64_t *low, uint64_t *high);
177    
178  void memory_device_register_statefunction(  void memory_device_register_statefunction(
# Line 175  void memory_device_register_statefunctio Line 184  void memory_device_register_statefunctio
184  void memory_device_register(struct memory *mem, const char *,  void memory_device_register(struct memory *mem, const char *,
185          uint64_t baseaddr, uint64_t len, int (*f)(struct cpu *,          uint64_t baseaddr, uint64_t len, int (*f)(struct cpu *,
186              struct memory *,uint64_t,unsigned char *,size_t,int,void *),              struct memory *,uint64_t,unsigned char *,size_t,int,void *),
187          void *extra, int flags, unsigned char *bintrans_data);          void *extra, int flags, unsigned char *dyntrans_data);
188  void memory_device_remove(struct memory *mem, int i);  void memory_device_remove(struct memory *mem, int i);
189    
190  #define MEM_DEFAULT                     0  /*  Bit flags:  */
191  #define MEM_BINTRANS_OK                 1  #define MEM_DEFAULT                             0
192  #define MEM_BINTRANS_WRITE_OK           2  #define MEM_DYNTRANS_OK                         1
193    #define MEM_DYNTRANS_WRITE_OK                   2
194    #define MEM_READING_HAS_NO_SIDE_EFFECTS         4
195    
196    
197  #endif  /*  MEMORY_H  */  #endif  /*  MEMORY_H  */

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

  ViewVC Help
Powered by ViewVC 1.1.26