root / target-mips / translate_init.c @ 29b358f9
History | View | Annotate | Download (24.7 kB)
1 | 33d68b5f | ths | /*
|
---|---|---|---|
2 | 33d68b5f | ths | * MIPS emulation for qemu: CPU initialisation routines.
|
3 | 33d68b5f | ths | *
|
4 | 33d68b5f | ths | * Copyright (c) 2004-2005 Jocelyn Mayer
|
5 | 33d68b5f | ths | * Copyright (c) 2007 Herve Poussineau
|
6 | 33d68b5f | ths | *
|
7 | 33d68b5f | ths | * This library is free software; you can redistribute it and/or
|
8 | 33d68b5f | ths | * modify it under the terms of the GNU Lesser General Public
|
9 | 33d68b5f | ths | * License as published by the Free Software Foundation; either
|
10 | 33d68b5f | ths | * version 2 of the License, or (at your option) any later version.
|
11 | 33d68b5f | ths | *
|
12 | 33d68b5f | ths | * This library is distributed in the hope that it will be useful,
|
13 | 33d68b5f | ths | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | 33d68b5f | ths | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 | 33d68b5f | ths | * Lesser General Public License for more details.
|
16 | 33d68b5f | ths | *
|
17 | 33d68b5f | ths | * You should have received a copy of the GNU Lesser General Public
|
18 | 8167ee88 | Blue Swirl | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
19 | 33d68b5f | ths | */
|
20 | 33d68b5f | ths | |
21 | 3953d786 | ths | /* CPU / CPU family specific config register values. */
|
22 | 3953d786 | ths | |
23 | 6d35524c | ths | /* Have config1, uncached coherency */
|
24 | 3953d786 | ths | #define MIPS_CONFIG0 \
|
25 | 6d35524c | ths | ((1 << CP0C0_M) | (0x2 << CP0C0_K0)) |
26 | 3953d786 | ths | |
27 | ae5d8053 | ths | /* Have config2, no coprocessor2 attached, no MDMX support attached,
|
28 | 3953d786 | ths | no performance counters, watch registers present,
|
29 | 3953d786 | ths | no code compression, EJTAG present, no FPU */
|
30 | 3953d786 | ths | #define MIPS_CONFIG1 \
|
31 | fcb4a419 | ths | ((1 << CP0C1_M) | \
|
32 | 3953d786 | ths | (0 << CP0C1_C2) | (0 << CP0C1_MD) | (0 << CP0C1_PC) | \ |
33 | 3953d786 | ths | (1 << CP0C1_WR) | (0 << CP0C1_CA) | (1 << CP0C1_EP) | \ |
34 | 3953d786 | ths | (0 << CP0C1_FP))
|
35 | 3953d786 | ths | |
36 | 3953d786 | ths | /* Have config3, no tertiary/secondary caches implemented */
|
37 | 3953d786 | ths | #define MIPS_CONFIG2 \
|
38 | 3953d786 | ths | ((1 << CP0C2_M))
|
39 | 3953d786 | ths | |
40 | 6d35524c | ths | /* No config4, no DSP ASE, no large physaddr (PABITS),
|
41 | ff2712ba | Stefan Weil | no external interrupt controller, no vectored interrupts,
|
42 | ead9360e | ths | no 1kb pages, no SmartMIPS ASE, no trace logic */
|
43 | 3953d786 | ths | #define MIPS_CONFIG3 \
|
44 | 3953d786 | ths | ((0 << CP0C3_M) | (0 << CP0C3_DSPP) | (0 << CP0C3_LPA) | \ |
45 | 3953d786 | ths | (0 << CP0C3_VEIC) | (0 << CP0C3_VInt) | (0 << CP0C3_SP) | \ |
46 | ead9360e | ths | (0 << CP0C3_SM) | (0 << CP0C3_TL)) |
47 | 3953d786 | ths | |
48 | 6d35524c | ths | /* MMU types, the first four entries have the same layout as the
|
49 | 6d35524c | ths | CP0C0_MT field. */
|
50 | 6d35524c | ths | enum mips_mmu_types {
|
51 | 6d35524c | ths | MMU_TYPE_NONE, |
52 | 6d35524c | ths | MMU_TYPE_R4000, |
53 | 6d35524c | ths | MMU_TYPE_RESERVED, |
54 | 6d35524c | ths | MMU_TYPE_FMT, |
55 | 6d35524c | ths | MMU_TYPE_R3000, |
56 | 6d35524c | ths | MMU_TYPE_R6000, |
57 | 6d35524c | ths | MMU_TYPE_R8000 |
58 | 6d35524c | ths | }; |
59 | 6d35524c | ths | |
60 | c227f099 | Anthony Liguori | struct mips_def_t {
|
61 | 50366fe9 | ths | const char *name; |
62 | 33d68b5f | ths | int32_t CP0_PRid; |
63 | 33d68b5f | ths | int32_t CP0_Config0; |
64 | 33d68b5f | ths | int32_t CP0_Config1; |
65 | 3953d786 | ths | int32_t CP0_Config2; |
66 | 3953d786 | ths | int32_t CP0_Config3; |
67 | 34ee2ede | ths | int32_t CP0_Config6; |
68 | 34ee2ede | ths | int32_t CP0_Config7; |
69 | 2a6e32dd | Aurelien Jarno | target_ulong CP0_LLAddr_rw_bitmask; |
70 | 2a6e32dd | Aurelien Jarno | int CP0_LLAddr_shift;
|
71 | 2f644545 | ths | int32_t SYNCI_Step; |
72 | 2f644545 | ths | int32_t CCRes; |
73 | ead9360e | ths | int32_t CP0_Status_rw_bitmask; |
74 | ead9360e | ths | int32_t CP0_TCStatus_rw_bitmask; |
75 | ead9360e | ths | int32_t CP0_SRSCtl; |
76 | 3953d786 | ths | int32_t CP1_fcr0; |
77 | e034e2c3 | ths | int32_t SEGBITS; |
78 | 6d35524c | ths | int32_t PABITS; |
79 | ead9360e | ths | int32_t CP0_SRSConf0_rw_bitmask; |
80 | ead9360e | ths | int32_t CP0_SRSConf0; |
81 | ead9360e | ths | int32_t CP0_SRSConf1_rw_bitmask; |
82 | ead9360e | ths | int32_t CP0_SRSConf1; |
83 | ead9360e | ths | int32_t CP0_SRSConf2_rw_bitmask; |
84 | ead9360e | ths | int32_t CP0_SRSConf2; |
85 | ead9360e | ths | int32_t CP0_SRSConf3_rw_bitmask; |
86 | ead9360e | ths | int32_t CP0_SRSConf3; |
87 | ead9360e | ths | int32_t CP0_SRSConf4_rw_bitmask; |
88 | ead9360e | ths | int32_t CP0_SRSConf4; |
89 | e189e748 | ths | int insn_flags;
|
90 | 6d35524c | ths | enum mips_mmu_types mmu_type;
|
91 | 33d68b5f | ths | }; |
92 | 33d68b5f | ths | |
93 | 33d68b5f | ths | /*****************************************************************************/
|
94 | 33d68b5f | ths | /* MIPS CPU definitions */
|
95 | c227f099 | Anthony Liguori | static const mips_def_t mips_defs[] = |
96 | 33d68b5f | ths | { |
97 | 33d68b5f | ths | { |
98 | 33d68b5f | ths | .name = "4Kc",
|
99 | 33d68b5f | ths | .CP0_PRid = 0x00018000,
|
100 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_R4000 << CP0C0_MT), |
101 | ae5d8053 | ths | .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
|
102 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
103 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
104 | ab3aee26 | Stefan Weil | (0 << CP0C1_CA),
|
105 | 3953d786 | ths | .CP0_Config2 = MIPS_CONFIG2, |
106 | 3953d786 | ths | .CP0_Config3 = MIPS_CONFIG3, |
107 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
108 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
109 | 2f644545 | ths | .SYNCI_Step = 32,
|
110 | 2f644545 | ths | .CCRes = 2,
|
111 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x1278FF17,
|
112 | 6d35524c | ths | .SEGBITS = 32,
|
113 | 6d35524c | ths | .PABITS = 32,
|
114 | 73642f5b | Stefan Weil | .insn_flags = CPU_MIPS32, |
115 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
116 | 33d68b5f | ths | }, |
117 | 33d68b5f | ths | { |
118 | 8d162c2b | ths | .name = "4Km",
|
119 | 8d162c2b | ths | .CP0_PRid = 0x00018300,
|
120 | 8d162c2b | ths | /* Config1 implemented, fixed mapping MMU,
|
121 | 8d162c2b | ths | no virtual icache, uncached coherency. */
|
122 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_FMT << CP0C0_MT), |
123 | 8d162c2b | ths | .CP0_Config1 = MIPS_CONFIG1 | |
124 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
125 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
126 | d19954f4 | Nathan Froyd | (1 << CP0C1_CA),
|
127 | 8d162c2b | ths | .CP0_Config2 = MIPS_CONFIG2, |
128 | 8d162c2b | ths | .CP0_Config3 = MIPS_CONFIG3, |
129 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
130 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
131 | 8d162c2b | ths | .SYNCI_Step = 32,
|
132 | 8d162c2b | ths | .CCRes = 2,
|
133 | 8d162c2b | ths | .CP0_Status_rw_bitmask = 0x1258FF17,
|
134 | 6d35524c | ths | .SEGBITS = 32,
|
135 | 6d35524c | ths | .PABITS = 32,
|
136 | 8d162c2b | ths | .insn_flags = CPU_MIPS32 | ASE_MIPS16, |
137 | 6d35524c | ths | .mmu_type = MMU_TYPE_FMT, |
138 | 8d162c2b | ths | }, |
139 | 8d162c2b | ths | { |
140 | 34ee2ede | ths | .name = "4KEcR1",
|
141 | 33d68b5f | ths | .CP0_PRid = 0x00018400,
|
142 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_R4000 << CP0C0_MT), |
143 | ae5d8053 | ths | .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
|
144 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
145 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
146 | ab3aee26 | Stefan Weil | (0 << CP0C1_CA),
|
147 | 34ee2ede | ths | .CP0_Config2 = MIPS_CONFIG2, |
148 | 34ee2ede | ths | .CP0_Config3 = MIPS_CONFIG3, |
149 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
150 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
151 | 2f644545 | ths | .SYNCI_Step = 32,
|
152 | 2f644545 | ths | .CCRes = 2,
|
153 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x1278FF17,
|
154 | 6d35524c | ths | .SEGBITS = 32,
|
155 | 6d35524c | ths | .PABITS = 32,
|
156 | 73642f5b | Stefan Weil | .insn_flags = CPU_MIPS32, |
157 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
158 | 34ee2ede | ths | }, |
159 | 34ee2ede | ths | { |
160 | 8d162c2b | ths | .name = "4KEmR1",
|
161 | 8d162c2b | ths | .CP0_PRid = 0x00018500,
|
162 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_FMT << CP0C0_MT), |
163 | 8d162c2b | ths | .CP0_Config1 = MIPS_CONFIG1 | |
164 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
165 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
166 | d19954f4 | Nathan Froyd | (1 << CP0C1_CA),
|
167 | 8d162c2b | ths | .CP0_Config2 = MIPS_CONFIG2, |
168 | 8d162c2b | ths | .CP0_Config3 = MIPS_CONFIG3, |
169 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
170 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
171 | 8d162c2b | ths | .SYNCI_Step = 32,
|
172 | 8d162c2b | ths | .CCRes = 2,
|
173 | 8d162c2b | ths | .CP0_Status_rw_bitmask = 0x1258FF17,
|
174 | 6d35524c | ths | .SEGBITS = 32,
|
175 | 6d35524c | ths | .PABITS = 32,
|
176 | 8d162c2b | ths | .insn_flags = CPU_MIPS32 | ASE_MIPS16, |
177 | 6d35524c | ths | .mmu_type = MMU_TYPE_FMT, |
178 | 8d162c2b | ths | }, |
179 | 8d162c2b | ths | { |
180 | 34ee2ede | ths | .name = "4KEc",
|
181 | 34ee2ede | ths | .CP0_PRid = 0x00019000,
|
182 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
183 | 6d35524c | ths | (MMU_TYPE_R4000 << CP0C0_MT), |
184 | ae5d8053 | ths | .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
|
185 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
186 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
187 | ab3aee26 | Stefan Weil | (0 << CP0C1_CA),
|
188 | 34ee2ede | ths | .CP0_Config2 = MIPS_CONFIG2, |
189 | ead9360e | ths | .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt),
|
190 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
191 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
192 | 2f644545 | ths | .SYNCI_Step = 32,
|
193 | 2f644545 | ths | .CCRes = 2,
|
194 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x1278FF17,
|
195 | 6d35524c | ths | .SEGBITS = 32,
|
196 | 6d35524c | ths | .PABITS = 32,
|
197 | 73642f5b | Stefan Weil | .insn_flags = CPU_MIPS32R2, |
198 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
199 | 34ee2ede | ths | }, |
200 | 34ee2ede | ths | { |
201 | 3e4587d5 | ths | .name = "4KEm",
|
202 | 3e4587d5 | ths | .CP0_PRid = 0x00019100,
|
203 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
204 | 6958549d | aurel32 | (MMU_TYPE_FMT << CP0C0_MT), |
205 | 3e4587d5 | ths | .CP0_Config1 = MIPS_CONFIG1 | |
206 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
207 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
208 | d19954f4 | Nathan Froyd | (1 << CP0C1_CA),
|
209 | 3e4587d5 | ths | .CP0_Config2 = MIPS_CONFIG2, |
210 | 3e4587d5 | ths | .CP0_Config3 = MIPS_CONFIG3, |
211 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
212 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
213 | 3e4587d5 | ths | .SYNCI_Step = 32,
|
214 | 3e4587d5 | ths | .CCRes = 2,
|
215 | 3e4587d5 | ths | .CP0_Status_rw_bitmask = 0x1258FF17,
|
216 | 6d35524c | ths | .SEGBITS = 32,
|
217 | 6d35524c | ths | .PABITS = 32,
|
218 | 3e4587d5 | ths | .insn_flags = CPU_MIPS32R2 | ASE_MIPS16, |
219 | 6d35524c | ths | .mmu_type = MMU_TYPE_FMT, |
220 | 3e4587d5 | ths | }, |
221 | 3e4587d5 | ths | { |
222 | 34ee2ede | ths | .name = "24Kc",
|
223 | 34ee2ede | ths | .CP0_PRid = 0x00019300,
|
224 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
225 | 6958549d | aurel32 | (MMU_TYPE_R4000 << CP0C0_MT), |
226 | ae5d8053 | ths | .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
|
227 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
228 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
229 | d19954f4 | Nathan Froyd | (1 << CP0C1_CA),
|
230 | 3953d786 | ths | .CP0_Config2 = MIPS_CONFIG2, |
231 | ead9360e | ths | .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt),
|
232 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
233 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
234 | 2f644545 | ths | .SYNCI_Step = 32,
|
235 | 2f644545 | ths | .CCRes = 2,
|
236 | ead9360e | ths | /* No DSP implemented. */
|
237 | 671880e6 | ths | .CP0_Status_rw_bitmask = 0x1278FF1F,
|
238 | 6d35524c | ths | .SEGBITS = 32,
|
239 | 6d35524c | ths | .PABITS = 32,
|
240 | 3e4587d5 | ths | .insn_flags = CPU_MIPS32R2 | ASE_MIPS16, |
241 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
242 | 33d68b5f | ths | }, |
243 | 33d68b5f | ths | { |
244 | 33d68b5f | ths | .name = "24Kf",
|
245 | 33d68b5f | ths | .CP0_PRid = 0x00019300,
|
246 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
247 | 6d35524c | ths | (MMU_TYPE_R4000 << CP0C0_MT), |
248 | ae5d8053 | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) | |
249 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
250 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
251 | d19954f4 | Nathan Froyd | (1 << CP0C1_CA),
|
252 | 3953d786 | ths | .CP0_Config2 = MIPS_CONFIG2, |
253 | ead9360e | ths | .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt),
|
254 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
255 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
256 | 2f644545 | ths | .SYNCI_Step = 32,
|
257 | 2f644545 | ths | .CCRes = 2,
|
258 | ead9360e | ths | /* No DSP implemented. */
|
259 | 671880e6 | ths | .CP0_Status_rw_bitmask = 0x3678FF1F,
|
260 | 5a5012ec | ths | .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) | |
261 | 5a5012ec | ths | (1 << FCR0_D) | (1 << FCR0_S) | (0x93 << FCR0_PRID), |
262 | 6d35524c | ths | .SEGBITS = 32,
|
263 | 6d35524c | ths | .PABITS = 32,
|
264 | 3e4587d5 | ths | .insn_flags = CPU_MIPS32R2 | ASE_MIPS16, |
265 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
266 | 33d68b5f | ths | }, |
267 | ead9360e | ths | { |
268 | ead9360e | ths | .name = "34Kf",
|
269 | ead9360e | ths | .CP0_PRid = 0x00019500,
|
270 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
271 | 6958549d | aurel32 | (MMU_TYPE_R4000 << CP0C0_MT), |
272 | ead9360e | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) | |
273 | 6958549d | aurel32 | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
274 | d19954f4 | Nathan Froyd | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
275 | d19954f4 | Nathan Froyd | (1 << CP0C1_CA),
|
276 | ead9360e | ths | .CP0_Config2 = MIPS_CONFIG2, |
277 | ded40088 | Edgar E. Iglesias | .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_VInt) | (1 << CP0C3_MT), |
278 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
279 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 0,
|
280 | ead9360e | ths | .SYNCI_Step = 32,
|
281 | ead9360e | ths | .CCRes = 2,
|
282 | ead9360e | ths | /* No DSP implemented. */
|
283 | 671880e6 | ths | .CP0_Status_rw_bitmask = 0x3678FF1F,
|
284 | ead9360e | ths | /* No DSP implemented. */
|
285 | ead9360e | ths | .CP0_TCStatus_rw_bitmask = (0 << CP0TCSt_TCU3) | (0 << CP0TCSt_TCU2) | |
286 | ead9360e | ths | (1 << CP0TCSt_TCU1) | (1 << CP0TCSt_TCU0) | |
287 | ead9360e | ths | (0 << CP0TCSt_TMX) | (1 << CP0TCSt_DT) | |
288 | ead9360e | ths | (1 << CP0TCSt_DA) | (1 << CP0TCSt_A) | |
289 | ead9360e | ths | (0x3 << CP0TCSt_TKSU) | (1 << CP0TCSt_IXMT) | |
290 | ead9360e | ths | (0xff << CP0TCSt_TASID),
|
291 | ead9360e | ths | .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) | |
292 | ead9360e | ths | (1 << FCR0_D) | (1 << FCR0_S) | (0x95 << FCR0_PRID), |
293 | ead9360e | ths | .CP0_SRSCtl = (0xf << CP0SRSCtl_HSS),
|
294 | ead9360e | ths | .CP0_SRSConf0_rw_bitmask = 0x3fffffff,
|
295 | ead9360e | ths | .CP0_SRSConf0 = (1 << CP0SRSC0_M) | (0x3fe << CP0SRSC0_SRS3) | |
296 | ead9360e | ths | (0x3fe << CP0SRSC0_SRS2) | (0x3fe << CP0SRSC0_SRS1), |
297 | ead9360e | ths | .CP0_SRSConf1_rw_bitmask = 0x3fffffff,
|
298 | ead9360e | ths | .CP0_SRSConf1 = (1 << CP0SRSC1_M) | (0x3fe << CP0SRSC1_SRS6) | |
299 | ead9360e | ths | (0x3fe << CP0SRSC1_SRS5) | (0x3fe << CP0SRSC1_SRS4), |
300 | ead9360e | ths | .CP0_SRSConf2_rw_bitmask = 0x3fffffff,
|
301 | ead9360e | ths | .CP0_SRSConf2 = (1 << CP0SRSC2_M) | (0x3fe << CP0SRSC2_SRS9) | |
302 | ead9360e | ths | (0x3fe << CP0SRSC2_SRS8) | (0x3fe << CP0SRSC2_SRS7), |
303 | ead9360e | ths | .CP0_SRSConf3_rw_bitmask = 0x3fffffff,
|
304 | ead9360e | ths | .CP0_SRSConf3 = (1 << CP0SRSC3_M) | (0x3fe << CP0SRSC3_SRS12) | |
305 | ead9360e | ths | (0x3fe << CP0SRSC3_SRS11) | (0x3fe << CP0SRSC3_SRS10), |
306 | ead9360e | ths | .CP0_SRSConf4_rw_bitmask = 0x3fffffff,
|
307 | ead9360e | ths | .CP0_SRSConf4 = (0x3fe << CP0SRSC4_SRS15) |
|
308 | ead9360e | ths | (0x3fe << CP0SRSC4_SRS14) | (0x3fe << CP0SRSC4_SRS13), |
309 | 6d35524c | ths | .SEGBITS = 32,
|
310 | 6d35524c | ths | .PABITS = 32,
|
311 | 7385ac0b | ths | .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP | ASE_MT, |
312 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
313 | ead9360e | ths | }, |
314 | af13ae03 | Jia Liu | { |
315 | af13ae03 | Jia Liu | .name = "74Kf",
|
316 | af13ae03 | Jia Liu | .CP0_PRid = 0x00019700,
|
317 | af13ae03 | Jia Liu | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
318 | af13ae03 | Jia Liu | (MMU_TYPE_R4000 << CP0C0_MT), |
319 | af13ae03 | Jia Liu | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) | |
320 | af13ae03 | Jia Liu | (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) | |
321 | af13ae03 | Jia Liu | (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) | |
322 | af13ae03 | Jia Liu | (1 << CP0C1_CA),
|
323 | af13ae03 | Jia Liu | .CP0_Config2 = MIPS_CONFIG2, |
324 | af13ae03 | Jia Liu | .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt) | (1 << CP0C3_DSPP), |
325 | af13ae03 | Jia Liu | .CP0_LLAddr_rw_bitmask = 0,
|
326 | af13ae03 | Jia Liu | .CP0_LLAddr_shift = 4,
|
327 | af13ae03 | Jia Liu | .SYNCI_Step = 32,
|
328 | af13ae03 | Jia Liu | .CCRes = 2,
|
329 | af13ae03 | Jia Liu | .CP0_Status_rw_bitmask = 0x3778FF1F,
|
330 | af13ae03 | Jia Liu | .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) | |
331 | af13ae03 | Jia Liu | (1 << FCR0_D) | (1 << FCR0_S) | (0x93 << FCR0_PRID), |
332 | af13ae03 | Jia Liu | .SEGBITS = 32,
|
333 | af13ae03 | Jia Liu | .PABITS = 32,
|
334 | af13ae03 | Jia Liu | .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP | ASE_DSPR2, |
335 | af13ae03 | Jia Liu | .mmu_type = MMU_TYPE_R4000, |
336 | af13ae03 | Jia Liu | }, |
337 | d26bc211 | ths | #if defined(TARGET_MIPS64)
|
338 | 33d68b5f | ths | { |
339 | 33d68b5f | ths | .name = "R4000",
|
340 | 33d68b5f | ths | .CP0_PRid = 0x00000400,
|
341 | 6d35524c | ths | /* No L2 cache, icache size 8k, dcache size 8k, uncached coherency. */
|
342 | 6d35524c | ths | .CP0_Config0 = (1 << 17) | (0x1 << 9) | (0x1 << 6) | (0x2 << CP0C0_K0), |
343 | 6958549d | aurel32 | /* Note: Config1 is only used internally, the R4000 has only Config0. */
|
344 | 6d35524c | ths | .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU), |
345 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0xFFFFFFFF,
|
346 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
347 | 2f644545 | ths | .SYNCI_Step = 16,
|
348 | 2f644545 | ths | .CCRes = 2,
|
349 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x3678FFFF,
|
350 | 6958549d | aurel32 | /* The R4000 has a full 64bit FPU but doesn't use the fcr0 bits. */
|
351 | c9c1a064 | ths | .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x0 << FCR0_REV), |
352 | e034e2c3 | ths | .SEGBITS = 40,
|
353 | 6d35524c | ths | .PABITS = 36,
|
354 | e189e748 | ths | .insn_flags = CPU_MIPS3, |
355 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
356 | c9c1a064 | ths | }, |
357 | e9c71dd1 | ths | { |
358 | e9c71dd1 | ths | .name = "VR5432",
|
359 | e9c71dd1 | ths | .CP0_PRid = 0x00005400,
|
360 | e9c71dd1 | ths | /* No L2 cache, icache size 8k, dcache size 8k, uncached coherency. */
|
361 | e9c71dd1 | ths | .CP0_Config0 = (1 << 17) | (0x1 << 9) | (0x1 << 6) | (0x2 << CP0C0_K0), |
362 | e9c71dd1 | ths | .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU), |
363 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0xFFFFFFFFL,
|
364 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
365 | e9c71dd1 | ths | .SYNCI_Step = 16,
|
366 | e9c71dd1 | ths | .CCRes = 2,
|
367 | e9c71dd1 | ths | .CP0_Status_rw_bitmask = 0x3678FFFF,
|
368 | e9c71dd1 | ths | /* The VR5432 has a full 64bit FPU but doesn't use the fcr0 bits. */
|
369 | e9c71dd1 | ths | .CP1_fcr0 = (0x54 << FCR0_PRID) | (0x0 << FCR0_REV), |
370 | e9c71dd1 | ths | .SEGBITS = 40,
|
371 | e9c71dd1 | ths | .PABITS = 32,
|
372 | e9c71dd1 | ths | .insn_flags = CPU_VR54XX, |
373 | e9c71dd1 | ths | .mmu_type = MMU_TYPE_R4000, |
374 | e9c71dd1 | ths | }, |
375 | c9c1a064 | ths | { |
376 | c9c1a064 | ths | .name = "5Kc",
|
377 | c9c1a064 | ths | .CP0_PRid = 0x00018100,
|
378 | 29fe0e34 | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT) |
|
379 | 6958549d | aurel32 | (MMU_TYPE_R4000 << CP0C0_MT), |
380 | c9c1a064 | ths | .CP0_Config1 = MIPS_CONFIG1 | (31 << CP0C1_MMU) |
|
381 | 6958549d | aurel32 | (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) | |
382 | 6958549d | aurel32 | (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) | |
383 | 6958549d | aurel32 | (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), |
384 | c9c1a064 | ths | .CP0_Config2 = MIPS_CONFIG2, |
385 | c9c1a064 | ths | .CP0_Config3 = MIPS_CONFIG3, |
386 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
387 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
388 | c9c1a064 | ths | .SYNCI_Step = 32,
|
389 | c9c1a064 | ths | .CCRes = 2,
|
390 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x32F8FFFF,
|
391 | e034e2c3 | ths | .SEGBITS = 42,
|
392 | 6d35524c | ths | .PABITS = 36,
|
393 | e189e748 | ths | .insn_flags = CPU_MIPS64, |
394 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
395 | c9c1a064 | ths | }, |
396 | c9c1a064 | ths | { |
397 | c9c1a064 | ths | .name = "5Kf",
|
398 | c9c1a064 | ths | .CP0_PRid = 0x00018100,
|
399 | 29fe0e34 | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT) |
|
400 | 6958549d | aurel32 | (MMU_TYPE_R4000 << CP0C0_MT), |
401 | c9c1a064 | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (31 << CP0C1_MMU) | |
402 | 6958549d | aurel32 | (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) | |
403 | 6958549d | aurel32 | (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) | |
404 | 6958549d | aurel32 | (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), |
405 | c9c1a064 | ths | .CP0_Config2 = MIPS_CONFIG2, |
406 | c9c1a064 | ths | .CP0_Config3 = MIPS_CONFIG3, |
407 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
408 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 4,
|
409 | c9c1a064 | ths | .SYNCI_Step = 32,
|
410 | c9c1a064 | ths | .CCRes = 2,
|
411 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x36F8FFFF,
|
412 | 6958549d | aurel32 | /* The 5Kf has F64 / L / W but doesn't use the fcr0 bits. */
|
413 | c9c1a064 | ths | .CP1_fcr0 = (1 << FCR0_D) | (1 << FCR0_S) | |
414 | c9c1a064 | ths | (0x81 << FCR0_PRID) | (0x0 << FCR0_REV), |
415 | e034e2c3 | ths | .SEGBITS = 42,
|
416 | 6d35524c | ths | .PABITS = 36,
|
417 | e189e748 | ths | .insn_flags = CPU_MIPS64, |
418 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
419 | c9c1a064 | ths | }, |
420 | c9c1a064 | ths | { |
421 | c9c1a064 | ths | .name = "20Kc",
|
422 | 6958549d | aurel32 | /* We emulate a later version of the 20Kc, earlier ones had a broken
|
423 | bd04c6fe | ths | WAIT instruction. */
|
424 | bd04c6fe | ths | .CP0_PRid = 0x000182a0,
|
425 | 29fe0e34 | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT) |
|
426 | 6d35524c | ths | (MMU_TYPE_R4000 << CP0C0_MT) | (1 << CP0C0_VI),
|
427 | c9c1a064 | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (47 << CP0C1_MMU) | |
428 | 6958549d | aurel32 | (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) | |
429 | 6958549d | aurel32 | (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) | |
430 | 6958549d | aurel32 | (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), |
431 | c9c1a064 | ths | .CP0_Config2 = MIPS_CONFIG2, |
432 | c9c1a064 | ths | .CP0_Config3 = MIPS_CONFIG3, |
433 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
434 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 0,
|
435 | c9c1a064 | ths | .SYNCI_Step = 32,
|
436 | a1daafd8 | ths | .CCRes = 1,
|
437 | ead9360e | ths | .CP0_Status_rw_bitmask = 0x36FBFFFF,
|
438 | 6958549d | aurel32 | /* The 20Kc has F64 / L / W but doesn't use the fcr0 bits. */
|
439 | c9c1a064 | ths | .CP1_fcr0 = (1 << FCR0_3D) | (1 << FCR0_PS) | |
440 | 5a5012ec | ths | (1 << FCR0_D) | (1 << FCR0_S) | |
441 | c9c1a064 | ths | (0x82 << FCR0_PRID) | (0x0 << FCR0_REV), |
442 | e034e2c3 | ths | .SEGBITS = 40,
|
443 | 6d35524c | ths | .PABITS = 36,
|
444 | e189e748 | ths | .insn_flags = CPU_MIPS64 | ASE_MIPS3D, |
445 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
446 | 33d68b5f | ths | }, |
447 | d2123ead | ths | { |
448 | 6958549d | aurel32 | /* A generic CPU providing MIPS64 Release 2 features.
|
449 | d2123ead | ths | FIXME: Eventually this should be replaced by a real CPU model. */
|
450 | d2123ead | ths | .name = "MIPS64R2-generic",
|
451 | 8c89395e | ths | .CP0_PRid = 0x00010000,
|
452 | 6d35524c | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) | |
453 | 6958549d | aurel32 | (MMU_TYPE_R4000 << CP0C0_MT), |
454 | d2123ead | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) | |
455 | 6958549d | aurel32 | (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) | |
456 | 6958549d | aurel32 | (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) | |
457 | 6958549d | aurel32 | (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), |
458 | d2123ead | ths | .CP0_Config2 = MIPS_CONFIG2, |
459 | 6d35524c | ths | .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_LPA),
|
460 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_rw_bitmask = 0,
|
461 | 2a6e32dd | Aurelien Jarno | .CP0_LLAddr_shift = 0,
|
462 | d2123ead | ths | .SYNCI_Step = 32,
|
463 | d2123ead | ths | .CCRes = 2,
|
464 | d2123ead | ths | .CP0_Status_rw_bitmask = 0x36FBFFFF,
|
465 | ea4b07f7 | ths | .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_3D) | (1 << FCR0_PS) | |
466 | ea4b07f7 | ths | (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) | |
467 | ea4b07f7 | ths | (1 << FCR0_S) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV), |
468 | 6d35524c | ths | .SEGBITS = 42,
|
469 | 6d35524c | ths | /* The architectural limit is 59, but we have hardcoded 36 bit
|
470 | 6d35524c | ths | in some places...
|
471 | 6d35524c | ths | .PABITS = 59, */ /* the architectural limit */ |
472 | 6d35524c | ths | .PABITS = 36,
|
473 | d2123ead | ths | .insn_flags = CPU_MIPS64R2 | ASE_MIPS3D, |
474 | 6d35524c | ths | .mmu_type = MMU_TYPE_R4000, |
475 | d2123ead | ths | }, |
476 | 5bc6fba8 | Huacai Chen | { |
477 | 5bc6fba8 | Huacai Chen | .name = "Loongson-2E",
|
478 | 5bc6fba8 | Huacai Chen | .CP0_PRid = 0x6302,
|
479 | 5bc6fba8 | Huacai Chen | /*64KB I-cache and d-cache. 4 way with 32 bit cache line size*/
|
480 | 5bc6fba8 | Huacai Chen | .CP0_Config0 = (0x1<<17) | (0x1<<16) | (0x1<<11) | (0x1<<8) | (0x1<<5) | |
481 | 5bc6fba8 | Huacai Chen | (0x1<<4) | (0x1<<1), |
482 | 5bc6fba8 | Huacai Chen | /* Note: Config1 is only used internally, Loongson-2E has only Config0. */
|
483 | 5bc6fba8 | Huacai Chen | .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU), |
484 | 5bc6fba8 | Huacai Chen | .SYNCI_Step = 16,
|
485 | 5bc6fba8 | Huacai Chen | .CCRes = 2,
|
486 | 5bc6fba8 | Huacai Chen | .CP0_Status_rw_bitmask = 0x35D0FFFF,
|
487 | 5bc6fba8 | Huacai Chen | .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV), |
488 | 5bc6fba8 | Huacai Chen | .SEGBITS = 40,
|
489 | 5bc6fba8 | Huacai Chen | .PABITS = 40,
|
490 | 5bc6fba8 | Huacai Chen | .insn_flags = CPU_LOONGSON2E, |
491 | 5bc6fba8 | Huacai Chen | .mmu_type = MMU_TYPE_R4000, |
492 | 5bc6fba8 | Huacai Chen | }, |
493 | 5bc6fba8 | Huacai Chen | { |
494 | 5bc6fba8 | Huacai Chen | .name = "Loongson-2F",
|
495 | 5bc6fba8 | Huacai Chen | .CP0_PRid = 0x6303,
|
496 | 5bc6fba8 | Huacai Chen | /*64KB I-cache and d-cache. 4 way with 32 bit cache line size*/
|
497 | 5bc6fba8 | Huacai Chen | .CP0_Config0 = (0x1<<17) | (0x1<<16) | (0x1<<11) | (0x1<<8) | (0x1<<5) | |
498 | 5bc6fba8 | Huacai Chen | (0x1<<4) | (0x1<<1), |
499 | 5bc6fba8 | Huacai Chen | /* Note: Config1 is only used internally, Loongson-2F has only Config0. */
|
500 | 5bc6fba8 | Huacai Chen | .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU), |
501 | 5bc6fba8 | Huacai Chen | .SYNCI_Step = 16,
|
502 | 5bc6fba8 | Huacai Chen | .CCRes = 2,
|
503 | ebabb67a | Stefan Weil | .CP0_Status_rw_bitmask = 0xF5D0FF1F, /*bit5:7 not writable*/ |
504 | 5bc6fba8 | Huacai Chen | .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV), |
505 | 5bc6fba8 | Huacai Chen | .SEGBITS = 40,
|
506 | 5bc6fba8 | Huacai Chen | .PABITS = 40,
|
507 | 5bc6fba8 | Huacai Chen | .insn_flags = CPU_LOONGSON2F, |
508 | 5bc6fba8 | Huacai Chen | .mmu_type = MMU_TYPE_R4000, |
509 | 5bc6fba8 | Huacai Chen | }, |
510 | af13ae03 | Jia Liu | { |
511 | af13ae03 | Jia Liu | /* A generic CPU providing MIPS64 ASE DSP 2 features.
|
512 | af13ae03 | Jia Liu | FIXME: Eventually this should be replaced by a real CPU model. */
|
513 | af13ae03 | Jia Liu | .name = "mips64dspr2",
|
514 | af13ae03 | Jia Liu | .CP0_PRid = 0x00010000,
|
515 | af13ae03 | Jia Liu | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) | |
516 | af13ae03 | Jia Liu | (MMU_TYPE_R4000 << CP0C0_MT), |
517 | af13ae03 | Jia Liu | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) | |
518 | af13ae03 | Jia Liu | (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) | |
519 | af13ae03 | Jia Liu | (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) | |
520 | af13ae03 | Jia Liu | (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), |
521 | af13ae03 | Jia Liu | .CP0_Config2 = MIPS_CONFIG2, |
522 | af13ae03 | Jia Liu | .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_LPA),
|
523 | af13ae03 | Jia Liu | .CP0_LLAddr_rw_bitmask = 0,
|
524 | af13ae03 | Jia Liu | .CP0_LLAddr_shift = 0,
|
525 | af13ae03 | Jia Liu | .SYNCI_Step = 32,
|
526 | af13ae03 | Jia Liu | .CCRes = 2,
|
527 | af13ae03 | Jia Liu | .CP0_Status_rw_bitmask = 0x37FBFFFF,
|
528 | af13ae03 | Jia Liu | .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_3D) | (1 << FCR0_PS) | |
529 | af13ae03 | Jia Liu | (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) | |
530 | af13ae03 | Jia Liu | (1 << FCR0_S) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV), |
531 | af13ae03 | Jia Liu | .SEGBITS = 42,
|
532 | af13ae03 | Jia Liu | /* The architectural limit is 59, but we have hardcoded 36 bit
|
533 | af13ae03 | Jia Liu | in some places...
|
534 | af13ae03 | Jia Liu | .PABITS = 59, */ /* the architectural limit */ |
535 | af13ae03 | Jia Liu | .PABITS = 36,
|
536 | af13ae03 | Jia Liu | .insn_flags = CPU_MIPS64R2 | ASE_DSP | ASE_DSPR2, |
537 | af13ae03 | Jia Liu | .mmu_type = MMU_TYPE_R4000, |
538 | af13ae03 | Jia Liu | }, |
539 | 5bc6fba8 | Huacai Chen | |
540 | 33d68b5f | ths | #endif
|
541 | 33d68b5f | ths | }; |
542 | 33d68b5f | ths | |
543 | c227f099 | Anthony Liguori | static const mips_def_t *cpu_mips_find_by_name (const char *name) |
544 | 33d68b5f | ths | { |
545 | aaed909a | bellard | int i;
|
546 | 33d68b5f | ths | |
547 | b1503cda | malc | for (i = 0; i < ARRAY_SIZE(mips_defs); i++) { |
548 | 33d68b5f | ths | if (strcasecmp(name, mips_defs[i].name) == 0) { |
549 | aaed909a | bellard | return &mips_defs[i];
|
550 | 33d68b5f | ths | } |
551 | 33d68b5f | ths | } |
552 | aaed909a | bellard | return NULL; |
553 | 33d68b5f | ths | } |
554 | 33d68b5f | ths | |
555 | 9a78eead | Stefan Weil | void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf)
|
556 | 33d68b5f | ths | { |
557 | 33d68b5f | ths | int i;
|
558 | 33d68b5f | ths | |
559 | b1503cda | malc | for (i = 0; i < ARRAY_SIZE(mips_defs); i++) { |
560 | 33d68b5f | ths | (*cpu_fprintf)(f, "MIPS '%s'\n",
|
561 | 33d68b5f | ths | mips_defs[i].name); |
562 | 33d68b5f | ths | } |
563 | 33d68b5f | ths | } |
564 | 33d68b5f | ths | |
565 | f8a6ec58 | ths | #ifndef CONFIG_USER_ONLY
|
566 | c227f099 | Anthony Liguori | static void no_mmu_init (CPUMIPSState *env, const mips_def_t *def) |
567 | 29929e34 | ths | { |
568 | ead9360e | ths | env->tlb->nb_tlb = 1;
|
569 | ead9360e | ths | env->tlb->map_address = &no_mmu_map_address; |
570 | 29929e34 | ths | } |
571 | 29929e34 | ths | |
572 | c227f099 | Anthony Liguori | static void fixed_mmu_init (CPUMIPSState *env, const mips_def_t *def) |
573 | 29929e34 | ths | { |
574 | ead9360e | ths | env->tlb->nb_tlb = 1;
|
575 | ead9360e | ths | env->tlb->map_address = &fixed_mmu_map_address; |
576 | 29929e34 | ths | } |
577 | 29929e34 | ths | |
578 | c227f099 | Anthony Liguori | static void r4k_mmu_init (CPUMIPSState *env, const mips_def_t *def) |
579 | 29929e34 | ths | { |
580 | ead9360e | ths | env->tlb->nb_tlb = 1 + ((def->CP0_Config1 >> CP0C1_MMU) & 63); |
581 | ead9360e | ths | env->tlb->map_address = &r4k_map_address; |
582 | c01fccd2 | aurel32 | env->tlb->helper_tlbwi = r4k_helper_tlbwi; |
583 | c01fccd2 | aurel32 | env->tlb->helper_tlbwr = r4k_helper_tlbwr; |
584 | c01fccd2 | aurel32 | env->tlb->helper_tlbp = r4k_helper_tlbp; |
585 | c01fccd2 | aurel32 | env->tlb->helper_tlbr = r4k_helper_tlbr; |
586 | ead9360e | ths | } |
587 | ead9360e | ths | |
588 | c227f099 | Anthony Liguori | static void mmu_init (CPUMIPSState *env, const mips_def_t *def) |
589 | ead9360e | ths | { |
590 | 7267c094 | Anthony Liguori | env->tlb = g_malloc0(sizeof(CPUMIPSTLBContext));
|
591 | ead9360e | ths | |
592 | 6d35524c | ths | switch (def->mmu_type) {
|
593 | 6d35524c | ths | case MMU_TYPE_NONE:
|
594 | ead9360e | ths | no_mmu_init(env, def); |
595 | ead9360e | ths | break;
|
596 | 6d35524c | ths | case MMU_TYPE_R4000:
|
597 | ead9360e | ths | r4k_mmu_init(env, def); |
598 | ead9360e | ths | break;
|
599 | 6d35524c | ths | case MMU_TYPE_FMT:
|
600 | ead9360e | ths | fixed_mmu_init(env, def); |
601 | ead9360e | ths | break;
|
602 | 6d35524c | ths | case MMU_TYPE_R3000:
|
603 | 6d35524c | ths | case MMU_TYPE_R6000:
|
604 | 6d35524c | ths | case MMU_TYPE_R8000:
|
605 | ead9360e | ths | default:
|
606 | ead9360e | ths | cpu_abort(env, "MMU type not supported\n");
|
607 | ead9360e | ths | } |
608 | 29929e34 | ths | } |
609 | f8a6ec58 | ths | #endif /* CONFIG_USER_ONLY */ |
610 | 29929e34 | ths | |
611 | c227f099 | Anthony Liguori | static void fpu_init (CPUMIPSState *env, const mips_def_t *def) |
612 | ead9360e | ths | { |
613 | f01be154 | ths | int i;
|
614 | f01be154 | ths | |
615 | f01be154 | ths | for (i = 0; i < MIPS_FPU_MAX; i++) |
616 | f01be154 | ths | env->fpus[i].fcr0 = def->CP1_fcr0; |
617 | ead9360e | ths | |
618 | f01be154 | ths | memcpy(&env->active_fpu, &env->fpus[0], sizeof(env->active_fpu)); |
619 | ead9360e | ths | } |
620 | ead9360e | ths | |
621 | c227f099 | Anthony Liguori | static void mvp_init (CPUMIPSState *env, const mips_def_t *def) |
622 | ead9360e | ths | { |
623 | 7267c094 | Anthony Liguori | env->mvp = g_malloc0(sizeof(CPUMIPSMVPContext));
|
624 | ead9360e | ths | |
625 | ead9360e | ths | /* MVPConf1 implemented, TLB sharable, no gating storage support,
|
626 | ead9360e | ths | programmable cache partitioning implemented, number of allocatable
|
627 | ead9360e | ths | and sharable TLB entries, MVP has allocatable TCs, 2 VPEs
|
628 | ead9360e | ths | implemented, 5 TCs implemented. */
|
629 | ead9360e | ths | env->mvp->CP0_MVPConf0 = (1 << CP0MVPC0_M) | (1 << CP0MVPC0_TLBS) | |
630 | ead9360e | ths | (0 << CP0MVPC0_GS) | (1 << CP0MVPC0_PCP) | |
631 | ead9360e | ths | // TODO: actually do 2 VPEs.
|
632 | ead9360e | ths | // (1 << CP0MVPC0_TCA) | (0x1 << CP0MVPC0_PVPE) |
|
633 | ead9360e | ths | // (0x04 << CP0MVPC0_PTC);
|
634 | ead9360e | ths | (1 << CP0MVPC0_TCA) | (0x0 << CP0MVPC0_PVPE) | |
635 | 1dab005a | Edgar E. Iglesias | (0x00 << CP0MVPC0_PTC);
|
636 | 932e71cd | aurel32 | #if !defined(CONFIG_USER_ONLY)
|
637 | 0eaef5aa | ths | /* Usermode has no TLB support */
|
638 | 932e71cd | aurel32 | env->mvp->CP0_MVPConf0 |= (env->tlb->nb_tlb << CP0MVPC0_PTLBE); |
639 | 932e71cd | aurel32 | #endif
|
640 | 0eaef5aa | ths | |
641 | ead9360e | ths | /* Allocatable CP1 have media extensions, allocatable CP1 have FP support,
|
642 | ead9360e | ths | no UDI implemented, no CP2 implemented, 1 CP1 implemented. */
|
643 | ead9360e | ths | env->mvp->CP0_MVPConf1 = (1 << CP0MVPC1_CIM) | (1 << CP0MVPC1_CIF) | |
644 | ead9360e | ths | (0x0 << CP0MVPC1_PCX) | (0x0 << CP0MVPC1_PCP2) | |
645 | ead9360e | ths | (0x1 << CP0MVPC1_PCP1);
|
646 | ead9360e | ths | } |