28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: memory.h,v 1.32 2005/05/23 14:22:03 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 |
*/ |
*/ |
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 |
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 |
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); |
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( |
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 |
/* Bit flags: */ |
/* Bit flags: */ |
194 |
#define MEM_DEFAULT 0 |
#define MEM_DEFAULT 0 |
195 |
#define MEM_BINTRANS_OK 1 |
#define MEM_DYNTRANS_OK 1 |
196 |
#define MEM_BINTRANS_WRITE_OK 2 |
#define MEM_DYNTRANS_WRITE_OK 2 |
197 |
#define MEM_READING_HAS_NO_SIDE_EFFECTS 4 |
#define MEM_READING_HAS_NO_SIDE_EFFECTS 4 |
198 |
|
|
199 |
|
|