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, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 const unsigned char *name;
29 /*****************************************************************************/
30 /* MIPS CPU definitions */
31 static mips_def_t mips_defs[] =
33 #ifndef MIPS_HAS_MIPS64
36 .CP0_PRid = 0x00018000,
37 .CP0_Config0 = MIPS_CONFIG0,
38 .CP0_Config1 = MIPS_CONFIG1,
42 .CP0_PRid = 0x00018400,
43 .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR),
44 .CP0_Config1 = MIPS_CONFIG1,
48 .CP0_PRid = 0x00019300,
49 .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR),
50 .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP),
55 .CP0_PRid = 0x00000400,
56 .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT),
57 .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP),
62 int mips_find_by_name (const unsigned char *name, mips_def_t **def)
68 for (i = 0; i < sizeof(mips_defs) / sizeof(mips_defs[0]); i++) {
69 if (strcasecmp(name, mips_defs[i].name) == 0) {
79 void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
83 for (i = 0; i < sizeof(mips_defs) / sizeof(mips_defs[0]); i++) {
84 (*cpu_fprintf)(f, "MIPS '%s'\n",
89 int cpu_mips_register (CPUMIPSState *env, mips_def_t *def)
92 cpu_abort(env, "Unable to find MIPS CPU definition\n");
93 env->CP0_PRid = def->CP0_PRid;
94 env->CP0_Config0 = def->CP0_Config0;
95 env->CP0_Config1 = def->CP0_Config1;