28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: cpu.h,v 1.43 2005/08/16 05:37:13 debug Exp $ |
* $Id: cpu.h,v 1.54 2005/11/16 21:15:19 debug Exp $ |
32 |
* |
* |
33 |
* See cpu.c. |
* See cpu.c. |
34 |
*/ |
*/ |
41 |
/* This is needed for undefining 'mips' or 'ppc', on weird systems: */ |
/* This is needed for undefining 'mips' or 'ppc', on weird systems: */ |
42 |
#include "../../config.h" |
#include "../../config.h" |
43 |
|
|
|
#include "cpu_arm.h" |
|
44 |
#include "cpu_alpha.h" |
#include "cpu_alpha.h" |
45 |
|
#include "cpu_arm.h" |
46 |
|
#include "cpu_avr.h" |
47 |
|
#include "cpu_hppa.h" |
48 |
|
#include "cpu_i960.h" |
49 |
#include "cpu_ia64.h" |
#include "cpu_ia64.h" |
50 |
#include "cpu_m68k.h" |
#include "cpu_m68k.h" |
51 |
#include "cpu_mips.h" |
#include "cpu_mips.h" |
52 |
|
#include "cpu_newmips.h" |
53 |
#include "cpu_ppc.h" |
#include "cpu_ppc.h" |
54 |
|
#include "cpu_sh.h" |
55 |
#include "cpu_sparc.h" |
#include "cpu_sparc.h" |
56 |
#include "cpu_x86.h" |
#include "cpu_x86.h" |
57 |
|
|
108 |
#define TRANSLATIONS 1 |
#define TRANSLATIONS 1 |
109 |
#define COMBINATIONS 2 |
#define COMBINATIONS 2 |
110 |
|
|
111 |
#define DYNTRANS_CACHE_SIZE (16*1048576) |
#define DYNTRANS_CACHE_SIZE (20*1048576) |
112 |
#define DYNTRANS_CACHE_MARGIN 300000 |
#define DYNTRANS_CACHE_MARGIN 300000 |
113 |
|
|
114 |
#define N_BASE_TABLE_ENTRIES 32768 |
#define N_BASE_TABLE_ENTRIES 32768 |
141 |
void (*update_translation_table)(struct cpu *, |
void (*update_translation_table)(struct cpu *, |
142 |
uint64_t vaddr_page, unsigned char *host_page, |
uint64_t vaddr_page, unsigned char *host_page, |
143 |
int writeflag, uint64_t paddr_page); |
int writeflag, uint64_t paddr_page); |
144 |
void (*invalidate_translation_caches_paddr)(struct cpu *, |
void (*invalidate_translation_caches)(struct cpu *, |
145 |
uint64_t paddr); |
uint64_t paddr, int flags); |
146 |
void (*invalidate_code_translation_caches)(struct cpu *); |
void (*invalidate_code_translation)(struct cpu *, |
147 |
|
uint64_t paddr, int flags); |
148 |
void (*useremul_syscall)(struct cpu *cpu, uint32_t code); |
void (*useremul_syscall)(struct cpu *cpu, uint32_t code); |
149 |
|
|
150 |
uint64_t pc; |
uint64_t pc; |
151 |
|
|
152 |
#ifdef TRACE_NULL_CRASHES |
#ifdef TRACE_NULL_CRASHES |
153 |
|
/* TODO: remove this, it's MIPS only */ |
154 |
int trace_null_index; |
int trace_null_index; |
155 |
uint64_t trace_null_addr[TRACE_NULL_N_ENTRIES]; |
uint64_t trace_null_addr[TRACE_NULL_N_ENTRIES]; |
156 |
#endif |
#endif |
171 |
union { |
union { |
172 |
struct alpha_cpu alpha; |
struct alpha_cpu alpha; |
173 |
struct arm_cpu arm; |
struct arm_cpu arm; |
174 |
|
struct avr_cpu avr; |
175 |
|
struct hppa_cpu hppa; |
176 |
|
struct i960_cpu i960; |
177 |
struct ia64_cpu ia64; |
struct ia64_cpu ia64; |
178 |
struct m68k_cpu m68k; |
struct m68k_cpu m68k; |
179 |
struct mips_cpu mips; |
struct mips_cpu mips; |
180 |
|
struct newmips_cpu newmips; |
181 |
struct ppc_cpu ppc; |
struct ppc_cpu ppc; |
182 |
|
struct sh_cpu sh; |
183 |
struct sparc_cpu sparc; |
struct sparc_cpu sparc; |
184 |
struct x86_cpu x86; |
struct x86_cpu x86; |
185 |
} cd; |
} cd; |
212 |
void cpu_init(void); |
void cpu_init(void); |
213 |
|
|
214 |
|
|
215 |
|
#define JUST_MARK_AS_NON_WRITABLE 1 |
216 |
|
#define INVALIDATE_ALL 2 |
217 |
|
#define INVALIDATE_PADDR 4 |
218 |
|
#define INVALIDATE_VADDR 8 |
219 |
|
|
220 |
|
#define TLB_CODE 0x02 |
221 |
|
|
222 |
|
|
223 |
#define CPU_FAMILY_INIT(n,s) int n ## _cpu_family_init( \ |
#define CPU_FAMILY_INIT(n,s) int n ## _cpu_family_init( \ |
224 |
struct cpu_family *fp) { \ |
struct cpu_family *fp) { \ |
225 |
/* Fill in the cpu_family struct with valid data for this arch. */ \ |
/* Fill in the cpu_family struct with valid data for this arch. */ \ |
226 |
fp->name = s; \ |
fp->name = s; \ |
227 |
|
fp->cpu_new = n ## _cpu_new; \ |
228 |
|
fp->list_available_types = n ## _cpu_list_available_types; \ |
229 |
|
fp->register_match = n ## _cpu_register_match; \ |
230 |
|
fp->disassemble_instr = n ## _cpu_disassemble_instr; \ |
231 |
|
fp->register_dump = n ## _cpu_register_dump; \ |
232 |
|
fp->run = n ## _cpu_run; \ |
233 |
|
fp->dumpinfo = n ## _cpu_dumpinfo; \ |
234 |
|
fp->interrupt = n ## _cpu_interrupt; \ |
235 |
|
fp->interrupt_ack = n ## _cpu_interrupt_ack; \ |
236 |
|
fp->functioncall_trace = n ## _cpu_functioncall_trace; \ |
237 |
|
return 1; \ |
238 |
|
} |
239 |
|
|
240 |
|
#define CPU_OLD_FAMILY_INIT(n,s) int n ## _cpu_family_init( \ |
241 |
|
struct cpu_family *fp) { \ |
242 |
|
/* Fill in the cpu_family struct with valid data for this arch. */ \ |
243 |
|
fp->name = s; \ |
244 |
fp->cpu_new = n ## _cpu_new; \ |
fp->cpu_new = n ## _cpu_new; \ |
245 |
fp->list_available_types = n ## _cpu_list_available_types; \ |
fp->list_available_types = n ## _cpu_list_available_types; \ |
246 |
fp->register_match = n ## _cpu_register_match; \ |
fp->register_match = n ## _cpu_register_match; \ |