root / target-mips / translate_init.c @ 50d3eeae
History | View | Annotate | Download (2.7 kB)
1 | 33d68b5f | ths | /*
|
---|---|---|---|
2 | 33d68b5f | ths | * MIPS emulation for qemu: CPU initialisation routines.
|
3 | 33d68b5f | ths | *
|
4 | 33d68b5f | ths | * Copyright (c) 2004-2005 Jocelyn Mayer
|
5 | 33d68b5f | ths | * Copyright (c) 2007 Herve Poussineau
|
6 | 33d68b5f | ths | *
|
7 | 33d68b5f | ths | * This library is free software; you can redistribute it and/or
|
8 | 33d68b5f | ths | * modify it under the terms of the GNU Lesser General Public
|
9 | 33d68b5f | ths | * License as published by the Free Software Foundation; either
|
10 | 33d68b5f | ths | * version 2 of the License, or (at your option) any later version.
|
11 | 33d68b5f | ths | *
|
12 | 33d68b5f | ths | * This library is distributed in the hope that it will be useful,
|
13 | 33d68b5f | ths | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | 33d68b5f | ths | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 | 33d68b5f | ths | * Lesser General Public License for more details.
|
16 | 33d68b5f | ths | *
|
17 | 33d68b5f | ths | * You should have received a copy of the GNU Lesser General Public
|
18 | 33d68b5f | ths | * License along with this library; if not, write to the Free Software
|
19 | 33d68b5f | ths | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 | 33d68b5f | ths | */
|
21 | 33d68b5f | ths | |
22 | 33d68b5f | ths | struct mips_def_t {
|
23 | 33d68b5f | ths | const unsigned char *name; |
24 | 33d68b5f | ths | int32_t CP0_PRid; |
25 | 33d68b5f | ths | int32_t CP0_Config0; |
26 | 33d68b5f | ths | int32_t CP0_Config1; |
27 | 33d68b5f | ths | }; |
28 | 33d68b5f | ths | |
29 | 33d68b5f | ths | /*****************************************************************************/
|
30 | 33d68b5f | ths | /* MIPS CPU definitions */
|
31 | 33d68b5f | ths | static mips_def_t mips_defs[] =
|
32 | 33d68b5f | ths | { |
33 | 33d68b5f | ths | #ifndef MIPS_HAS_MIPS64
|
34 | 33d68b5f | ths | { |
35 | 33d68b5f | ths | .name = "4Kc",
|
36 | 33d68b5f | ths | .CP0_PRid = 0x00018000,
|
37 | 33d68b5f | ths | .CP0_Config0 = MIPS_CONFIG0, |
38 | 33d68b5f | ths | .CP0_Config1 = MIPS_CONFIG1, |
39 | 33d68b5f | ths | }, |
40 | 33d68b5f | ths | { |
41 | 33d68b5f | ths | .name = "4KEc",
|
42 | 33d68b5f | ths | .CP0_PRid = 0x00018400,
|
43 | 33d68b5f | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR),
|
44 | 33d68b5f | ths | .CP0_Config1 = MIPS_CONFIG1, |
45 | 33d68b5f | ths | }, |
46 | 33d68b5f | ths | { |
47 | 33d68b5f | ths | .name = "24Kf",
|
48 | 33d68b5f | ths | .CP0_PRid = 0x00019300,
|
49 | 33d68b5f | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR),
|
50 | 33d68b5f | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP),
|
51 | 33d68b5f | ths | }, |
52 | 33d68b5f | ths | #else
|
53 | 33d68b5f | ths | { |
54 | 33d68b5f | ths | .name = "R4000",
|
55 | 33d68b5f | ths | .CP0_PRid = 0x00000400,
|
56 | 33d68b5f | ths | .CP0_Config0 = MIPS_CONFIG0 | (0x2 << CP0C0_AT),
|
57 | 33d68b5f | ths | .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP),
|
58 | 33d68b5f | ths | }, |
59 | 33d68b5f | ths | #endif
|
60 | 33d68b5f | ths | }; |
61 | 33d68b5f | ths | |
62 | 33d68b5f | ths | int mips_find_by_name (const unsigned char *name, mips_def_t **def) |
63 | 33d68b5f | ths | { |
64 | 33d68b5f | ths | int i, ret;
|
65 | 33d68b5f | ths | |
66 | 33d68b5f | ths | ret = -1;
|
67 | 33d68b5f | ths | *def = NULL;
|
68 | 33d68b5f | ths | for (i = 0; i < sizeof(mips_defs) / sizeof(mips_defs[0]); i++) { |
69 | 33d68b5f | ths | if (strcasecmp(name, mips_defs[i].name) == 0) { |
70 | 33d68b5f | ths | *def = &mips_defs[i]; |
71 | 33d68b5f | ths | ret = 0;
|
72 | 33d68b5f | ths | break;
|
73 | 33d68b5f | ths | } |
74 | 33d68b5f | ths | } |
75 | 33d68b5f | ths | |
76 | 33d68b5f | ths | return ret;
|
77 | 33d68b5f | ths | } |
78 | 33d68b5f | ths | |
79 | 33d68b5f | ths | void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) |
80 | 33d68b5f | ths | { |
81 | 33d68b5f | ths | int i;
|
82 | 33d68b5f | ths | |
83 | 33d68b5f | ths | for (i = 0; i < sizeof(mips_defs) / sizeof(mips_defs[0]); i++) { |
84 | 33d68b5f | ths | (*cpu_fprintf)(f, "MIPS '%s'\n",
|
85 | 33d68b5f | ths | mips_defs[i].name); |
86 | 33d68b5f | ths | } |
87 | 33d68b5f | ths | } |
88 | 33d68b5f | ths | |
89 | 33d68b5f | ths | int cpu_mips_register (CPUMIPSState *env, mips_def_t *def)
|
90 | 33d68b5f | ths | { |
91 | 33d68b5f | ths | if (!def)
|
92 | 33d68b5f | ths | cpu_abort(env, "Unable to find MIPS CPU definition\n");
|
93 | 33d68b5f | ths | env->CP0_PRid = def->CP0_PRid; |
94 | 33d68b5f | ths | env->CP0_Config0 = def->CP0_Config0; |
95 | 33d68b5f | ths | env->CP0_Config1 = def->CP0_Config1; |
96 | 33d68b5f | ths | return 0; |
97 | 33d68b5f | ths | } |