--- trunk/src/include/memory.h 2007/10/08 16:18:00 4 +++ trunk/src/include/memory.h 2007/10/08 16:18:38 12 @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * - * $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 $ * * Memory controller related functions. */ @@ -72,11 +72,17 @@ int (*dev_f_state[MAX_DEVICES])(struct cpu *, struct memory *, void *extra, int wf, int nr, int *type, char **namep, void **data, size_t *len); - unsigned char *dev_bintrans_data[MAX_DEVICES]; + unsigned char *dev_dyntrans_data[MAX_DEVICES]; -#ifdef BINTRANS - uint64_t dev_bintrans_write_low[MAX_DEVICES]; - uint64_t dev_bintrans_write_high[MAX_DEVICES]; + int dev_dyntrans_alignment; + + uint64_t dev_dyntrans_write_low[MAX_DEVICES]; + uint64_t dev_dyntrans_write_high[MAX_DEVICES]; + + + /* + * NOTE/TODO: This bintrans was for MIPS only. Ugly. :-/ + */ /* * translation_code_chunk_space is a large chunk of (linear) memory @@ -101,7 +107,6 @@ int quick_jump_page_offset[MAX_QUICK_JUMPS]; int n_quick_jumps; int quick_jumps_index; -#endif }; #define BITS_PER_PAGETABLE 20 @@ -118,8 +123,9 @@ #define CACHE_FLAGS_MASK 0x3 -#define NO_EXCEPTIONS 8 -#define PHYSICAL 16 +#define NO_EXCEPTIONS 16 +#define PHYSICAL 32 +#define NO_SEGMENTATION 64 /* for X86 */ /* memory.c: */ @@ -129,7 +135,7 @@ void *zeroed_alloc(size_t s); -struct memory *memory_new(uint64_t physical_max); +struct memory *memory_new(uint64_t physical_max, int arch); int memory_points_to_string(struct cpu *cpu, struct memory *mem, uint64_t addr, int min_string_length); @@ -143,6 +149,7 @@ unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr, int writeflag); +/* MIPS stuff: */ int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr, uint64_t *return_addr, int flags); int translate_address_mmu8k(struct cpu *cpu, uint64_t vaddr, @@ -154,6 +161,11 @@ int translate_address_generic(struct cpu *cpu, uint64_t vaddr, uint64_t *return_addr, int flags); +/* X86 stuff: */ +int translate_address_x86(struct cpu *cpu, uint64_t vaddr, + uint64_t *return_addr, int flags); + + #define FLAG_WRITEFLAG 1 #define FLAG_NOEXCEPTIONS 2 #define FLAG_INSTR 4 @@ -163,7 +175,7 @@ #define MEMORY_ACCESS_FAILED 0 #define MEMORY_ACCESS_OK 1 -void memory_device_bintrans_access(struct cpu *, struct memory *mem, +void memory_device_dyntrans_access(struct cpu *, struct memory *mem, void *extra, uint64_t *low, uint64_t *high); void memory_device_register_statefunction( @@ -175,12 +187,14 @@ void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int (*f)(struct cpu *, struct memory *,uint64_t,unsigned char *,size_t,int,void *), - void *extra, int flags, unsigned char *bintrans_data); + void *extra, int flags, unsigned char *dyntrans_data); void memory_device_remove(struct memory *mem, int i); -#define MEM_DEFAULT 0 -#define MEM_BINTRANS_OK 1 -#define MEM_BINTRANS_WRITE_OK 2 +/* Bit flags: */ +#define MEM_DEFAULT 0 +#define MEM_DYNTRANS_OK 1 +#define MEM_DYNTRANS_WRITE_OK 2 +#define MEM_READING_HAS_NO_SIDE_EFFECTS 4 #endif /* MEMORY_H */