/[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 12 by dpavlin, Mon Oct 8 16:18:38 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.35 2005/07/19 10:48:07 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    
130    
131  /*  memory.c:  */  /*  memory.c:  */
# Line 129  void memory_writemax64(struct cpu *cpu, Line 135  void memory_writemax64(struct cpu *cpu,
135    
136  void *zeroed_alloc(size_t s);  void *zeroed_alloc(size_t s);
137    
138  struct memory *memory_new(uint64_t physical_max);  struct memory *memory_new(uint64_t physical_max, int arch);
139    
140  int memory_points_to_string(struct cpu *cpu, struct memory *mem,  int memory_points_to_string(struct cpu *cpu, struct memory *mem,
141          uint64_t addr, int min_string_length);          uint64_t addr, int min_string_length);
# Line 143  unsigned char *memory_paddr_to_hostaddr( Line 149  unsigned char *memory_paddr_to_hostaddr(
149  unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr,  unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr,
150          int writeflag);          int writeflag);
151    
152    /*  MIPS stuff:  */
153  int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr,  int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr,
154          uint64_t *return_addr, int flags);          uint64_t *return_addr, int flags);
155  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 161  int translate_address_mmu4100(struct cpu
161  int translate_address_generic(struct cpu *cpu, uint64_t vaddr,  int translate_address_generic(struct cpu *cpu, uint64_t vaddr,
162          uint64_t *return_addr, int flags);          uint64_t *return_addr, int flags);
163    
164    /*  X86 stuff:  */
165    int translate_address_x86(struct cpu *cpu, uint64_t vaddr,
166            uint64_t *return_addr, int flags);
167    
168    
169  #define FLAG_WRITEFLAG          1  #define FLAG_WRITEFLAG          1
170  #define FLAG_NOEXCEPTIONS       2  #define FLAG_NOEXCEPTIONS       2
171  #define FLAG_INSTR              4  #define FLAG_INSTR              4
# Line 163  int userland_memory_rw(struct cpu *cpu, Line 175  int userland_memory_rw(struct cpu *cpu,
175  #define MEMORY_ACCESS_FAILED    0  #define MEMORY_ACCESS_FAILED    0
176  #define MEMORY_ACCESS_OK        1  #define MEMORY_ACCESS_OK        1
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    
199    
200  #endif  /*  MEMORY_H  */  #endif  /*  MEMORY_H  */

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

  ViewVC Help
Powered by ViewVC 1.1.26