xref: /openbmc/qemu/target/mips/cpu-defs.c.inc (revision 67194c7018b8b06a1c149757f596bb919c683725)
10dc351caSPhilippe Mathieu-Daudé/*
20dc351caSPhilippe Mathieu-Daudé *  MIPS emulation for qemu: CPU initialisation routines.
30dc351caSPhilippe Mathieu-Daudé *
40dc351caSPhilippe Mathieu-Daudé *  Copyright (c) 2004-2005 Jocelyn Mayer
50dc351caSPhilippe Mathieu-Daudé *  Copyright (c) 2007 Herve Poussineau
60dc351caSPhilippe Mathieu-Daudé *
70dc351caSPhilippe Mathieu-Daudé * This library is free software; you can redistribute it and/or
80dc351caSPhilippe Mathieu-Daudé * modify it under the terms of the GNU Lesser General Public
90dc351caSPhilippe Mathieu-Daudé * License as published by the Free Software Foundation; either
100dc351caSPhilippe Mathieu-Daudé * version 2.1 of the License, or (at your option) any later version.
110dc351caSPhilippe Mathieu-Daudé *
120dc351caSPhilippe Mathieu-Daudé * This library is distributed in the hope that it will be useful,
130dc351caSPhilippe Mathieu-Daudé * but WITHOUT ANY WARRANTY; without even the implied warranty of
140dc351caSPhilippe Mathieu-Daudé * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
150dc351caSPhilippe Mathieu-Daudé * Lesser General Public License for more details.
160dc351caSPhilippe Mathieu-Daudé *
170dc351caSPhilippe Mathieu-Daudé * You should have received a copy of the GNU Lesser General Public
180dc351caSPhilippe Mathieu-Daudé * License along with this library; if not, see <http://www.gnu.org/licenses/>.
190dc351caSPhilippe Mathieu-Daudé */
200dc351caSPhilippe Mathieu-Daudé
210dc351caSPhilippe Mathieu-Daudé/* CPU / CPU family specific config register values. */
220dc351caSPhilippe Mathieu-Daudé
230dc351caSPhilippe Mathieu-Daudé/* Have config1, uncached coherency */
240dc351caSPhilippe Mathieu-Daudé#define MIPS_CONFIG0                                              \
250dc351caSPhilippe Mathieu-Daudé  ((1U << CP0C0_M) | (0x2 << CP0C0_K0))
260dc351caSPhilippe Mathieu-Daudé
270dc351caSPhilippe Mathieu-Daudé/* Have config2, no coprocessor2 attached, no MDMX support attached,
280dc351caSPhilippe Mathieu-Daudé   no performance counters, watch registers present,
290dc351caSPhilippe Mathieu-Daudé   no code compression, EJTAG present, no FPU */
300dc351caSPhilippe Mathieu-Daudé#define MIPS_CONFIG1                                              \
310dc351caSPhilippe Mathieu-Daudé((1U << CP0C1_M) |                                                \
320dc351caSPhilippe Mathieu-Daudé (0 << CP0C1_C2) | (0 << CP0C1_MD) | (0 << CP0C1_PC) |            \
330dc351caSPhilippe Mathieu-Daudé (1 << CP0C1_WR) | (0 << CP0C1_CA) | (1 << CP0C1_EP) |            \
340dc351caSPhilippe Mathieu-Daudé (0 << CP0C1_FP))
350dc351caSPhilippe Mathieu-Daudé
360dc351caSPhilippe Mathieu-Daudé/* Have config3, no tertiary/secondary caches implemented */
370dc351caSPhilippe Mathieu-Daudé#define MIPS_CONFIG2                                              \
380dc351caSPhilippe Mathieu-Daudé((1U << CP0C2_M))
390dc351caSPhilippe Mathieu-Daudé
400dc351caSPhilippe Mathieu-Daudé/* No config4, no DSP ASE, no large physaddr (PABITS),
410dc351caSPhilippe Mathieu-Daudé   no external interrupt controller, no vectored interrupts,
420dc351caSPhilippe Mathieu-Daudé   no 1kb pages, no SmartMIPS ASE, no trace logic */
430dc351caSPhilippe Mathieu-Daudé#define MIPS_CONFIG3                                              \
440dc351caSPhilippe Mathieu-Daudé((0 << CP0C3_M) | (0 << CP0C3_DSPP) | (0 << CP0C3_LPA) |          \
450dc351caSPhilippe Mathieu-Daudé (0 << CP0C3_VEIC) | (0 << CP0C3_VInt) | (0 << CP0C3_SP) |        \
460dc351caSPhilippe Mathieu-Daudé (0 << CP0C3_SM) | (0 << CP0C3_TL))
470dc351caSPhilippe Mathieu-Daudé
480dc351caSPhilippe Mathieu-Daudé#define MIPS_CONFIG4                                              \
490dc351caSPhilippe Mathieu-Daudé((0 << CP0C4_M))
500dc351caSPhilippe Mathieu-Daudé
510dc351caSPhilippe Mathieu-Daudé#define MIPS_CONFIG5                                              \
520dc351caSPhilippe Mathieu-Daudé((0 << CP0C5_M))
530dc351caSPhilippe Mathieu-Daudé
540dc351caSPhilippe Mathieu-Daudé/*****************************************************************************/
550dc351caSPhilippe Mathieu-Daudé/* MIPS CPU definitions */
560dc351caSPhilippe Mathieu-Daudéconst mips_def_t mips_defs[] =
570dc351caSPhilippe Mathieu-Daudé{
580dc351caSPhilippe Mathieu-Daudé    {
590dc351caSPhilippe Mathieu-Daudé        .name = "4Kc",
600dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018000,
610dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_R4000 << CP0C0_MT),
620dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
630dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
640dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
650dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_CA),
660dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
670dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
680dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
690dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
700dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
710dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
720dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1278FF17,
730dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
740dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
750dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R1,
760dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
770dc351caSPhilippe Mathieu-Daudé    },
780dc351caSPhilippe Mathieu-Daudé    {
790dc351caSPhilippe Mathieu-Daudé        .name = "4Km",
800dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018300,
810dc351caSPhilippe Mathieu-Daudé        /* Config1 implemented, fixed mapping MMU,
820dc351caSPhilippe Mathieu-Daudé           no virtual icache, uncached coherency. */
830dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_FMT << CP0C0_MT),
840dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 |
850dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
860dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
870dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
880dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
890dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
900dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
910dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
920dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
930dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
940dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1258FF17,
950dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
960dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
970dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R1 | ASE_MIPS16,
980dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_FMT,
990dc351caSPhilippe Mathieu-Daudé    },
1000dc351caSPhilippe Mathieu-Daudé    {
1010dc351caSPhilippe Mathieu-Daudé        .name = "4KEcR1",
1020dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018400,
1030dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_R4000 << CP0C0_MT),
1040dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
1050dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
1060dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
1070dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_CA),
1080dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
1090dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
1100dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
1110dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
1120dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
1130dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
1140dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1278FF17,
1150dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
1160dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
1170dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R1,
1180dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
1190dc351caSPhilippe Mathieu-Daudé    },
1200dc351caSPhilippe Mathieu-Daudé    {
1211980fa0aSSiarhei Volkau        .name = "XBurstR1",
1221980fa0aSSiarhei Volkau        .CP0_PRid = 0x1ed0024f,
1231980fa0aSSiarhei Volkau        .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_R4000 << CP0C0_MT),
1241980fa0aSSiarhei Volkau        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
1251980fa0aSSiarhei Volkau                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
1261980fa0aSSiarhei Volkau                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
1271980fa0aSSiarhei Volkau                       (0 << CP0C1_CA),
1281980fa0aSSiarhei Volkau        .CP0_Config2 = MIPS_CONFIG2,
1291980fa0aSSiarhei Volkau        .CP0_Config3 = MIPS_CONFIG3,
1301980fa0aSSiarhei Volkau        .CP0_LLAddr_rw_bitmask = 0,
1311980fa0aSSiarhei Volkau        .CP0_LLAddr_shift = 4,
1321980fa0aSSiarhei Volkau        .SYNCI_Step = 32,
1331980fa0aSSiarhei Volkau        .CCRes = 2,
1341980fa0aSSiarhei Volkau        .CP0_Status_rw_bitmask = 0x1278FF17,
1351980fa0aSSiarhei Volkau        .SEGBITS = 32,
1361980fa0aSSiarhei Volkau        .PABITS = 32,
1371980fa0aSSiarhei Volkau        .insn_flags = CPU_MIPS32R1 | ASE_MXU,
1381980fa0aSSiarhei Volkau        .mmu_type = MMU_TYPE_R4000,
1391980fa0aSSiarhei Volkau    },
1401980fa0aSSiarhei Volkau    {
1410dc351caSPhilippe Mathieu-Daudé        .name = "4KEmR1",
1420dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018500,
1430dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (MMU_TYPE_FMT << CP0C0_MT),
1440dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 |
1450dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
1460dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
1470dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
1480dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
1490dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
1500dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
1510dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
1520dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
1530dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
1540dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1258FF17,
1550dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
1560dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
1570dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R1 | ASE_MIPS16,
1580dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_FMT,
1590dc351caSPhilippe Mathieu-Daudé    },
1600dc351caSPhilippe Mathieu-Daudé    {
1610dc351caSPhilippe Mathieu-Daudé        .name = "4KEc",
1620dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019000,
1630dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
1640dc351caSPhilippe Mathieu-Daudé                    (MMU_TYPE_R4000 << CP0C0_MT),
1650dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
1660dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
1670dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
1680dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_CA),
1690dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
1700dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt),
1710dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
1720dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
1730dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
1740dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
1750dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1278FF17,
1760dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
1770dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
1780dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2,
1790dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
1800dc351caSPhilippe Mathieu-Daudé    },
1810dc351caSPhilippe Mathieu-Daudé    {
1820dc351caSPhilippe Mathieu-Daudé        .name = "4KEm",
1830dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019100,
1840dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
1850dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_FMT << CP0C0_MT),
1860dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 |
1870dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
1880dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
1890dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
1900dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
1910dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
1920dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
1930dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
1940dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
1950dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
1960dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1258FF17,
1970dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
1980dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
1990dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MIPS16,
2000dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_FMT,
2010dc351caSPhilippe Mathieu-Daudé    },
2020dc351caSPhilippe Mathieu-Daudé    {
2030dc351caSPhilippe Mathieu-Daudé        .name = "24Kc",
2040dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019300,
2050dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
2060dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
2070dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
2080dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
2090dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
2100dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
2110dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
2120dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt),
2130dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
2140dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
2150dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
2160dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
2170dc351caSPhilippe Mathieu-Daudé        /* No DSP implemented. */
2180dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1278FF1F,
2190dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
2200dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
2210dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MIPS16,
2220dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
2230dc351caSPhilippe Mathieu-Daudé    },
2240dc351caSPhilippe Mathieu-Daudé    {
2250dc351caSPhilippe Mathieu-Daudé        .name = "24KEc",
2260dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019600,
2270dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
2280dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
2290dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
2300dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
2310dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
2320dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
2330dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
2340dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_DSPP) | (0 << CP0C3_VInt),
2350dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
2360dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
2370dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
2380dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
2390dc351caSPhilippe Mathieu-Daudé        /* we have a DSP, but no FPU */
2400dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1378FF1F,
2410dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
2420dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
2430dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP,
2440dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
2450dc351caSPhilippe Mathieu-Daudé    },
2460dc351caSPhilippe Mathieu-Daudé    {
2470dc351caSPhilippe Mathieu-Daudé        .name = "24Kf",
2480dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019300,
2490dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
2500dc351caSPhilippe Mathieu-Daudé                    (MMU_TYPE_R4000 << CP0C0_MT),
2510dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) |
2520dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
2530dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
2540dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
2550dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
2560dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (0 << CP0C3_VInt),
2570dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
2580dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
2590dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
2600dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
2610dc351caSPhilippe Mathieu-Daudé        /* No DSP implemented. */
2620dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3678FF1F,
2630dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
2640dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_D) | (1 << FCR0_S) | (0x93 << FCR0_PRID),
2650dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
2660dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
2670dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
2680dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
2690dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MIPS16,
2700dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
2710dc351caSPhilippe Mathieu-Daudé    },
2720dc351caSPhilippe Mathieu-Daudé    {
2730dc351caSPhilippe Mathieu-Daudé        .name = "34Kf",
2740dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019500,
2750dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
2760dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
2770dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) |
2780dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
2790dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
2800dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
2810dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
2820dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_VInt) | (1 << CP0C3_MT) |
2830dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_DSPP),
2840dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
2850dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
2860dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
2870dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
2880dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3778FF1F,
2890dc351caSPhilippe Mathieu-Daudé        .CP0_TCStatus_rw_bitmask = (0 << CP0TCSt_TCU3) | (0 << CP0TCSt_TCU2) |
2900dc351caSPhilippe Mathieu-Daudé                    (1 << CP0TCSt_TCU1) | (1 << CP0TCSt_TCU0) |
2910dc351caSPhilippe Mathieu-Daudé                    (0 << CP0TCSt_TMX) | (1 << CP0TCSt_DT) |
2920dc351caSPhilippe Mathieu-Daudé                    (1 << CP0TCSt_DA) | (1 << CP0TCSt_A) |
2930dc351caSPhilippe Mathieu-Daudé                    (0x3 << CP0TCSt_TKSU) | (1 << CP0TCSt_IXMT) |
2940dc351caSPhilippe Mathieu-Daudé                    (0xff << CP0TCSt_TASID),
2950dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
2960dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_D) | (1 << FCR0_S) | (0x95 << FCR0_PRID),
2970dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
2980dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
2990dc351caSPhilippe Mathieu-Daudé        .CP0_SRSCtl = (0xf << CP0SRSCtl_HSS),
3000dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf0_rw_bitmask = 0x3fffffff,
3010dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf0 = (1U << CP0SRSC0_M) | (0x3fe << CP0SRSC0_SRS3) |
3020dc351caSPhilippe Mathieu-Daudé                    (0x3fe << CP0SRSC0_SRS2) | (0x3fe << CP0SRSC0_SRS1),
3030dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf1_rw_bitmask = 0x3fffffff,
3040dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf1 = (1U << CP0SRSC1_M) | (0x3fe << CP0SRSC1_SRS6) |
3050dc351caSPhilippe Mathieu-Daudé                    (0x3fe << CP0SRSC1_SRS5) | (0x3fe << CP0SRSC1_SRS4),
3060dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf2_rw_bitmask = 0x3fffffff,
3070dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf2 = (1U << CP0SRSC2_M) | (0x3fe << CP0SRSC2_SRS9) |
3080dc351caSPhilippe Mathieu-Daudé                    (0x3fe << CP0SRSC2_SRS8) | (0x3fe << CP0SRSC2_SRS7),
3090dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf3_rw_bitmask = 0x3fffffff,
3100dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf3 = (1U << CP0SRSC3_M) | (0x3fe << CP0SRSC3_SRS12) |
3110dc351caSPhilippe Mathieu-Daudé                    (0x3fe << CP0SRSC3_SRS11) | (0x3fe << CP0SRSC3_SRS10),
3120dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf4_rw_bitmask = 0x3fffffff,
3130dc351caSPhilippe Mathieu-Daudé        .CP0_SRSConf4 = (0x3fe << CP0SRSC4_SRS15) |
3140dc351caSPhilippe Mathieu-Daudé                    (0x3fe << CP0SRSC4_SRS14) | (0x3fe << CP0SRSC4_SRS13),
3150dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
3160dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
317*804607e8SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP,
3180dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
3190dc351caSPhilippe Mathieu-Daudé    },
3200dc351caSPhilippe Mathieu-Daudé    {
3210dc351caSPhilippe Mathieu-Daudé        .name = "74Kf",
3220dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019700,
3230dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
3240dc351caSPhilippe Mathieu-Daudé                    (MMU_TYPE_R4000 << CP0C0_MT),
3250dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) |
3260dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
3270dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
3280dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_CA),
3290dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
3300dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_DSP2P) | (1 << CP0C3_DSPP) |
3310dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_VInt),
3320dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
3330dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
3340dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
3350dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
3360dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3778FF1F,
3370dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
3380dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_D) | (1 << FCR0_S) | (0x93 << FCR0_PRID),
3390dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
3400dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
3410dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
3420dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
3430dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP | ASE_DSP_R2,
3440dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
3450dc351caSPhilippe Mathieu-Daudé    },
3460dc351caSPhilippe Mathieu-Daudé    {
3471980fa0aSSiarhei Volkau        .name = "XBurstR2",
3481980fa0aSSiarhei Volkau        .CP0_PRid = 0x2ed1024f,
3491980fa0aSSiarhei Volkau        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
3501980fa0aSSiarhei Volkau                    (MMU_TYPE_R4000 << CP0C0_MT),
3511980fa0aSSiarhei Volkau        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) |
3521980fa0aSSiarhei Volkau                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
3531980fa0aSSiarhei Volkau                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
3541980fa0aSSiarhei Volkau                       (1 << CP0C1_CA),
3551980fa0aSSiarhei Volkau        .CP0_Config2 = MIPS_CONFIG2,
3561980fa0aSSiarhei Volkau        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_DSP2P) | (1 << CP0C3_DSPP) |
3571980fa0aSSiarhei Volkau                       (1 << CP0C3_VInt),
3581980fa0aSSiarhei Volkau        .CP0_LLAddr_rw_bitmask = 0,
3591980fa0aSSiarhei Volkau        .CP0_LLAddr_shift = 4,
3601980fa0aSSiarhei Volkau        .SYNCI_Step = 32,
3611980fa0aSSiarhei Volkau        .CCRes = 2,
3621980fa0aSSiarhei Volkau        .CP0_Status_rw_bitmask = 0x3778FF1F,
3631980fa0aSSiarhei Volkau        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
3641980fa0aSSiarhei Volkau                    (1 << FCR0_D) | (1 << FCR0_S) | (0x93 << FCR0_PRID),
3651980fa0aSSiarhei Volkau        .CP1_fcr31 = 0,
3661980fa0aSSiarhei Volkau        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
3671980fa0aSSiarhei Volkau        .SEGBITS = 32,
3681980fa0aSSiarhei Volkau        .PABITS = 32,
3691980fa0aSSiarhei Volkau        .insn_flags = CPU_MIPS32R2 | ASE_MXU,
3701980fa0aSSiarhei Volkau        .mmu_type = MMU_TYPE_R4000,
3711980fa0aSSiarhei Volkau    },
3721980fa0aSSiarhei Volkau    {
3730dc351caSPhilippe Mathieu-Daudé        .name = "M14K",
3740dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019b00,
3750dc351caSPhilippe Mathieu-Daudé        /* Config1 implemented, fixed mapping MMU,
3760dc351caSPhilippe Mathieu-Daudé           no virtual icache, uncached coherency. */
3770dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_KU) | (0x2 << CP0C0_K23) |
3780dc351caSPhilippe Mathieu-Daudé                       (0x1 << CP0C0_AR) | (MMU_TYPE_FMT << CP0C0_MT),
3790dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1,
3800dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
381dcebb36eSMarcin Nowakowski        .CP0_Config3 = MIPS_CONFIG3 | (0x2 << CP0C3_ISA) | (1 << CP0C3_VInt) |
382dcebb36eSMarcin Nowakowski                       (1 << CP0C3_M),
383dcebb36eSMarcin Nowakowski        .CP0_Config4 = MIPS_CONFIG4 | (1 << CP0C4_M),
384dcebb36eSMarcin Nowakowski        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_NFExists),
38536b84f85SMarcin Nowakowski        .CP0_Config7 = 1 << CP0C7_WII,
3860dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
3870dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
3880dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
3890dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
3900dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1258FF17,
3910dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
3920dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
3930dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MICROMIPS,
3940dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_FMT,
3950dc351caSPhilippe Mathieu-Daudé    },
3960dc351caSPhilippe Mathieu-Daudé    {
3970dc351caSPhilippe Mathieu-Daudé        .name = "M14Kc",
3980dc351caSPhilippe Mathieu-Daudé        /* This is the TLB-based MMU core.  */
3990dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00019c00,
4000dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
4010dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
4020dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
4030dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
4040dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA),
4050dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
406dcebb36eSMarcin Nowakowski        .CP0_Config3 = MIPS_CONFIG3 | (0x2 << CP0C3_ISA) | (0 << CP0C3_VInt) |
407dcebb36eSMarcin Nowakowski                       (1 << CP0C3_M),
408dcebb36eSMarcin Nowakowski        .CP0_Config4 = MIPS_CONFIG4 | (1 << CP0C4_M),
409dcebb36eSMarcin Nowakowski        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_NFExists),
41036b84f85SMarcin Nowakowski        .CP0_Config7 = 1 << CP0C7_WII,
4110dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
4120dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
4130dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
4140dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
4150dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x1278FF17,
4160dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
4170dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
4180dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R2 | ASE_MICROMIPS,
4190dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
4200dc351caSPhilippe Mathieu-Daudé    },
4210dc351caSPhilippe Mathieu-Daudé    {
4220dc351caSPhilippe Mathieu-Daudé        /* FIXME:
4230dc351caSPhilippe Mathieu-Daudé         * Config3: VZ, CTXTC, CDMM, TL
4240dc351caSPhilippe Mathieu-Daudé         * Config4: MMUExtDef
4250dc351caSPhilippe Mathieu-Daudé         * Config5: MRP
4260dc351caSPhilippe Mathieu-Daudé         * */
4270dc351caSPhilippe Mathieu-Daudé        .name = "P5600",
4280dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x0001A800,
4290dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (1 << CP0C0_MM) | (1 << CP0C0_AR) |
4300dc351caSPhilippe Mathieu-Daudé                    (MMU_TYPE_R4000 << CP0C0_MT),
4310dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (0x3F << CP0C1_MMU) |
4320dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
4330dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
4340dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_FP),
4350dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
4360dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1U << CP0C3_M) |
4370dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_CMGCR) | (1 << CP0C3_MSAP) |
4380dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_BP) | (1 << CP0C3_BI) | (1 << CP0C3_SC) |
4390dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_PW) | (1 << CP0C3_ULRI) | (1 << CP0C3_RXI) |
4400dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_LPA) | (1 << CP0C3_VInt),
4410dc351caSPhilippe Mathieu-Daudé        .CP0_Config4 = MIPS_CONFIG4 | (1U << CP0C4_M) | (2 << CP0C4_IE) |
4420dc351caSPhilippe Mathieu-Daudé                       (0x1c << CP0C4_KScrExist),
4430dc351caSPhilippe Mathieu-Daudé        .CP0_Config4_rw_bitmask = 0,
4440dc351caSPhilippe Mathieu-Daudé        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_EVA) | (1 << CP0C5_MVH) |
4450dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C5_LLB) | (1 << CP0C5_MRP),
4460dc351caSPhilippe Mathieu-Daudé        .CP0_Config5_rw_bitmask = (1 << CP0C5_K) | (1 << CP0C5_CV) |
4470dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_MSAEn) | (1 << CP0C5_UFE) |
4480dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_FRE) | (1 << CP0C5_UFR),
44936b84f85SMarcin Nowakowski        .CP0_Config7 = 1 << CP0C7_WII,
4500dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
4510dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
4520dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
4530dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
4540dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3C68FF1F,
4550dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = (1U << CP0PG_RIE) | (1 << CP0PG_XIE) |
4560dc351caSPhilippe Mathieu-Daudé                    (1 << CP0PG_ELPA) | (1 << CP0PG_IEC),
4570dc351caSPhilippe Mathieu-Daudé        .CP0_EBaseWG_rw_bitmask = (1 << CP0EBase_WG),
4580dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_UFRP) | (1 << FCR0_HAS2008) |
4590dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
4600dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_D) | (1 << FCR0_S) | (0x03 << FCR0_PRID),
4610dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008),
4620dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
4630dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
4640dc351caSPhilippe Mathieu-Daudé        .PABITS = 40,
4657e2a619aSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R5,
4660dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
4670dc351caSPhilippe Mathieu-Daudé    },
4680dc351caSPhilippe Mathieu-Daudé    {
4690dc351caSPhilippe Mathieu-Daudé        /* A generic CPU supporting MIPS32 Release 6 ISA.
4700dc351caSPhilippe Mathieu-Daudé           FIXME: Support IEEE 754-2008 FP.
4710dc351caSPhilippe Mathieu-Daudé                  Eventually this should be replaced by a real CPU model. */
4720dc351caSPhilippe Mathieu-Daudé        .name = "mips32r6-generic",
4730dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00010000,
4740dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AR) |
4750dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
4760dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (31 << CP0C1_MMU) |
4770dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
4780dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
4790dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
4800dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
4815d3d5222SAleksandar Markovic        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_MSAP) |
4825d3d5222SAleksandar Markovic                       (1 << CP0C3_BP) | (1 << CP0C3_BI) |
4830dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C3_ISA) | (1 << CP0C3_ULRI) |
4840dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_RXI) | (1U << CP0C3_M),
4850dc351caSPhilippe Mathieu-Daudé        .CP0_Config4 = MIPS_CONFIG4 | (0xfc << CP0C4_KScrExist) |
4860dc351caSPhilippe Mathieu-Daudé                       (3 << CP0C4_IE) | (1U << CP0C4_M),
4870dc351caSPhilippe Mathieu-Daudé        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_XNP) | (1 << CP0C5_LLB),
4885d3d5222SAleksandar Markovic        .CP0_Config5_rw_bitmask = (1 << CP0C5_MSAEn) | (1 << CP0C5_UFE) |
4895d3d5222SAleksandar Markovic                                  (1 << CP0C5_FRE) | (1 << CP0C5_SBRI),
4900dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
4910dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
4920dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
4930dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
4940dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3058FF1F,
4950dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain = (1 << CP0PG_IEC) | (1 << CP0PG_XIE) |
4960dc351caSPhilippe Mathieu-Daudé                         (1U << CP0PG_RIE),
4970dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = 0,
4980dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_HAS2008) | (1 << FCR0_F64) |
4990dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) |
5000dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_S) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV),
5010dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008),
5020dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0x0103FFFF,
5035d3d5222SAleksandar Markovic        .MSAIR = 0x03 << MSAIR_ProcID,
5040dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
5050dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
5060dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R6 | ASE_MICROMIPS,
5070dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
5080dc351caSPhilippe Mathieu-Daudé    },
5090dc351caSPhilippe Mathieu-Daudé    {
5100dc351caSPhilippe Mathieu-Daudé        .name = "I7200",
5110dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00010000,
5120dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (1 << CP0C0_MM) | (0x2 << CP0C0_AR) |
5130dc351caSPhilippe Mathieu-Daudé                        (MMU_TYPE_R4000 << CP0C0_MT),
5140dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = (1U << CP0C1_M) | (15 << CP0C1_MMU) | (2 << CP0C1_IS) |
5150dc351caSPhilippe Mathieu-Daudé                       (4 << CP0C1_IL) | (3 << CP0C1_IA) | (2 << CP0C1_DS) |
5160dc351caSPhilippe Mathieu-Daudé                       (4 << CP0C1_DL) | (3 << CP0C1_DA) | (1 << CP0C1_PC) |
5170dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_EP),
5180dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
5190dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1U << CP0C3_M) | (1 << CP0C3_CMGCR) |
5200dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_BI) | (1 << CP0C3_SC) | (3 << CP0C3_MMAR) |
5210dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_ISA_ON_EXC) | (1 << CP0C3_ISA) |
5220dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_ULRI) | (1 << CP0C3_RXI) |
5230dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_DSP2P) | (1 << CP0C3_DSPP) |
5240dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_CTXTC) | (1 << CP0C3_VInt) |
5250dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_CDMM) | (1 << CP0C3_MT) | (1 << CP0C3_TL),
5260dc351caSPhilippe Mathieu-Daudé        .CP0_Config4 = MIPS_CONFIG4 | (0xfc << CP0C4_KScrExist) |
5270dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C4_IE) | (1U << CP0C4_M),
5280dc351caSPhilippe Mathieu-Daudé        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_MVH) | (1 << CP0C5_LLB),
5290dc351caSPhilippe Mathieu-Daudé        .CP0_Config5_rw_bitmask = (1 << CP0C5_SBRI) | (1 << CP0C5_FRE) |
5300dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_UFE),
5310dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
5320dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
5330dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
5340dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
5350dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3158FF1F,
5360dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain = (1 << CP0PG_IEC) | (1 << CP0PG_XIE) |
5370dc351caSPhilippe Mathieu-Daudé                         (1U << CP0PG_RIE),
5380dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = 0,
5390dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_HAS2008) | (1 << FCR0_F64) |
5400dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) |
5410dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_S) | (0x02 << FCR0_PRID) | (0x0 << FCR0_REV),
5420dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008),
5430dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 32,
5440dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
545fc63010eSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS32R6 | ISA_NANOMIPS32 |
546*804607e8SPhilippe Mathieu-Daudé                      ASE_DSP | ASE_DSP_R2 | ASE_DSP_R3,
5470dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
5480dc351caSPhilippe Mathieu-Daudé    },
5490dc351caSPhilippe Mathieu-Daudé#if defined(TARGET_MIPS64)
5500dc351caSPhilippe Mathieu-Daudé    {
5510dc351caSPhilippe Mathieu-Daudé        .name = "R4000",
5520dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00000400,
5530dc351caSPhilippe Mathieu-Daudé        /* No L2 cache, icache size 8k, dcache size 8k, uncached coherency. */
5540dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = (2 << CP0C0_Impl) | (1 << CP0C0_IC) | (1 << CP0C0_DC) |
5550dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C0_K0),
5560dc351caSPhilippe Mathieu-Daudé        /* Note: Config1 is only used internally, the R4000 has only Config0. */
5570dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU),
5580dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0xFFFFFFFF,
5590dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
5600dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 16,
5610dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
5620dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3678FFFF,
5630dc351caSPhilippe Mathieu-Daudé        /* The R4000 has a full 64bit FPU but doesn't use the fcr0 bits. */
5640dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x0 << FCR0_REV),
5650dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
5660dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0x0183FFFF,
5670dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 40,
5680dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
5690dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS3,
5700dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
5710dc351caSPhilippe Mathieu-Daudé    },
5720dc351caSPhilippe Mathieu-Daudé    {
5730dc351caSPhilippe Mathieu-Daudé        .name = "VR5432",
5740dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00005400,
5750dc351caSPhilippe Mathieu-Daudé        /* No L2 cache, icache size 8k, dcache size 8k, uncached coherency. */
5760dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = (2 << CP0C0_Impl) | (1 << CP0C0_IC) | (1 << CP0C0_DC) |
5770dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C0_K0),
5780dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU),
5790dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0xFFFFFFFFL,
5800dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
5810dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 16,
5820dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
5830dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x3678FFFF,
5840dc351caSPhilippe Mathieu-Daudé        /* The VR5432 has a full 64bit FPU but doesn't use the fcr0 bits. */
5850dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (0x54 << FCR0_PRID) | (0x0 << FCR0_REV),
5860dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
5870dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
5880dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 40,
5890dc351caSPhilippe Mathieu-Daudé        .PABITS = 32,
590eaca8576SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS4 | INSN_VR54XX,
5910dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
5920dc351caSPhilippe Mathieu-Daudé    },
5930dc351caSPhilippe Mathieu-Daudé    {
5940dc351caSPhilippe Mathieu-Daudé        .name = "5Kc",
5950dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018100,
5960dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT) |
5970dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
5980dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (31 << CP0C1_MMU) |
5990dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) |
6000dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) |
6010dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
6020dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
6030dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
6040dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
6050dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
6060dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
6070dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
6080dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x12F8FFFF,
6090dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 42,
6100dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
6110dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R1,
6120dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
6130dc351caSPhilippe Mathieu-Daudé    },
6140dc351caSPhilippe Mathieu-Daudé    {
6150dc351caSPhilippe Mathieu-Daudé        .name = "5Kf",
6160dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018100,
6170dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT) |
6180dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
6190dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (31 << CP0C1_MMU) |
6200dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) |
6210dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) |
6220dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
6230dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
6240dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
6250dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
6260dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
6270dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
6280dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
6290dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x36F8FFFF,
6300dc351caSPhilippe Mathieu-Daudé        /* The 5Kf has F64 / L / W but doesn't use the fcr0 bits. */
6310dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_D) | (1 << FCR0_S) |
6320dc351caSPhilippe Mathieu-Daudé                    (0x81 << FCR0_PRID) | (0x0 << FCR0_REV),
6330dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
6340dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
6350dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 42,
6360dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
6370dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R1,
6380dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
6390dc351caSPhilippe Mathieu-Daudé    },
6400dc351caSPhilippe Mathieu-Daudé    {
6410dc351caSPhilippe Mathieu-Daudé        .name = "20Kc",
6420dc351caSPhilippe Mathieu-Daudé        /* We emulate a later version of the 20Kc, earlier ones had a broken
6430dc351caSPhilippe Mathieu-Daudé           WAIT instruction. */
6440dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x000182a0,
6450dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT) |
6460dc351caSPhilippe Mathieu-Daudé                    (MMU_TYPE_R4000 << CP0C0_MT) | (1 << CP0C0_VI),
6470dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (47 << CP0C1_MMU) |
6480dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
6490dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
6500dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
6510dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
6520dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
6530dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
6540dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
6550dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
6560dc351caSPhilippe Mathieu-Daudé        .CCRes = 1,
6570dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x36FBFFFF,
6580dc351caSPhilippe Mathieu-Daudé        /* The 20Kc has F64 / L / W but doesn't use the fcr0 bits. */
6590dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_3D) | (1 << FCR0_PS) |
6600dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_D) | (1 << FCR0_S) |
6610dc351caSPhilippe Mathieu-Daudé                    (0x82 << FCR0_PRID) | (0x0 << FCR0_REV),
6620dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
6630dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
6640dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 40,
6650dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
66609968fc9SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R1,
6670dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
6680dc351caSPhilippe Mathieu-Daudé    },
6690dc351caSPhilippe Mathieu-Daudé    {
6700dc351caSPhilippe Mathieu-Daudé        /* A generic CPU providing MIPS64 Release 2 features.
6710dc351caSPhilippe Mathieu-Daudé           FIXME: Eventually this should be replaced by a real CPU model. */
6720dc351caSPhilippe Mathieu-Daudé        .name = "MIPS64R2-generic",
6730dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00010000,
6740dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
6750dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
6760dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) |
6770dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
6780dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
6790dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
6800dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
6810dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_LPA),
6820dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
6830dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
6840dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
6850dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
6860dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x36FBFFFF,
6870dc351caSPhilippe Mathieu-Daudé        .CP0_EBaseWG_rw_bitmask = (1 << CP0EBase_WG),
6880dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_3D) | (1 << FCR0_PS) |
6890dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) |
6900dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_S) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV),
6910dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
6920dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
6930dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 42,
6940dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
69509968fc9SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R2,
6960dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
6970dc351caSPhilippe Mathieu-Daudé    },
6980dc351caSPhilippe Mathieu-Daudé    {
6990dc351caSPhilippe Mathieu-Daudé        .name = "5KEc",
7000dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018900,
7010dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
7020dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
7030dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (31 << CP0C1_MMU) |
7040dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) |
7050dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) |
7060dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
7070dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
7080dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
7090dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
7100dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
7110dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
7120dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
7130dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x12F8FFFF,
7140dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 42,
7150dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
7160dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R2,
7170dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
7180dc351caSPhilippe Mathieu-Daudé    },
7190dc351caSPhilippe Mathieu-Daudé    {
7200dc351caSPhilippe Mathieu-Daudé        .name = "5KEf",
7210dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00018900,
7220dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
7230dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
7240dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (31 << CP0C1_MMU) |
7250dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) |
7260dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) |
7270dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
7280dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
7290dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3,
7300dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
7310dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 4,
7320dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
7330dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
7340dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x36F8FFFF,
7350dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
7360dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_D) | (1 << FCR0_S) |
7370dc351caSPhilippe Mathieu-Daudé                    (0x89 << FCR0_PRID) | (0x0 << FCR0_REV),
7380dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 42,
7390dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
7400dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R2,
7410dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
7420dc351caSPhilippe Mathieu-Daudé    },
7430dc351caSPhilippe Mathieu-Daudé    {
7440dc351caSPhilippe Mathieu-Daudé        .name = "I6400",
7450dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x1A900,
7460dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AR) | (0x2 << CP0C0_AT) |
7470dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
7480dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) |
7490dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (5 << CP0C1_IL) | (3 << CP0C1_IA) |
7500dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (5 << CP0C1_DL) | (3 << CP0C1_DA) |
7510dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
7520dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
7530dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1U << CP0C3_M) |
7540dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_CMGCR) | (1 << CP0C3_MSAP) |
7550dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_BP) | (1 << CP0C3_BI) | (1 << CP0C3_ULRI) |
7560dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_RXI) | (1 << CP0C3_LPA) | (1 << CP0C3_VInt),
7570dc351caSPhilippe Mathieu-Daudé        .CP0_Config4 = MIPS_CONFIG4 | (1U << CP0C4_M) | (3 << CP0C4_IE) |
7580dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C4_AE) | (0xfc << CP0C4_KScrExist),
7590dc351caSPhilippe Mathieu-Daudé        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_XNP) | (1 << CP0C5_VP) |
760baf21eebSMarcin Nowakowski                       (1 << CP0C5_LLB) | (1 << CP0C5_MRP) | (3 << CP0C5_GI),
7610dc351caSPhilippe Mathieu-Daudé        .CP0_Config5_rw_bitmask = (1 << CP0C5_MSAEn) | (1 << CP0C5_SBRI) |
7620dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_FRE) | (1 << CP0C5_UFE),
7630dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
7640dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
7650dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
7660dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
7670dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x30D8FFFF,
7680dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain = (1 << CP0PG_IEC) | (1 << CP0PG_XIE) |
7690dc351caSPhilippe Mathieu-Daudé                         (1U << CP0PG_RIE),
7700dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = (1 << CP0PG_ELPA),
7710dc351caSPhilippe Mathieu-Daudé        .CP0_EBaseWG_rw_bitmask = (1 << CP0EBase_WG),
7720dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_HAS2008) | (1 << FCR0_F64) |
7730dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) |
7740dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_S) | (0x03 << FCR0_PRID) | (0x0 << FCR0_REV),
7750dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008),
7760dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0x0103FFFF,
7770dc351caSPhilippe Mathieu-Daudé        .MSAIR = 0x03 << MSAIR_ProcID,
7780dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 48,
7790dc351caSPhilippe Mathieu-Daudé        .PABITS = 48,
7807e2a619aSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R6,
7810dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
7820dc351caSPhilippe Mathieu-Daudé    },
7830dc351caSPhilippe Mathieu-Daudé    {
7840dc351caSPhilippe Mathieu-Daudé        .name = "I6500",
7850dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x1B000,
7860dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AR) | (0x2 << CP0C0_AT) |
7870dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
7880dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) |
7890dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (5 << CP0C1_IL) | (3 << CP0C1_IA) |
7900dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (5 << CP0C1_DL) | (3 << CP0C1_DA) |
7910dc351caSPhilippe Mathieu-Daudé                       (0 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
7920dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
7930dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1U << CP0C3_M) |
7940dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_CMGCR) | (1 << CP0C3_MSAP) |
7950dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_BP) | (1 << CP0C3_BI) | (1 << CP0C3_ULRI) |
7960dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_RXI) | (1 << CP0C3_LPA) | (1 << CP0C3_VInt),
7970dc351caSPhilippe Mathieu-Daudé        .CP0_Config4 = MIPS_CONFIG4 | (1U << CP0C4_M) | (3 << CP0C4_IE) |
7980dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C4_AE) | (0xfc << CP0C4_KScrExist),
7990dc351caSPhilippe Mathieu-Daudé        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_XNP) | (1 << CP0C5_VP) |
800baf21eebSMarcin Nowakowski                       (1 << CP0C5_LLB) | (1 << CP0C5_MRP) | (3 << CP0C5_GI),
8010dc351caSPhilippe Mathieu-Daudé        .CP0_Config5_rw_bitmask = (1 << CP0C5_MSAEn) | (1 << CP0C5_SBRI) |
8020dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_FRE) | (1 << CP0C5_UFE),
8030dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
8040dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
8050dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 64,
8060dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
8070dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x30D8FFFF,
8080dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain = (1 << CP0PG_IEC) | (1 << CP0PG_XIE) |
8090dc351caSPhilippe Mathieu-Daudé                         (1U << CP0PG_RIE),
8100dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = (1 << CP0PG_ELPA),
8110dc351caSPhilippe Mathieu-Daudé        .CP0_EBaseWG_rw_bitmask = (1 << CP0EBase_WG),
8120dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_HAS2008) | (1 << FCR0_F64) |
8130dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) |
8140dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_S) | (0x03 << FCR0_PRID) | (0x0 << FCR0_REV),
8150dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008),
8160dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0x0103FFFF,
8170dc351caSPhilippe Mathieu-Daudé        .MSAIR = 0x03 << MSAIR_ProcID,
8180dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 48,
8190dc351caSPhilippe Mathieu-Daudé        .PABITS = 48,
8207e2a619aSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R6,
8210dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
8220dc351caSPhilippe Mathieu-Daudé    },
8230dc351caSPhilippe Mathieu-Daudé    {
8240dc351caSPhilippe Mathieu-Daudé        .name = "Loongson-2E",
8250dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x6302,
8260dc351caSPhilippe Mathieu-Daudé        /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size.  */
8270dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = (3 << CP0C0_Impl) | (4 << CP0C0_IC) | (4 << CP0C0_DC) |
8280dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C0_IB) | (1 << CP0C0_DB) | (0x2 << CP0C0_K0),
8290dc351caSPhilippe Mathieu-Daudé        /* Note: Config1 is only used internally,
8300dc351caSPhilippe Mathieu-Daudé           Loongson-2E has only Config0.  */
8310dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU),
8320dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 16,
8330dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
8340dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x35D0FFFF,
8350dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV),
8360dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
8370dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
8380dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 40,
8390dc351caSPhilippe Mathieu-Daudé        .PABITS = 40,
840eaca8576SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS3 | INSN_LOONGSON2E,
8410dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
8420dc351caSPhilippe Mathieu-Daudé    },
8430dc351caSPhilippe Mathieu-Daudé    {
8440dc351caSPhilippe Mathieu-Daudé        .name = "Loongson-2F",
8450dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x6303,
8460dc351caSPhilippe Mathieu-Daudé        /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size.  */
8470dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = (3 << CP0C0_Impl) | (4 << CP0C0_IC) | (4 << CP0C0_DC) |
8480dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C0_IB) | (1 << CP0C0_DB) | (0x2 << CP0C0_K0),
8490dc351caSPhilippe Mathieu-Daudé        /* Note: Config1 is only used internally,
8500dc351caSPhilippe Mathieu-Daudé           Loongson-2F has only Config0.  */
8510dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU),
8520dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 16,
8530dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
8540dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0xF5D0FF1F,   /* Bits 7:5 not writable.  */
8550dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV),
8560dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
8570dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
8580dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 40,
8590dc351caSPhilippe Mathieu-Daudé        .PABITS = 40,
860eaca8576SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS3 | INSN_LOONGSON2F | ASE_LMMI,
8610dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
8620dc351caSPhilippe Mathieu-Daudé    },
8630dc351caSPhilippe Mathieu-Daudé    {
86498d207cfSPhilippe Mathieu-Daudé        .name = "Loongson-3A1000", /* Loongson-3A R1, GS464-based */
8650dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x6305,
8660dc351caSPhilippe Mathieu-Daudé        /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size.  */
8670dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
8680dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
8690dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) |
8700dc351caSPhilippe Mathieu-Daudé                       (3 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
8710dc351caSPhilippe Mathieu-Daudé                       (3 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
8720dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
8730dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2 | (7 << CP0C2_SS) | (4 << CP0C2_SL) |
8740dc351caSPhilippe Mathieu-Daudé                       (3 << CP0C2_SA),
8750dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_LPA),
8760dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
8770dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
8780dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
8790dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x74D8FFFF,
8800dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain = (1 << CP0PG_ELPA),
8810dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = (1 << CP0PG_ELPA),
8820dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV) | (0x1 << FCR0_F64) |
8830dc351caSPhilippe Mathieu-Daudé                    (0x1 << FCR0_PS) | (0x1 << FCR0_L) | (0x1 << FCR0_W) |
8840dc351caSPhilippe Mathieu-Daudé                    (0x1 << FCR0_D) | (0x1 << FCR0_S),
8850dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
8860dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
88771ed30b7SPhilippe Mathieu-Daudé        .SEGBITS = 48,
8880dc351caSPhilippe Mathieu-Daudé        .PABITS = 48,
889eaca8576SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R2 | INSN_LOONGSON3A |
890eaca8576SPhilippe Mathieu-Daudé                      ASE_LMMI | ASE_LEXT,
8910dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
8920dc351caSPhilippe Mathieu-Daudé    },
8930dc351caSPhilippe Mathieu-Daudé    {
89498d207cfSPhilippe Mathieu-Daudé        .name = "Loongson-3A4000", /* Loongson-3A R4, GS464V-based */
8950dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x14C000,
8960dc351caSPhilippe Mathieu-Daudé        /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size.  */
8970dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
8980dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
8990dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) |
9000dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (5 << CP0C1_IL) | (3 << CP0C1_IA) |
9010dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (5 << CP0C1_DL) | (3 << CP0C1_DA) |
9020dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
9030dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2 | (5 << CP0C2_SS) | (5 << CP0C2_SL) |
9040dc351caSPhilippe Mathieu-Daudé                       (15 << CP0C2_SA),
9050dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1U << CP0C3_M) | (1 << CP0C3_MSAP) |
9060dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_BP) | (1 << CP0C3_BI) | (1 << CP0C3_ULRI) |
9070dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_RXI) | (1 << CP0C3_LPA) | (1 << CP0C3_VInt),
9080dc351caSPhilippe Mathieu-Daudé        .CP0_Config4 = MIPS_CONFIG4 | (1U << CP0C4_M) | (2 << CP0C4_IE) |
9090dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C4_AE) | (0x1c << CP0C4_KScrExist),
9100dc351caSPhilippe Mathieu-Daudé        .CP0_Config4_rw_bitmask = 0,
9110dc351caSPhilippe Mathieu-Daudé        .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_CRCP) | (1 << CP0C5_NFExists),
9120dc351caSPhilippe Mathieu-Daudé        .CP0_Config5_rw_bitmask = (1 << CP0C5_K) | (1 << CP0C5_CV) |
9130dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_MSAEn) | (1 << CP0C5_UFE) |
9140dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C5_FRE) | (1 << CP0C5_SBRI),
9150dc351caSPhilippe Mathieu-Daudé        .CP0_Config6 = (1 << CP0C6_VCLRU) | (1 << CP0C6_DCLRU) |
9160dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_SFBEN) | (1 << CP0C6_VLTINT) |
9170dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_INSTPREF) | (1 << CP0C6_DATAPREF),
9180dc351caSPhilippe Mathieu-Daudé        .CP0_Config6_rw_bitmask = (1 << CP0C6_BPPASS) | (0x3f << CP0C6_KPOS) |
9190dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_KE) | (1 << CP0C6_VTLBONLY) |
9200dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_LASX) | (1 << CP0C6_SSEN) |
9210dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_DISDRTIME) | (1 << CP0C6_PIXNUEN) |
9220dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_SCRAND) | (1 << CP0C6_LLEXCEN) |
9230dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_DISVC) | (1 << CP0C6_VCLRU) |
9240dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_DCLRU) | (1 << CP0C6_PIXUEN) |
9250dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_DISBLKLYEN) | (1 << CP0C6_UMEMUALEN) |
9260dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_SFBEN) | (1 << CP0C6_FLTINT) |
9270dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_VLTINT) | (1 << CP0C6_DISBTB) |
9280dc351caSPhilippe Mathieu-Daudé                       (3 << CP0C6_STPREFCTL) | (1 << CP0C6_INSTPREF) |
9290dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C6_DATAPREF),
9300dc351caSPhilippe Mathieu-Daudé        .CP0_Config7 = 0,
9310dc351caSPhilippe Mathieu-Daudé        .CP0_Config7_rw_bitmask = (1 << CP0C7_NAPCGEN) | (1 << CP0C7_UNIMUEN) |
9320dc351caSPhilippe Mathieu-Daudé                                  (1 << CP0C7_VFPUCGEN),
9330dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 1,
9340dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 16,
9350dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
9360dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x7DDBFFFF,
9370dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain = (1 << CP0PG_ELPA),
9380dc351caSPhilippe Mathieu-Daudé        .CP0_PageGrain_rw_bitmask = (1U << CP0PG_RIE) | (1 << CP0PG_XIE) |
9390dc351caSPhilippe Mathieu-Daudé                    (1 << CP0PG_ELPA) | (1 << CP0PG_IEC),
9400dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV) | (0x1 << FCR0_F64) |
9410dc351caSPhilippe Mathieu-Daudé                    (0x1 << FCR0_PS) | (0x1 << FCR0_L) | (0x1 << FCR0_W) |
9420dc351caSPhilippe Mathieu-Daudé                    (0x1 << FCR0_D) | (0x1 << FCR0_S),
9430dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
9440dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
945ba7b6f02SPhilippe Mathieu-Daudé        .MSAIR = (0x01 << MSAIR_ProcID) | (0x40 << MSAIR_Rev),
94603afdc28SJiaxun Yang        .lcsr_cpucfg1 = (1 << CPUCFG1_FP) | (2 << CPUCFG1_FPREV) |
94703afdc28SJiaxun Yang                    (1 << CPUCFG1_MSA1) | (1 << CPUCFG1_LSLDR0) |
94803afdc28SJiaxun Yang                    (1 << CPUCFG1_LSPERF) | (1 << CPUCFG1_LSPERFX) |
94903afdc28SJiaxun Yang                    (1 << CPUCFG1_LSSYNCI) | (1 << CPUCFG1_LLEXC) |
95003afdc28SJiaxun Yang                    (1 << CPUCFG1_SCRAND) | (1 << CPUCFG1_MUALP) |
95103afdc28SJiaxun Yang                    (1 << CPUCFG1_KMUALEN) | (1 << CPUCFG1_ITLBT) |
95203afdc28SJiaxun Yang                    (1 << CPUCFG1_SFBP) | (1 << CPUCFG1_CDMAP),
95303afdc28SJiaxun Yang        .lcsr_cpucfg2 = (1 << CPUCFG2_LEXT1) | (1 << CPUCFG2_LCSRP) |
95403afdc28SJiaxun Yang                    (1 << CPUCFG2_LDISBLIKELY),
9550dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 48,
9560dc351caSPhilippe Mathieu-Daudé        .PABITS = 48,
957eaca8576SPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R2 | INSN_LOONGSON3A |
958eaca8576SPhilippe Mathieu-Daudé                      ASE_LMMI | ASE_LEXT,
9590dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
9600dc351caSPhilippe Mathieu-Daudé    },
9610dc351caSPhilippe Mathieu-Daudé    {
9620dc351caSPhilippe Mathieu-Daudé        /* A generic CPU providing MIPS64 DSP R2 ASE features.
9630dc351caSPhilippe Mathieu-Daudé           FIXME: Eventually this should be replaced by a real CPU model. */
9640dc351caSPhilippe Mathieu-Daudé        .name = "mips64dspr2",
9650dc351caSPhilippe Mathieu-Daudé        .CP0_PRid = 0x00010000,
9660dc351caSPhilippe Mathieu-Daudé        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
9670dc351caSPhilippe Mathieu-Daudé                       (MMU_TYPE_R4000 << CP0C0_MT),
9680dc351caSPhilippe Mathieu-Daudé        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) |
9690dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
9700dc351caSPhilippe Mathieu-Daudé                       (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
9710dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
9720dc351caSPhilippe Mathieu-Daudé        .CP0_Config2 = MIPS_CONFIG2,
9730dc351caSPhilippe Mathieu-Daudé        .CP0_Config3 = MIPS_CONFIG3 | (1U << CP0C3_M) | (1 << CP0C3_DSP2P) |
9740dc351caSPhilippe Mathieu-Daudé                       (1 << CP0C3_DSPP) | (1 << CP0C3_LPA),
9750dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_rw_bitmask = 0,
9760dc351caSPhilippe Mathieu-Daudé        .CP0_LLAddr_shift = 0,
9770dc351caSPhilippe Mathieu-Daudé        .SYNCI_Step = 32,
9780dc351caSPhilippe Mathieu-Daudé        .CCRes = 2,
9790dc351caSPhilippe Mathieu-Daudé        .CP0_Status_rw_bitmask = 0x37FBFFFF,
9800dc351caSPhilippe Mathieu-Daudé        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_3D) | (1 << FCR0_PS) |
9810dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_L) | (1 << FCR0_W) | (1 << FCR0_D) |
9820dc351caSPhilippe Mathieu-Daudé                    (1 << FCR0_S) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV),
9830dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31 = 0,
9840dc351caSPhilippe Mathieu-Daudé        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
9850dc351caSPhilippe Mathieu-Daudé        .SEGBITS = 42,
9860dc351caSPhilippe Mathieu-Daudé        .PABITS = 36,
9870dc351caSPhilippe Mathieu-Daudé        .insn_flags = CPU_MIPS64R2 | ASE_DSP | ASE_DSP_R2,
9880dc351caSPhilippe Mathieu-Daudé        .mmu_type = MMU_TYPE_R4000,
9890dc351caSPhilippe Mathieu-Daudé    },
9909a6046a6SPavel Dovgalyuk    {
9919a6046a6SPavel Dovgalyuk        /*
9929a6046a6SPavel Dovgalyuk         * Octeon 68xx with MIPS64 Cavium Octeon features.
9939a6046a6SPavel Dovgalyuk         */
9949a6046a6SPavel Dovgalyuk        .name = "Octeon68XX",
9959a6046a6SPavel Dovgalyuk        .CP0_PRid = 0x000D9100,
9969a6046a6SPavel Dovgalyuk        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
9979a6046a6SPavel Dovgalyuk                       (MMU_TYPE_R4000 << CP0C0_MT),
9989a6046a6SPavel Dovgalyuk        .CP0_Config1 = MIPS_CONFIG1 | (0x3F << CP0C1_MMU) |
9999a6046a6SPavel Dovgalyuk                       (1 << CP0C1_IS) | (4 << CP0C1_IL) | (1 << CP0C1_IA) |
10009a6046a6SPavel Dovgalyuk                       (1 << CP0C1_DS) | (4 << CP0C1_DL) | (1 << CP0C1_DA) |
10019a6046a6SPavel Dovgalyuk                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
10029a6046a6SPavel Dovgalyuk        .CP0_Config2 = MIPS_CONFIG2,
10034bfc8953SJiaxun Yang        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_LPA),
10049a6046a6SPavel Dovgalyuk        .CP0_Config4 = MIPS_CONFIG4 | (1U << CP0C4_M) |
10059a6046a6SPavel Dovgalyuk                       (0x3c << CP0C4_KScrExist) | (1U << CP0C4_MMUExtDef) |
10069a6046a6SPavel Dovgalyuk                       (3U << CP0C4_MMUSizeExt),
10079a6046a6SPavel Dovgalyuk        .CP0_LLAddr_rw_bitmask = 0,
10089a6046a6SPavel Dovgalyuk        .CP0_LLAddr_shift = 4,
10099a6046a6SPavel Dovgalyuk        .CP0_PageGrain = (1 << CP0PG_ELPA),
10109a6046a6SPavel Dovgalyuk        .SYNCI_Step = 32,
10119a6046a6SPavel Dovgalyuk        .CCRes = 2,
10129a6046a6SPavel Dovgalyuk        .CP0_Status_rw_bitmask = 0x12F8FFFF,
10139a6046a6SPavel Dovgalyuk        .SEGBITS = 42,
10149a6046a6SPavel Dovgalyuk        .PABITS = 49,
10154bfc8953SJiaxun Yang        .insn_flags = CPU_MIPS64R2 | INSN_OCTEON,
10169a6046a6SPavel Dovgalyuk        .mmu_type = MMU_TYPE_R4000,
10179a6046a6SPavel Dovgalyuk    },
10180dc351caSPhilippe Mathieu-Daudé
10190dc351caSPhilippe Mathieu-Daudé#endif
10200dc351caSPhilippe Mathieu-Daudé};
10210dc351caSPhilippe Mathieu-Daudéconst int mips_defs_number = ARRAY_SIZE(mips_defs);
10220dc351caSPhilippe Mathieu-Daudé
10230dc351caSPhilippe Mathieu-Daudéstatic void fpu_init (CPUMIPSState *env, const mips_def_t *def)
10240dc351caSPhilippe Mathieu-Daudé{
10250dc351caSPhilippe Mathieu-Daudé    int i;
10260dc351caSPhilippe Mathieu-Daudé
10270dc351caSPhilippe Mathieu-Daudé    for (i = 0; i < MIPS_FPU_MAX; i++)
10280dc351caSPhilippe Mathieu-Daudé        env->fpus[i].fcr0 = def->CP1_fcr0;
10290dc351caSPhilippe Mathieu-Daudé
10300dc351caSPhilippe Mathieu-Daudé    memcpy(&env->active_fpu, &env->fpus[0], sizeof(env->active_fpu));
10310dc351caSPhilippe Mathieu-Daudé}
10320dc351caSPhilippe Mathieu-Daudé
10330dc351caSPhilippe Mathieu-Daudéstatic void mvp_init(CPUMIPSState *env)
10340dc351caSPhilippe Mathieu-Daudé{
10350dc351caSPhilippe Mathieu-Daudé    env->mvp = g_malloc0(sizeof(CPUMIPSMVPContext));
10360dc351caSPhilippe Mathieu-Daudé
10370dc351caSPhilippe Mathieu-Daudé    if (!ase_mt_available(env)) {
10380dc351caSPhilippe Mathieu-Daudé        return;
10390dc351caSPhilippe Mathieu-Daudé    }
10400dc351caSPhilippe Mathieu-Daudé
1041d5c9fa47SMichael Tokarev    /* MVPConf1 implemented, TLB shareable, no gating storage support,
10420dc351caSPhilippe Mathieu-Daudé       programmable cache partitioning implemented, number of allocatable
10430dc351caSPhilippe Mathieu-Daudé       and shareable TLB entries, MVP has allocatable TCs, 2 VPEs
10440dc351caSPhilippe Mathieu-Daudé       implemented, 5 TCs implemented. */
10450dc351caSPhilippe Mathieu-Daudé    env->mvp->CP0_MVPConf0 = (1U << CP0MVPC0_M) | (1 << CP0MVPC0_TLBS) |
10460dc351caSPhilippe Mathieu-Daudé                             (0 << CP0MVPC0_GS) | (1 << CP0MVPC0_PCP) |
10470dc351caSPhilippe Mathieu-Daudé// TODO: actually do 2 VPEs.
10480dc351caSPhilippe Mathieu-Daudé//                             (1 << CP0MVPC0_TCA) | (0x1 << CP0MVPC0_PVPE) |
10490dc351caSPhilippe Mathieu-Daudé//                             (0x04 << CP0MVPC0_PTC);
10500dc351caSPhilippe Mathieu-Daudé                             (1 << CP0MVPC0_TCA) | (0x0 << CP0MVPC0_PVPE) |
10510dc351caSPhilippe Mathieu-Daudé                             (0x00 << CP0MVPC0_PTC);
10520dc351caSPhilippe Mathieu-Daudé#if !defined(CONFIG_USER_ONLY)
10530dc351caSPhilippe Mathieu-Daudé    /* Usermode has no TLB support */
10540dc351caSPhilippe Mathieu-Daudé    env->mvp->CP0_MVPConf0 |= (env->tlb->nb_tlb << CP0MVPC0_PTLBE);
10550dc351caSPhilippe Mathieu-Daudé#endif
10560dc351caSPhilippe Mathieu-Daudé
10570dc351caSPhilippe Mathieu-Daudé    /* Allocatable CP1 have media extensions, allocatable CP1 have FP support,
10580dc351caSPhilippe Mathieu-Daudé       no UDI implemented, no CP2 implemented, 1 CP1 implemented. */
10590dc351caSPhilippe Mathieu-Daudé    env->mvp->CP0_MVPConf1 = (1U << CP0MVPC1_CIM) | (1 << CP0MVPC1_CIF) |
10600dc351caSPhilippe Mathieu-Daudé                             (0x0 << CP0MVPC1_PCX) | (0x0 << CP0MVPC1_PCP2) |
10610dc351caSPhilippe Mathieu-Daudé                             (0x1 << CP0MVPC1_PCP1);
10620dc351caSPhilippe Mathieu-Daudé}
1063