2 |
#define CPU_SH_H |
#define CPU_SH_H |
3 |
|
|
4 |
/* |
/* |
5 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2007 Anders Gavare. All rights reserved. |
6 |
* |
* |
7 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
8 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: cpu_sh.h,v 1.33 2006/10/27 15:51:37 debug Exp $ |
* $Id: cpu_sh.h,v 1.41 2007/04/28 09:19:34 debug Exp $ |
32 |
* |
* |
33 |
* Note: Many things here are SH4-specific, so it probably doesn't work |
* Note: Many things here are SH4-specific, so it probably doesn't work |
34 |
* for SH3 emulation. |
* for SH3 emulation. |
35 |
*/ |
*/ |
36 |
|
|
37 |
|
#include "interrupt.h" |
38 |
#include "misc.h" |
#include "misc.h" |
39 |
#include "sh4_cpu.h" |
#include "sh4_cpu.h" |
40 |
|
|
50 |
uint32_t prr; |
uint32_t prr; |
51 |
}; |
}; |
52 |
|
|
53 |
#define SH_CPU_TYPE_DEFS { \ |
#define SH_CPU_TYPE_DEFS { \ |
54 |
{ "SH7750", 32, 4, SH4_PVR_SH7750, 0 }, \ |
{ "SH7750", 32, 4, SH4_PVR_SH7750, 0 }, \ |
55 |
{ "SH5", 64, 5, 0, 0 }, \ |
{ "SH7750R", 32, 4, SH4_PVR_SH7750, SH4_PRR_7750R }, \ |
56 |
{ NULL, 0, 0, 0, 0 } } |
{ "SH7751R", 32, 4, SH4_PVR_SH7751, SH4_PRR_7751R }, \ |
57 |
|
{ "SH5", 64, 5, 0, 0 }, \ |
58 |
|
{ NULL, 0, 0, 0, 0 } } |
59 |
|
|
60 |
|
|
61 |
/* |
/* |
84 |
#define SH_N_ITLB_ENTRIES 4 |
#define SH_N_ITLB_ENTRIES 4 |
85 |
#define SH_N_UTLB_ENTRIES 64 |
#define SH_N_UTLB_ENTRIES 64 |
86 |
|
|
87 |
|
#define SH_INVALID_INSTR 0x00fb |
88 |
|
|
89 |
|
|
90 |
struct sh_cpu { |
struct sh_cpu { |
91 |
struct sh_cpu_type_def cpu_type; |
struct sh_cpu_type_def cpu_type; |
140 |
uint16_t intc_ipra; /* Interrupt Priority Registers */ |
uint16_t intc_ipra; /* Interrupt Priority Registers */ |
141 |
uint16_t intc_iprb; |
uint16_t intc_iprb; |
142 |
uint16_t intc_iprc; |
uint16_t intc_iprc; |
143 |
|
uint16_t intc_iprd; |
144 |
|
uint32_t intc_intpri00; |
145 |
|
uint32_t intc_intpri04; |
146 |
|
uint32_t intc_intpri08; |
147 |
|
uint32_t intc_intpri0c; |
148 |
|
uint32_t intc_intreq00; |
149 |
|
uint32_t intc_intreq04; |
150 |
|
uint32_t intc_intmsk00; |
151 |
|
uint32_t intc_intmsk04; |
152 |
|
/* Cached and calculated values: */ |
153 |
|
uint8_t int_prio_and_pending[0x1000 / 0x20]; |
154 |
int16_t int_to_assert; /* Calculated int to assert */ |
int16_t int_to_assert; /* Calculated int to assert */ |
155 |
int int_level; /* Calculated int level */ |
unsigned int int_level; /* Calculated int level */ |
|
uint32_t int_pending[0x1000 / 0x20 / (sizeof(uint32_t)*8)]; |
|
156 |
|
|
157 |
/* Timer/clock functionality: */ |
/* Timer/clock functionality: */ |
158 |
int pclock; |
int pclock; |
159 |
|
|
160 |
|
/* DMA Controller: (4 channels) */ |
161 |
|
uint32_t dmac_sar[4]; |
162 |
|
uint32_t dmac_dar[4]; |
163 |
|
uint32_t dmac_tcr[4]; |
164 |
|
uint32_t dmac_chcr[4]; |
165 |
|
|
166 |
|
/* PCI controller: */ |
167 |
|
struct pci_data *pcic_pcibus; |
168 |
|
|
169 |
|
|
170 |
/* |
/* |
171 |
* Instruction translation cache and Virtual->Physical->Host |
* Instruction translation cache and Virtual->Physical->Host |
173 |
*/ |
*/ |
174 |
DYNTRANS_ITC(sh) |
DYNTRANS_ITC(sh) |
175 |
VPH_TLBS(sh,SH) |
VPH_TLBS(sh,SH) |
176 |
VPH32(sh,SH,uint64_t,uint8_t) |
VPH32(sh,SH,uint32_t,uint8_t) |
177 |
}; |
}; |
178 |
|
|
179 |
|
|
215 |
#define SH_FPSCR_FR 0x00200000 /* Register Bank Select */ |
#define SH_FPSCR_FR 0x00200000 /* Register Bank Select */ |
216 |
|
|
217 |
|
|
218 |
|
/* int_prio_and_pending bits: */ |
219 |
|
#define SH_INT_ASSERTED 0x10 |
220 |
|
#define SH_INT_PRIO_MASK 0x0f |
221 |
|
|
222 |
/* cpu_sh.c: */ |
/* cpu_sh.c: */ |
223 |
|
void sh_cpu_interrupt_assert(struct interrupt *interrupt); |
224 |
|
void sh_cpu_interrupt_deassert(struct interrupt *interrupt); |
225 |
int sh_cpu_instruction_has_delayslot(struct cpu *cpu, unsigned char *ib); |
int sh_cpu_instruction_has_delayslot(struct cpu *cpu, unsigned char *ib); |
226 |
int sh_run_instr(struct cpu *cpu); |
int sh_run_instr(struct cpu *cpu); |
227 |
void sh_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
void sh_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
238 |
unsigned char *data, size_t len, int writeflag, int cache_flags); |
unsigned char *data, size_t len, int writeflag, int cache_flags); |
239 |
int sh_cpu_family_init(struct cpu_family *); |
int sh_cpu_family_init(struct cpu_family *); |
240 |
|
|
241 |
|
void sh_update_interrupt_priorities(struct cpu *cpu); |
242 |
void sh_update_sr(struct cpu *cpu, uint32_t new_sr); |
void sh_update_sr(struct cpu *cpu, uint32_t new_sr); |
243 |
void sh_exception(struct cpu *cpu, int expevt, int intevt, uint32_t vaddr); |
void sh_exception(struct cpu *cpu, int expevt, int intevt, uint32_t vaddr); |
244 |
|
|