28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: cpu_avr.h,v 1.4 2005/09/17 22:34:53 debug Exp $ |
* $Id: cpu_avr.h,v 1.10 2005/11/16 21:15:19 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include "misc.h" |
#include "misc.h" |
49 |
|
|
50 |
struct avr_instr_call { |
struct avr_instr_call { |
51 |
void (*f)(struct cpu *, struct avr_instr_call *); |
void (*f)(struct cpu *, struct avr_instr_call *); |
52 |
|
int len; |
53 |
size_t arg[AVR_N_IC_ARGS]; |
size_t arg[AVR_N_IC_ARGS]; |
54 |
}; |
}; |
55 |
|
|
56 |
/* Translation cache struct for each physical page: */ |
/* Translation cache struct for each physical page: */ |
57 |
struct avr_tc_physpage { |
struct avr_tc_physpage { |
58 |
|
struct avr_instr_call ics[AVR_IC_ENTRIES_PER_PAGE + 1]; |
59 |
uint32_t next_ofs; /* or 0 for end of chain */ |
uint32_t next_ofs; /* or 0 for end of chain */ |
60 |
uint32_t physaddr; |
uint32_t physaddr; |
61 |
int flags; |
int flags; |
|
struct avr_instr_call ics[AVR_IC_ENTRIES_PER_PAGE + 1]; |
|
62 |
}; |
}; |
63 |
|
|
64 |
|
|
66 |
|
|
67 |
#define AVR_MAX_VPH_TLB_ENTRIES 256 |
#define AVR_MAX_VPH_TLB_ENTRIES 256 |
68 |
struct avr_vpg_tlb_entry { |
struct avr_vpg_tlb_entry { |
69 |
int valid; |
unsigned char valid; |
70 |
int writeflag; |
unsigned char writeflag; |
|
int64_t timestamp; |
|
|
unsigned char *host_page; |
|
71 |
uint32_t vaddr_page; |
uint32_t vaddr_page; |
72 |
uint32_t paddr_page; |
uint32_t paddr_page; |
73 |
|
unsigned char *host_page; |
74 |
}; |
}; |
75 |
|
|
76 |
|
|
117 |
struct avr_instr_call *cur_ic_page; |
struct avr_instr_call *cur_ic_page; |
118 |
struct avr_instr_call *next_ic; |
struct avr_instr_call *next_ic; |
119 |
|
|
120 |
|
void (*combination_check)(struct cpu *, |
121 |
|
struct avr_instr_call *, int low_addr); |
122 |
|
|
123 |
/* |
/* |
124 |
* Virtual -> physical -> host address translation: |
* Virtual -> physical -> host address translation: |
133 |
unsigned char *host_store[AVR_N_VPH_ENTRIES]; |
unsigned char *host_store[AVR_N_VPH_ENTRIES]; |
134 |
uint32_t phys_addr[AVR_N_VPH_ENTRIES]; |
uint32_t phys_addr[AVR_N_VPH_ENTRIES]; |
135 |
struct avr_tc_physpage *phys_page[AVR_N_VPH_ENTRIES]; |
struct avr_tc_physpage *phys_page[AVR_N_VPH_ENTRIES]; |
136 |
|
|
137 |
|
uint32_t phystranslation[AVR_N_VPH_ENTRIES/32]; |
138 |
|
uint8_t vaddr_to_tlbindex[AVR_N_VPH_ENTRIES]; |
139 |
}; |
}; |
140 |
|
|
141 |
|
|
142 |
/* cpu_avr.c: */ |
/* cpu_avr.c: */ |
143 |
void avr_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
void avr_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
144 |
unsigned char *host_page, int writeflag, uint64_t paddr_page); |
unsigned char *host_page, int writeflag, uint64_t paddr_page); |
145 |
void avr_invalidate_translation_caches_paddr(struct cpu *cpu, uint64_t, int); |
void avr_invalidate_translation_caches(struct cpu *cpu, uint64_t, int); |
146 |
void avr_invalidate_code_translation(struct cpu *cpu, uint64_t, int); |
void avr_invalidate_code_translation(struct cpu *cpu, uint64_t, int); |
147 |
int avr_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr, |
int avr_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr, |
148 |
unsigned char *data, size_t len, int writeflag, int cache_flags); |
unsigned char *data, size_t len, int writeflag, int cache_flags); |