2 * MIPS emulation for qemu: CPU initialisation routines.
4 * Copyright (c) 2004-2005 Jocelyn Mayer
5 * Copyright (c) 2007 Herve Poussineau
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 /* CPU / CPU family specific config register values. */
23 /* Have config1, uncached coherency */
24 #define MIPS_CONFIG0 \
25 ((1U << CP0C0_M) | (0x2 << CP0C0_K0))
27 /* Have config2, no coprocessor2 attached, no MDMX support attached,
28 no performance counters, watch registers present,
29 no code compression, EJTAG present, no FPU */
30 #define MIPS_CONFIG1 \
32 (0 << CP0C1_C2) | (0 << CP0C1_MD) | (0 << CP0C1_PC) | \
33 (1 << CP0C1_WR) | (0 << CP0C1_CA) | (1 << CP0C1_EP) | \
36 /* Have config3, no tertiary/secondary caches implemented */
37 #define MIPS_CONFIG2 \
40 /* No config4, no DSP ASE, no large physaddr (PABITS),
41 no external interrupt controller, no vectored interrupts,
42 no 1kb pages, no SmartMIPS ASE, no trace logic */
43 #define MIPS_CONFIG3 \
44 ((0 << CP0C3_M) | (0 << CP0C3_DSPP) | (0 << CP0C3_LPA) | \
45 (0 << CP0C3_VEIC) | (0 << CP0C3_VInt) | (0 << CP0C3_SP) | \
46 (0 << CP0C3_SM) | (0 << CP0C3_TL))
48 #define MIPS_CONFIG4 \
51 #define MIPS_CONFIG5 \
54 /*****************************************************************************/
55 /* MIPS CPU definitions */
56 const mips_def_t mips_defs
[] =
60 .CP0_PRid
= 0x00018000,
61 .CP0_Config0
= MIPS_CONFIG0
| (MMU_TYPE_R4000
<< CP0C0_MT
),
62 .CP0_Config1
= MIPS_CONFIG1
| (15 << CP0C1_MMU
) |
63 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
64 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
66 .CP0_Config2
= MIPS_CONFIG2
,
67 .CP0_Config3
= MIPS_CONFIG3
,
68 .CP0_LLAddr_rw_bitmask
= 0,
69 .CP0_LLAddr_shift
= 4,
72 .CP0_Status_rw_bitmask
= 0x1278FF17,
75 .insn_flags
= CPU_MIPS32
,
76 .mmu_type
= MMU_TYPE_R4000
,
80 .CP0_PRid
= 0x00018300,
81 /* Config1 implemented, fixed mapping MMU,
82 no virtual icache, uncached coherency. */
83 .CP0_Config0
= MIPS_CONFIG0
| (MMU_TYPE_FMT
<< CP0C0_MT
),
84 .CP0_Config1
= MIPS_CONFIG1
|
85 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
86 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
88 .CP0_Config2
= MIPS_CONFIG2
,
89 .CP0_Config3
= MIPS_CONFIG3
,
90 .CP0_LLAddr_rw_bitmask
= 0,
91 .CP0_LLAddr_shift
= 4,
94 .CP0_Status_rw_bitmask
= 0x1258FF17,
97 .insn_flags
= CPU_MIPS32
| ASE_MIPS16
,
98 .mmu_type
= MMU_TYPE_FMT
,
102 .CP0_PRid
= 0x00018400,
103 .CP0_Config0
= MIPS_CONFIG0
| (MMU_TYPE_R4000
<< CP0C0_MT
),
104 .CP0_Config1
= MIPS_CONFIG1
| (15 << CP0C1_MMU
) |
105 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
106 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
108 .CP0_Config2
= MIPS_CONFIG2
,
109 .CP0_Config3
= MIPS_CONFIG3
,
110 .CP0_LLAddr_rw_bitmask
= 0,
111 .CP0_LLAddr_shift
= 4,
114 .CP0_Status_rw_bitmask
= 0x1278FF17,
117 .insn_flags
= CPU_MIPS32
,
118 .mmu_type
= MMU_TYPE_R4000
,
122 .CP0_PRid
= 0x00018500,
123 .CP0_Config0
= MIPS_CONFIG0
| (MMU_TYPE_FMT
<< CP0C0_MT
),
124 .CP0_Config1
= MIPS_CONFIG1
|
125 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
126 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
128 .CP0_Config2
= MIPS_CONFIG2
,
129 .CP0_Config3
= MIPS_CONFIG3
,
130 .CP0_LLAddr_rw_bitmask
= 0,
131 .CP0_LLAddr_shift
= 4,
134 .CP0_Status_rw_bitmask
= 0x1258FF17,
137 .insn_flags
= CPU_MIPS32
| ASE_MIPS16
,
138 .mmu_type
= MMU_TYPE_FMT
,
142 .CP0_PRid
= 0x00019000,
143 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
144 (MMU_TYPE_R4000
<< CP0C0_MT
),
145 .CP0_Config1
= MIPS_CONFIG1
| (15 << CP0C1_MMU
) |
146 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
147 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
149 .CP0_Config2
= MIPS_CONFIG2
,
150 .CP0_Config3
= MIPS_CONFIG3
| (0 << CP0C3_VInt
),
151 .CP0_LLAddr_rw_bitmask
= 0,
152 .CP0_LLAddr_shift
= 4,
155 .CP0_Status_rw_bitmask
= 0x1278FF17,
158 .insn_flags
= CPU_MIPS32R2
,
159 .mmu_type
= MMU_TYPE_R4000
,
163 .CP0_PRid
= 0x00019100,
164 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
165 (MMU_TYPE_FMT
<< CP0C0_MT
),
166 .CP0_Config1
= MIPS_CONFIG1
|
167 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
168 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
170 .CP0_Config2
= MIPS_CONFIG2
,
171 .CP0_Config3
= MIPS_CONFIG3
,
172 .CP0_LLAddr_rw_bitmask
= 0,
173 .CP0_LLAddr_shift
= 4,
176 .CP0_Status_rw_bitmask
= 0x1258FF17,
179 .insn_flags
= CPU_MIPS32R2
| ASE_MIPS16
,
180 .mmu_type
= MMU_TYPE_FMT
,
184 .CP0_PRid
= 0x00019300,
185 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
186 (MMU_TYPE_R4000
<< CP0C0_MT
),
187 .CP0_Config1
= MIPS_CONFIG1
| (15 << CP0C1_MMU
) |
188 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
189 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
191 .CP0_Config2
= MIPS_CONFIG2
,
192 .CP0_Config3
= MIPS_CONFIG3
| (0 << CP0C3_VInt
),
193 .CP0_LLAddr_rw_bitmask
= 0,
194 .CP0_LLAddr_shift
= 4,
197 /* No DSP implemented. */
198 .CP0_Status_rw_bitmask
= 0x1278FF1F,
201 .insn_flags
= CPU_MIPS32R2
| ASE_MIPS16
,
202 .mmu_type
= MMU_TYPE_R4000
,
206 .CP0_PRid
= 0x00019600,
207 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
208 (MMU_TYPE_R4000
<< CP0C0_MT
),
209 .CP0_Config1
= MIPS_CONFIG1
| (15 << CP0C1_MMU
) |
210 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
211 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
213 .CP0_Config2
= MIPS_CONFIG2
,
214 .CP0_Config3
= MIPS_CONFIG3
| (1 << CP0C3_DSPP
) | (0 << CP0C3_VInt
),
215 .CP0_LLAddr_rw_bitmask
= 0,
216 .CP0_LLAddr_shift
= 4,
219 /* we have a DSP, but no FPU */
220 .CP0_Status_rw_bitmask
= 0x1378FF1F,
223 .insn_flags
= CPU_MIPS32R2
| ASE_MIPS16
| ASE_DSP
,
224 .mmu_type
= MMU_TYPE_R4000
,
228 .CP0_PRid
= 0x00019300,
229 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
230 (MMU_TYPE_R4000
<< CP0C0_MT
),
231 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (15 << CP0C1_MMU
) |
232 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
233 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
235 .CP0_Config2
= MIPS_CONFIG2
,
236 .CP0_Config3
= MIPS_CONFIG3
| (0 << CP0C3_VInt
),
237 .CP0_LLAddr_rw_bitmask
= 0,
238 .CP0_LLAddr_shift
= 4,
241 /* No DSP implemented. */
242 .CP0_Status_rw_bitmask
= 0x3678FF1F,
243 .CP1_fcr0
= (1 << FCR0_F64
) | (1 << FCR0_L
) | (1 << FCR0_W
) |
244 (1 << FCR0_D
) | (1 << FCR0_S
) | (0x93 << FCR0_PRID
),
246 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
249 .insn_flags
= CPU_MIPS32R2
| ASE_MIPS16
,
250 .mmu_type
= MMU_TYPE_R4000
,
254 .CP0_PRid
= 0x00019500,
255 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
256 (MMU_TYPE_R4000
<< CP0C0_MT
),
257 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (15 << CP0C1_MMU
) |
258 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
259 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
261 .CP0_Config2
= MIPS_CONFIG2
,
262 .CP0_Config3
= MIPS_CONFIG3
| (1 << CP0C3_VInt
) | (1 << CP0C3_MT
) |
264 .CP0_LLAddr_rw_bitmask
= 0,
265 .CP0_LLAddr_shift
= 0,
268 .CP0_Status_rw_bitmask
= 0x3778FF1F,
269 .CP0_TCStatus_rw_bitmask
= (0 << CP0TCSt_TCU3
) | (0 << CP0TCSt_TCU2
) |
270 (1 << CP0TCSt_TCU1
) | (1 << CP0TCSt_TCU0
) |
271 (0 << CP0TCSt_TMX
) | (1 << CP0TCSt_DT
) |
272 (1 << CP0TCSt_DA
) | (1 << CP0TCSt_A
) |
273 (0x3 << CP0TCSt_TKSU
) | (1 << CP0TCSt_IXMT
) |
274 (0xff << CP0TCSt_TASID
),
275 .CP1_fcr0
= (1 << FCR0_F64
) | (1 << FCR0_L
) | (1 << FCR0_W
) |
276 (1 << FCR0_D
) | (1 << FCR0_S
) | (0x95 << FCR0_PRID
),
278 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
279 .CP0_SRSCtl
= (0xf << CP0SRSCtl_HSS
),
280 .CP0_SRSConf0_rw_bitmask
= 0x3fffffff,
281 .CP0_SRSConf0
= (1U << CP0SRSC0_M
) | (0x3fe << CP0SRSC0_SRS3
) |
282 (0x3fe << CP0SRSC0_SRS2
) | (0x3fe << CP0SRSC0_SRS1
),
283 .CP0_SRSConf1_rw_bitmask
= 0x3fffffff,
284 .CP0_SRSConf1
= (1U << CP0SRSC1_M
) | (0x3fe << CP0SRSC1_SRS6
) |
285 (0x3fe << CP0SRSC1_SRS5
) | (0x3fe << CP0SRSC1_SRS4
),
286 .CP0_SRSConf2_rw_bitmask
= 0x3fffffff,
287 .CP0_SRSConf2
= (1U << CP0SRSC2_M
) | (0x3fe << CP0SRSC2_SRS9
) |
288 (0x3fe << CP0SRSC2_SRS8
) | (0x3fe << CP0SRSC2_SRS7
),
289 .CP0_SRSConf3_rw_bitmask
= 0x3fffffff,
290 .CP0_SRSConf3
= (1U << CP0SRSC3_M
) | (0x3fe << CP0SRSC3_SRS12
) |
291 (0x3fe << CP0SRSC3_SRS11
) | (0x3fe << CP0SRSC3_SRS10
),
292 .CP0_SRSConf4_rw_bitmask
= 0x3fffffff,
293 .CP0_SRSConf4
= (0x3fe << CP0SRSC4_SRS15
) |
294 (0x3fe << CP0SRSC4_SRS14
) | (0x3fe << CP0SRSC4_SRS13
),
297 .insn_flags
= CPU_MIPS32R2
| ASE_MIPS16
| ASE_DSP
| ASE_MT
,
298 .mmu_type
= MMU_TYPE_R4000
,
302 .CP0_PRid
= 0x00019700,
303 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
304 (MMU_TYPE_R4000
<< CP0C0_MT
),
305 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (15 << CP0C1_MMU
) |
306 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
307 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
) |
309 .CP0_Config2
= MIPS_CONFIG2
,
310 .CP0_Config3
= MIPS_CONFIG3
| (1 << CP0C3_DSP2P
) | (1 << CP0C3_DSPP
) |
312 .CP0_LLAddr_rw_bitmask
= 0,
313 .CP0_LLAddr_shift
= 4,
316 .CP0_Status_rw_bitmask
= 0x3778FF1F,
317 .CP1_fcr0
= (1 << FCR0_F64
) | (1 << FCR0_L
) | (1 << FCR0_W
) |
318 (1 << FCR0_D
) | (1 << FCR0_S
) | (0x93 << FCR0_PRID
),
320 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
323 .insn_flags
= CPU_MIPS32R2
| ASE_MIPS16
| ASE_DSP
| ASE_DSPR2
,
324 .mmu_type
= MMU_TYPE_R4000
,
328 .CP0_PRid
= 0x00019b00,
329 /* Config1 implemented, fixed mapping MMU,
330 no virtual icache, uncached coherency. */
331 .CP0_Config0
= MIPS_CONFIG0
| (0x2 << CP0C0_KU
) | (0x2 << CP0C0_K23
) |
332 (0x1 << CP0C0_AR
) | (MMU_TYPE_FMT
<< CP0C0_MT
),
333 .CP0_Config1
= MIPS_CONFIG1
,
334 .CP0_Config2
= MIPS_CONFIG2
,
335 .CP0_Config3
= MIPS_CONFIG3
| (0x2 << CP0C3_ISA
) | (1 << CP0C3_VInt
),
336 .CP0_LLAddr_rw_bitmask
= 0,
337 .CP0_LLAddr_shift
= 4,
340 .CP0_Status_rw_bitmask
= 0x1258FF17,
343 .insn_flags
= CPU_MIPS32R2
| ASE_MICROMIPS
,
344 .mmu_type
= MMU_TYPE_FMT
,
348 /* This is the TLB-based MMU core. */
349 .CP0_PRid
= 0x00019c00,
350 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) |
351 (MMU_TYPE_R4000
<< CP0C0_MT
),
352 .CP0_Config1
= MIPS_CONFIG1
| (15 << CP0C1_MMU
) |
353 (0 << CP0C1_IS
) | (3 << CP0C1_IL
) | (1 << CP0C1_IA
) |
354 (0 << CP0C1_DS
) | (3 << CP0C1_DL
) | (1 << CP0C1_DA
),
355 .CP0_Config2
= MIPS_CONFIG2
,
356 .CP0_Config3
= MIPS_CONFIG3
| (0x2 << CP0C3_ISA
) | (0 << CP0C3_VInt
),
357 .CP0_LLAddr_rw_bitmask
= 0,
358 .CP0_LLAddr_shift
= 4,
361 .CP0_Status_rw_bitmask
= 0x1278FF17,
364 .insn_flags
= CPU_MIPS32R2
| ASE_MICROMIPS
,
365 .mmu_type
= MMU_TYPE_R4000
,
369 * Config3: CMGCR, PW, VZ, CTXTC, CDMM, TL
375 .CP0_PRid
= 0x0001A800,
376 .CP0_Config0
= MIPS_CONFIG0
| (1 << CP0C0_MM
) | (1 << CP0C0_AR
) |
377 (MMU_TYPE_R4000
<< CP0C0_MT
),
378 .CP0_Config1
= MIPS_CONFIG1
| (0x3F << CP0C1_MMU
) |
379 (2 << CP0C1_IS
) | (4 << CP0C1_IL
) | (3 << CP0C1_IA
) |
380 (2 << CP0C1_DS
) | (4 << CP0C1_DL
) | (3 << CP0C1_DA
) |
381 (1 << CP0C1_PC
) | (1 << CP0C1_FP
),
382 .CP0_Config2
= MIPS_CONFIG2
,
383 .CP0_Config3
= MIPS_CONFIG3
| (1U << CP0C3_M
) | (1 << CP0C3_MSAP
) |
384 (1 << CP0C3_BP
) | (1 << CP0C3_BI
) | (1 << CP0C3_SC
) |
385 (1 << CP0C3_ULRI
) | (1 << CP0C3_RXI
) | (1 << CP0C3_LPA
) |
387 .CP0_Config4
= MIPS_CONFIG4
| (1U << CP0C4_M
) | (2 << CP0C4_IE
) |
388 (0x1c << CP0C4_KScrExist
),
389 .CP0_Config4_rw_bitmask
= 0,
390 .CP0_Config5
= MIPS_CONFIG5
| (1 << CP0C5_EVA
) | (1 << CP0C5_MVH
) |
391 (1 << CP0C5_LLB
) | (1 << CP0C5_MRP
),
392 .CP0_Config5_rw_bitmask
= (1 << CP0C5_K
) | (1 << CP0C5_CV
) |
393 (1 << CP0C5_MSAEn
) | (1 << CP0C5_UFE
) |
394 (1 << CP0C5_FRE
) | (1 << CP0C5_UFR
),
395 .CP0_LLAddr_rw_bitmask
= 0,
396 .CP0_LLAddr_shift
= 0,
399 .CP0_Status_rw_bitmask
= 0x3C68FF1F,
400 .CP0_PageGrain_rw_bitmask
= (1U << CP0PG_RIE
) | (1 << CP0PG_XIE
) |
401 (1 << CP0PG_ELPA
) | (1 << CP0PG_IEC
),
402 .CP0_EBaseWG_rw_bitmask
= (1 << CP0EBase_WG
),
403 .CP1_fcr0
= (1 << FCR0_FREP
) | (1 << FCR0_UFRP
) | (1 << FCR0_HAS2008
) |
404 (1 << FCR0_F64
) | (1 << FCR0_L
) | (1 << FCR0_W
) |
405 (1 << FCR0_D
) | (1 << FCR0_S
) | (0x03 << FCR0_PRID
),
406 .CP1_fcr31
= (1 << FCR31_ABS2008
) | (1 << FCR31_NAN2008
),
407 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
410 .insn_flags
= CPU_MIPS32R5
| ASE_MSA
,
411 .mmu_type
= MMU_TYPE_R4000
,
414 /* A generic CPU supporting MIPS32 Release 6 ISA.
415 FIXME: Support IEEE 754-2008 FP.
416 Eventually this should be replaced by a real CPU model. */
417 .name
= "mips32r6-generic",
418 .CP0_PRid
= 0x00010000,
419 .CP0_Config0
= MIPS_CONFIG0
| (0x2 << CP0C0_AR
) |
420 (MMU_TYPE_R4000
<< CP0C0_MT
),
421 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (31 << CP0C1_MMU
) |
422 (2 << CP0C1_IS
) | (4 << CP0C1_IL
) | (3 << CP0C1_IA
) |
423 (2 << CP0C1_DS
) | (4 << CP0C1_DL
) | (3 << CP0C1_DA
) |
424 (0 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
425 .CP0_Config2
= MIPS_CONFIG2
,
426 .CP0_Config3
= MIPS_CONFIG3
| (1 << CP0C3_BP
) | (1 << CP0C3_BI
) |
427 (2 << CP0C3_ISA
) | (1 << CP0C3_ULRI
) |
428 (1 << CP0C3_RXI
) | (1U << CP0C3_M
),
429 .CP0_Config4
= MIPS_CONFIG4
| (0xfc << CP0C4_KScrExist
) |
430 (3 << CP0C4_IE
) | (1U << CP0C4_M
),
431 .CP0_Config5
= MIPS_CONFIG5
| (1 << CP0C5_XNP
) | (1 << CP0C5_LLB
),
432 .CP0_Config5_rw_bitmask
= (1 << CP0C5_SBRI
) | (1 << CP0C5_FRE
) |
434 .CP0_LLAddr_rw_bitmask
= 0,
435 .CP0_LLAddr_shift
= 0,
438 .CP0_Status_rw_bitmask
= 0x3058FF1F,
439 .CP0_PageGrain
= (1 << CP0PG_IEC
) | (1 << CP0PG_XIE
) |
441 .CP0_PageGrain_rw_bitmask
= 0,
442 .CP1_fcr0
= (1 << FCR0_FREP
) | (1 << FCR0_HAS2008
) | (1 << FCR0_F64
) |
443 (1 << FCR0_L
) | (1 << FCR0_W
) | (1 << FCR0_D
) |
444 (1 << FCR0_S
) | (0x00 << FCR0_PRID
) | (0x0 << FCR0_REV
),
445 .CP1_fcr31
= (1 << FCR31_ABS2008
) | (1 << FCR31_NAN2008
),
446 .CP1_fcr31_rw_bitmask
= 0x0103FFFF,
449 .insn_flags
= CPU_MIPS32R6
| ASE_MICROMIPS
,
450 .mmu_type
= MMU_TYPE_R4000
,
454 .CP0_PRid
= 0x00010000,
455 .CP0_Config0
= MIPS_CONFIG0
| (1 << CP0C0_MM
) | (0x2 << CP0C0_AR
) |
456 (MMU_TYPE_R4000
<< CP0C0_MT
),
457 .CP0_Config1
= (1U << CP0C1_M
) | (15 << CP0C1_MMU
) | (2 << CP0C1_IS
) |
458 (4 << CP0C1_IL
) | (3 << CP0C1_IA
) | (2 << CP0C1_DS
) |
459 (4 << CP0C1_DL
) | (3 << CP0C1_DA
) | (1 << CP0C1_PC
) |
461 .CP0_Config2
= MIPS_CONFIG2
,
462 .CP0_Config3
= MIPS_CONFIG3
| (1U << CP0C3_M
) | (1 << CP0C3_CMGCR
) |
463 (1 << CP0C3_BI
) | (1 << CP0C3_SC
) | (3 << CP0C3_MMAR
) |
464 (1 << CP0C3_ISA_ON_EXC
) | (1 << CP0C3_ISA
) |
465 (1 << CP0C3_ULRI
) | (1 << CP0C3_RXI
) |
466 (1 << CP0C3_DSP2P
) | (1 << CP0C3_DSPP
) |
467 (1 << CP0C3_CTXTC
) | (1 << CP0C3_VInt
) |
468 (1 << CP0C3_CDMM
) | (1 << CP0C3_MT
) | (1 << CP0C3_TL
),
469 .CP0_Config4
= MIPS_CONFIG4
| (0xfc << CP0C4_KScrExist
) |
470 (2 << CP0C4_IE
) | (1U << CP0C4_M
),
471 .CP0_Config5
= MIPS_CONFIG5
| (1 << CP0C5_MVH
) | (1 << CP0C5_LLB
),
472 .CP0_Config5_rw_bitmask
= (1 << CP0C5_SBRI
) | (1 << CP0C5_FRE
) |
474 .CP0_LLAddr_rw_bitmask
= 0,
475 .CP0_LLAddr_shift
= 0,
478 .CP0_Status_rw_bitmask
= 0x3158FF1F,
479 .CP0_PageGrain
= (1 << CP0PG_IEC
) | (1 << CP0PG_XIE
) |
481 .CP0_PageGrain_rw_bitmask
= 0,
482 .CP1_fcr0
= (1 << FCR0_FREP
) | (1 << FCR0_HAS2008
) | (1 << FCR0_F64
) |
483 (1 << FCR0_L
) | (1 << FCR0_W
) | (1 << FCR0_D
) |
484 (1 << FCR0_S
) | (0x02 << FCR0_PRID
) | (0x0 << FCR0_REV
),
485 .CP1_fcr31
= (1 << FCR31_ABS2008
) | (1 << FCR31_NAN2008
),
488 .insn_flags
= CPU_NANOMIPS32
| ASE_DSP
| ASE_DSPR2
| ASE_MT
,
489 .mmu_type
= MMU_TYPE_R4000
,
491 #if defined(TARGET_MIPS64)
494 .CP0_PRid
= 0x00000400,
495 /* No L2 cache, icache size 8k, dcache size 8k, uncached coherency. */
496 .CP0_Config0
= (1 << 17) | (0x1 << 9) | (0x1 << 6) | (0x2 << CP0C0_K0
),
497 /* Note: Config1 is only used internally, the R4000 has only Config0. */
498 .CP0_Config1
= (1 << CP0C1_FP
) | (47 << CP0C1_MMU
),
499 .CP0_LLAddr_rw_bitmask
= 0xFFFFFFFF,
500 .CP0_LLAddr_shift
= 4,
503 .CP0_Status_rw_bitmask
= 0x3678FFFF,
504 /* The R4000 has a full 64bit FPU but doesn't use the fcr0 bits. */
505 .CP1_fcr0
= (0x5 << FCR0_PRID
) | (0x0 << FCR0_REV
),
507 .CP1_fcr31_rw_bitmask
= 0x0183FFFF,
510 .insn_flags
= CPU_MIPS3
,
511 .mmu_type
= MMU_TYPE_R4000
,
515 .CP0_PRid
= 0x00005400,
516 /* No L2 cache, icache size 8k, dcache size 8k, uncached coherency. */
517 .CP0_Config0
= (1 << 17) | (0x1 << 9) | (0x1 << 6) | (0x2 << CP0C0_K0
),
518 .CP0_Config1
= (1 << CP0C1_FP
) | (47 << CP0C1_MMU
),
519 .CP0_LLAddr_rw_bitmask
= 0xFFFFFFFFL
,
520 .CP0_LLAddr_shift
= 4,
523 .CP0_Status_rw_bitmask
= 0x3678FFFF,
524 /* The VR5432 has a full 64bit FPU but doesn't use the fcr0 bits. */
525 .CP1_fcr0
= (0x54 << FCR0_PRID
) | (0x0 << FCR0_REV
),
527 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
530 .insn_flags
= CPU_VR54XX
,
531 .mmu_type
= MMU_TYPE_R4000
,
535 .CP0_PRid
= 0x00018100,
536 .CP0_Config0
= MIPS_CONFIG0
| (0x2 << CP0C0_AT
) |
537 (MMU_TYPE_R4000
<< CP0C0_MT
),
538 .CP0_Config1
= MIPS_CONFIG1
| (31 << CP0C1_MMU
) |
539 (1 << CP0C1_IS
) | (4 << CP0C1_IL
) | (1 << CP0C1_IA
) |
540 (1 << CP0C1_DS
) | (4 << CP0C1_DL
) | (1 << CP0C1_DA
) |
541 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
542 .CP0_Config2
= MIPS_CONFIG2
,
543 .CP0_Config3
= MIPS_CONFIG3
,
544 .CP0_LLAddr_rw_bitmask
= 0,
545 .CP0_LLAddr_shift
= 4,
548 .CP0_Status_rw_bitmask
= 0x12F8FFFF,
551 .insn_flags
= CPU_MIPS64
,
552 .mmu_type
= MMU_TYPE_R4000
,
556 .CP0_PRid
= 0x00018100,
557 .CP0_Config0
= MIPS_CONFIG0
| (0x2 << CP0C0_AT
) |
558 (MMU_TYPE_R4000
<< CP0C0_MT
),
559 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (31 << CP0C1_MMU
) |
560 (1 << CP0C1_IS
) | (4 << CP0C1_IL
) | (1 << CP0C1_IA
) |
561 (1 << CP0C1_DS
) | (4 << CP0C1_DL
) | (1 << CP0C1_DA
) |
562 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
563 .CP0_Config2
= MIPS_CONFIG2
,
564 .CP0_Config3
= MIPS_CONFIG3
,
565 .CP0_LLAddr_rw_bitmask
= 0,
566 .CP0_LLAddr_shift
= 4,
569 .CP0_Status_rw_bitmask
= 0x36F8FFFF,
570 /* The 5Kf has F64 / L / W but doesn't use the fcr0 bits. */
571 .CP1_fcr0
= (1 << FCR0_D
) | (1 << FCR0_S
) |
572 (0x81 << FCR0_PRID
) | (0x0 << FCR0_REV
),
574 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
577 .insn_flags
= CPU_MIPS64
,
578 .mmu_type
= MMU_TYPE_R4000
,
582 /* We emulate a later version of the 20Kc, earlier ones had a broken
584 .CP0_PRid
= 0x000182a0,
585 .CP0_Config0
= MIPS_CONFIG0
| (0x2 << CP0C0_AT
) |
586 (MMU_TYPE_R4000
<< CP0C0_MT
) | (1 << CP0C0_VI
),
587 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (47 << CP0C1_MMU
) |
588 (2 << CP0C1_IS
) | (4 << CP0C1_IL
) | (3 << CP0C1_IA
) |
589 (2 << CP0C1_DS
) | (4 << CP0C1_DL
) | (3 << CP0C1_DA
) |
590 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
591 .CP0_Config2
= MIPS_CONFIG2
,
592 .CP0_Config3
= MIPS_CONFIG3
,
593 .CP0_LLAddr_rw_bitmask
= 0,
594 .CP0_LLAddr_shift
= 0,
597 .CP0_Status_rw_bitmask
= 0x36FBFFFF,
598 /* The 20Kc has F64 / L / W but doesn't use the fcr0 bits. */
599 .CP1_fcr0
= (1 << FCR0_3D
) | (1 << FCR0_PS
) |
600 (1 << FCR0_D
) | (1 << FCR0_S
) |
601 (0x82 << FCR0_PRID
) | (0x0 << FCR0_REV
),
603 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
606 .insn_flags
= CPU_MIPS64
| ASE_MIPS3D
,
607 .mmu_type
= MMU_TYPE_R4000
,
610 /* A generic CPU providing MIPS64 Release 2 features.
611 FIXME: Eventually this should be replaced by a real CPU model. */
612 .name
= "MIPS64R2-generic",
613 .CP0_PRid
= 0x00010000,
614 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) | (0x2 << CP0C0_AT
) |
615 (MMU_TYPE_R4000
<< CP0C0_MT
),
616 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (63 << CP0C1_MMU
) |
617 (2 << CP0C1_IS
) | (4 << CP0C1_IL
) | (3 << CP0C1_IA
) |
618 (2 << CP0C1_DS
) | (4 << CP0C1_DL
) | (3 << CP0C1_DA
) |
619 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
620 .CP0_Config2
= MIPS_CONFIG2
,
621 .CP0_Config3
= MIPS_CONFIG3
| (1 << CP0C3_LPA
),
622 .CP0_LLAddr_rw_bitmask
= 0,
623 .CP0_LLAddr_shift
= 0,
626 .CP0_Status_rw_bitmask
= 0x36FBFFFF,
627 .CP0_EBaseWG_rw_bitmask
= (1 << CP0EBase_WG
),
628 .CP1_fcr0
= (1 << FCR0_F64
) | (1 << FCR0_3D
) | (1 << FCR0_PS
) |
629 (1 << FCR0_L
) | (1 << FCR0_W
) | (1 << FCR0_D
) |
630 (1 << FCR0_S
) | (0x00 << FCR0_PRID
) | (0x0 << FCR0_REV
),
632 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
635 .insn_flags
= CPU_MIPS64R2
| ASE_MIPS3D
,
636 .mmu_type
= MMU_TYPE_R4000
,
640 .CP0_PRid
= 0x00018900,
641 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) | (0x2 << CP0C0_AT
) |
642 (MMU_TYPE_R4000
<< CP0C0_MT
),
643 .CP0_Config1
= MIPS_CONFIG1
| (31 << CP0C1_MMU
) |
644 (1 << CP0C1_IS
) | (4 << CP0C1_IL
) | (1 << CP0C1_IA
) |
645 (1 << CP0C1_DS
) | (4 << CP0C1_DL
) | (1 << CP0C1_DA
) |
646 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
647 .CP0_Config2
= MIPS_CONFIG2
,
648 .CP0_Config3
= MIPS_CONFIG3
,
649 .CP0_LLAddr_rw_bitmask
= 0,
650 .CP0_LLAddr_shift
= 4,
653 .CP0_Status_rw_bitmask
= 0x12F8FFFF,
656 .insn_flags
= CPU_MIPS64R2
,
657 .mmu_type
= MMU_TYPE_R4000
,
661 .CP0_PRid
= 0x00018900,
662 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) | (0x2 << CP0C0_AT
) |
663 (MMU_TYPE_R4000
<< CP0C0_MT
),
664 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (31 << CP0C1_MMU
) |
665 (1 << CP0C1_IS
) | (4 << CP0C1_IL
) | (1 << CP0C1_IA
) |
666 (1 << CP0C1_DS
) | (4 << CP0C1_DL
) | (1 << CP0C1_DA
) |
667 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
668 .CP0_Config2
= MIPS_CONFIG2
,
669 .CP0_Config3
= MIPS_CONFIG3
,
670 .CP0_LLAddr_rw_bitmask
= 0,
671 .CP0_LLAddr_shift
= 4,
674 .CP0_Status_rw_bitmask
= 0x36F8FFFF,
675 .CP1_fcr0
= (1 << FCR0_F64
) | (1 << FCR0_L
) | (1 << FCR0_W
) |
676 (1 << FCR0_D
) | (1 << FCR0_S
) |
677 (0x89 << FCR0_PRID
) | (0x0 << FCR0_REV
),
680 .insn_flags
= CPU_MIPS64R2
,
681 .mmu_type
= MMU_TYPE_R4000
,
686 .CP0_Config0
= MIPS_CONFIG0
| (0x2 << CP0C0_AR
) | (0x2 << CP0C0_AT
) |
687 (MMU_TYPE_R4000
<< CP0C0_MT
),
688 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (15 << CP0C1_MMU
) |
689 (2 << CP0C1_IS
) | (5 << CP0C1_IL
) | (3 << CP0C1_IA
) |
690 (2 << CP0C1_DS
) | (5 << CP0C1_DL
) | (3 << CP0C1_DA
) |
691 (0 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
692 .CP0_Config2
= MIPS_CONFIG2
,
693 .CP0_Config3
= MIPS_CONFIG3
| (1U << CP0C3_M
) |
694 (1 << CP0C3_CMGCR
) | (1 << CP0C3_MSAP
) |
695 (1 << CP0C3_BP
) | (1 << CP0C3_BI
) | (1 << CP0C3_ULRI
) |
696 (1 << CP0C3_RXI
) | (1 << CP0C3_LPA
) | (1 << CP0C3_VInt
),
697 .CP0_Config4
= MIPS_CONFIG4
| (1U << CP0C4_M
) | (3 << CP0C4_IE
) |
698 (1 << CP0C4_AE
) | (0xfc << CP0C4_KScrExist
),
699 .CP0_Config5
= MIPS_CONFIG5
| (1 << CP0C5_XNP
) | (1 << CP0C5_VP
) |
700 (1 << CP0C5_LLB
) | (1 << CP0C5_MRP
),
701 .CP0_Config5_rw_bitmask
= (1 << CP0C5_MSAEn
) | (1 << CP0C5_SBRI
) |
702 (1 << CP0C5_FRE
) | (1 << CP0C5_UFE
),
703 .CP0_LLAddr_rw_bitmask
= 0,
704 .CP0_LLAddr_shift
= 0,
707 .CP0_Status_rw_bitmask
= 0x30D8FFFF,
708 .CP0_PageGrain
= (1 << CP0PG_IEC
) | (1 << CP0PG_XIE
) |
710 .CP0_PageGrain_rw_bitmask
= (1 << CP0PG_ELPA
),
711 .CP0_EBaseWG_rw_bitmask
= (1 << CP0EBase_WG
),
712 .CP1_fcr0
= (1 << FCR0_FREP
) | (1 << FCR0_HAS2008
) | (1 << FCR0_F64
) |
713 (1 << FCR0_L
) | (1 << FCR0_W
) | (1 << FCR0_D
) |
714 (1 << FCR0_S
) | (0x03 << FCR0_PRID
) | (0x0 << FCR0_REV
),
715 .CP1_fcr31
= (1 << FCR31_ABS2008
) | (1 << FCR31_NAN2008
),
716 .CP1_fcr31_rw_bitmask
= 0x0103FFFF,
717 .MSAIR
= 0x03 << MSAIR_ProcID
,
720 .insn_flags
= CPU_MIPS64R6
| ASE_MSA
,
721 .mmu_type
= MMU_TYPE_R4000
,
724 .name
= "Loongson-2E",
726 /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size. */
727 .CP0_Config0
= (0x1<<17) | (0x1<<16) | (0x1<<11) | (0x1<<8) |
728 (0x1<<5) | (0x1<<4) | (0x1<<1),
729 /* Note: Config1 is only used internally,
730 Loongson-2E has only Config0. */
731 .CP0_Config1
= (1 << CP0C1_FP
) | (47 << CP0C1_MMU
),
734 .CP0_Status_rw_bitmask
= 0x35D0FFFF,
735 .CP1_fcr0
= (0x5 << FCR0_PRID
) | (0x1 << FCR0_REV
),
737 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
740 .insn_flags
= CPU_LOONGSON2E
,
741 .mmu_type
= MMU_TYPE_R4000
,
744 .name
= "Loongson-2F",
746 /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size. */
747 .CP0_Config0
= (0x1<<17) | (0x1<<16) | (0x1<<11) | (0x1<<8) |
748 (0x1<<5) | (0x1<<4) | (0x1<<1),
749 /* Note: Config1 is only used internally,
750 Loongson-2F has only Config0. */
751 .CP0_Config1
= (1 << CP0C1_FP
) | (47 << CP0C1_MMU
),
754 .CP0_Status_rw_bitmask
= 0xF5D0FF1F, /* Bits 7:5 not writable. */
755 .CP1_fcr0
= (0x5 << FCR0_PRID
) | (0x1 << FCR0_REV
),
757 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
760 .insn_flags
= CPU_LOONGSON2F
,
761 .mmu_type
= MMU_TYPE_R4000
,
764 /* A generic CPU providing MIPS64 ASE DSP 2 features.
765 FIXME: Eventually this should be replaced by a real CPU model. */
766 .name
= "mips64dspr2",
767 .CP0_PRid
= 0x00010000,
768 .CP0_Config0
= MIPS_CONFIG0
| (0x1 << CP0C0_AR
) | (0x2 << CP0C0_AT
) |
769 (MMU_TYPE_R4000
<< CP0C0_MT
),
770 .CP0_Config1
= MIPS_CONFIG1
| (1 << CP0C1_FP
) | (63 << CP0C1_MMU
) |
771 (2 << CP0C1_IS
) | (4 << CP0C1_IL
) | (3 << CP0C1_IA
) |
772 (2 << CP0C1_DS
) | (4 << CP0C1_DL
) | (3 << CP0C1_DA
) |
773 (1 << CP0C1_PC
) | (1 << CP0C1_WR
) | (1 << CP0C1_EP
),
774 .CP0_Config2
= MIPS_CONFIG2
,
775 .CP0_Config3
= MIPS_CONFIG3
| (1U << CP0C3_M
) | (1 << CP0C3_DSP2P
) |
776 (1 << CP0C3_DSPP
) | (1 << CP0C3_LPA
),
777 .CP0_LLAddr_rw_bitmask
= 0,
778 .CP0_LLAddr_shift
= 0,
781 .CP0_Status_rw_bitmask
= 0x37FBFFFF,
782 .CP1_fcr0
= (1 << FCR0_F64
) | (1 << FCR0_3D
) | (1 << FCR0_PS
) |
783 (1 << FCR0_L
) | (1 << FCR0_W
) | (1 << FCR0_D
) |
784 (1 << FCR0_S
) | (0x00 << FCR0_PRID
) | (0x0 << FCR0_REV
),
786 .CP1_fcr31_rw_bitmask
= 0xFF83FFFF,
789 .insn_flags
= CPU_MIPS64R2
| ASE_DSP
| ASE_DSPR2
,
790 .mmu_type
= MMU_TYPE_R4000
,
795 const int mips_defs_number
= ARRAY_SIZE(mips_defs
);
797 void mips_cpu_list (FILE *f
, fprintf_function cpu_fprintf
)
801 for (i
= 0; i
< ARRAY_SIZE(mips_defs
); i
++) {
802 (*cpu_fprintf
)(f
, "MIPS '%s'\n",
807 #ifndef CONFIG_USER_ONLY
808 static void no_mmu_init (CPUMIPSState
*env
, const mips_def_t
*def
)
810 env
->tlb
->nb_tlb
= 1;
811 env
->tlb
->map_address
= &no_mmu_map_address
;
814 static void fixed_mmu_init (CPUMIPSState
*env
, const mips_def_t
*def
)
816 env
->tlb
->nb_tlb
= 1;
817 env
->tlb
->map_address
= &fixed_mmu_map_address
;
820 static void r4k_mmu_init (CPUMIPSState
*env
, const mips_def_t
*def
)
822 env
->tlb
->nb_tlb
= 1 + ((def
->CP0_Config1
>> CP0C1_MMU
) & 63);
823 env
->tlb
->map_address
= &r4k_map_address
;
824 env
->tlb
->helper_tlbwi
= r4k_helper_tlbwi
;
825 env
->tlb
->helper_tlbwr
= r4k_helper_tlbwr
;
826 env
->tlb
->helper_tlbp
= r4k_helper_tlbp
;
827 env
->tlb
->helper_tlbr
= r4k_helper_tlbr
;
828 env
->tlb
->helper_tlbinv
= r4k_helper_tlbinv
;
829 env
->tlb
->helper_tlbinvf
= r4k_helper_tlbinvf
;
832 static void mmu_init (CPUMIPSState
*env
, const mips_def_t
*def
)
834 MIPSCPU
*cpu
= mips_env_get_cpu(env
);
836 env
->tlb
= g_malloc0(sizeof(CPUMIPSTLBContext
));
838 switch (def
->mmu_type
) {
840 no_mmu_init(env
, def
);
843 r4k_mmu_init(env
, def
);
846 fixed_mmu_init(env
, def
);
852 cpu_abort(CPU(cpu
), "MMU type not supported\n");
855 #endif /* CONFIG_USER_ONLY */
857 static void fpu_init (CPUMIPSState
*env
, const mips_def_t
*def
)
861 for (i
= 0; i
< MIPS_FPU_MAX
; i
++)
862 env
->fpus
[i
].fcr0
= def
->CP1_fcr0
;
864 memcpy(&env
->active_fpu
, &env
->fpus
[0], sizeof(env
->active_fpu
));
867 static void mvp_init (CPUMIPSState
*env
, const mips_def_t
*def
)
869 env
->mvp
= g_malloc0(sizeof(CPUMIPSMVPContext
));
871 /* MVPConf1 implemented, TLB sharable, no gating storage support,
872 programmable cache partitioning implemented, number of allocatable
873 and sharable TLB entries, MVP has allocatable TCs, 2 VPEs
874 implemented, 5 TCs implemented. */
875 env
->mvp
->CP0_MVPConf0
= (1U << CP0MVPC0_M
) | (1 << CP0MVPC0_TLBS
) |
876 (0 << CP0MVPC0_GS
) | (1 << CP0MVPC0_PCP
) |
877 // TODO: actually do 2 VPEs.
878 // (1 << CP0MVPC0_TCA) | (0x1 << CP0MVPC0_PVPE) |
879 // (0x04 << CP0MVPC0_PTC);
880 (1 << CP0MVPC0_TCA
) | (0x0 << CP0MVPC0_PVPE
) |
881 (0x00 << CP0MVPC0_PTC
);
882 #if !defined(CONFIG_USER_ONLY)
883 /* Usermode has no TLB support */
884 env
->mvp
->CP0_MVPConf0
|= (env
->tlb
->nb_tlb
<< CP0MVPC0_PTLBE
);
887 /* Allocatable CP1 have media extensions, allocatable CP1 have FP support,
888 no UDI implemented, no CP2 implemented, 1 CP1 implemented. */
889 env
->mvp
->CP0_MVPConf1
= (1U << CP0MVPC1_CIM
) | (1 << CP0MVPC1_CIF
) |
890 (0x0 << CP0MVPC1_PCX
) | (0x0 << CP0MVPC1_PCP2
) |
891 (0x1 << CP0MVPC1_PCP1
);
894 static void msa_reset(CPUMIPSState
*env
)
896 #ifdef CONFIG_USER_ONLY
897 /* MSA access enabled */
898 env
->CP0_Config5
|= 1 << CP0C5_MSAEn
;
899 env
->CP0_Status
|= (1 << CP0St_CU1
) | (1 << CP0St_FR
);
903 - non-signaling floating point exception mode off (NX bit is 0)
904 - Cause, Enables, and Flags are all 0
905 - round to nearest / ties to even (RM bits are 0) */
906 env
->active_tc
.msacsr
= 0;
908 restore_msa_fp_status(env
);
910 /* tininess detected after rounding.*/
911 set_float_detect_tininess(float_tininess_after_rounding
,
912 &env
->active_tc
.msa_fp_status
);
914 /* clear float_status exception flags */
915 set_float_exception_flags(0, &env
->active_tc
.msa_fp_status
);
917 /* clear float_status nan mode */
918 set_default_nan_mode(0, &env
->active_tc
.msa_fp_status
);
920 /* set proper signanling bit meaning ("1" means "quiet") */
921 set_snan_bit_is_one(0, &env
->active_tc
.msa_fp_status
);