MIPS -cpu selection support, by Herve Poussineau.
[qemu] / target-mips / mips-defs.h
1 #if !defined (__QEMU_MIPS_DEFS_H__)
2 #define __QEMU_MIPS_DEFS_H__
3
4 /* If we want to use 64 bits host regs... */
5 //#define USE_64BITS_REGS
6 /* If we want to use host float regs... */
7 //#define USE_HOST_FLOAT_REGS
8
9 /* 32 bits target */
10 #undef MIPS_HAS_MIPS64
11 //#define MIPS_HAS_MIPS64 1
12 /* real pages are variable size... */
13 #define TARGET_PAGE_BITS 12
14 /* Uses MIPS R4Kc TLB model */
15 #define MIPS_USES_R4K_TLB
16 #define MIPS_TLB_NB 16
17 #define MIPS_TLB_MAX 128
18 /* Define a implementation number of 1.
19  * Define a major version 1, minor version 0.
20  */
21 #define MIPS_FCR0 ((0 << 16) | (1 << 8) | (1 << 4) | 0)
22   /* Have config1, is MIPS32R1, uses TLB, no virtual icache,
23      uncached coherency */
24 #define MIPS_CONFIG0_1                                            \
25   ((1 << CP0C0_M) | (0x0 << CP0C0_K23) | (0x0 << CP0C0_KU) |      \
26    (0x0 << CP0C0_AT) | (0x0 << CP0C0_AR) | (0x1 << CP0C0_MT) |    \
27    (0x2 << CP0C0_K0))
28 #ifdef TARGET_WORDS_BIGENDIAN
29 #define MIPS_CONFIG0 (MIPS_CONFIG0_1 | (1 << CP0C0_BE))
30 #else
31 #define MIPS_CONFIG0 MIPS_CONFIG0_1
32 #endif
33 /* Have config2, 16 TLB entries, 64 sets Icache, 16 bytes Icache line,
34    2-way Icache, 64 sets Dcache, 16 bytes Dcache line, 2-way Dcache,
35    no coprocessor2 attached, no MDMX support attached,
36    no performance counters, watch registers present,
37    no code compression, EJTAG present, no FPU */
38 #define MIPS_CONFIG1                                              \
39 ((1 << CP0C1_M) | ((MIPS_TLB_NB - 1) << CP0C1_MMU) |              \
40  (0x0 << CP0C1_IS) | (0x3 << CP0C1_IL) | (0x1 << CP0C1_IA) |      \
41  (0x0 << CP0C1_DS) | (0x3 << CP0C1_DL) | (0x1 << CP0C1_DA) |      \
42  (0 << CP0C1_C2) | (0 << CP0C1_MD) | (0 << CP0C1_PC) |            \
43  (1 << CP0C1_WR) | (0 << CP0C1_CA) | (1 << CP0C1_EP) |            \
44  (0 << CP0C1_FP))
45 /* Have config3, no tertiary/secondary caches implemented */
46 #define MIPS_CONFIG2                                              \
47 ((1 << CP0C2_M))
48 /* No config4, no DSP ASE, no large physaddr,
49    no external interrupt controller, no vectored interupts,
50    no 1kb pages, no MT ASE, no SmartMIPS ASE, no trace logic */
51 #define MIPS_CONFIG3                                              \
52 ((0 << CP0C3_M) | (0 << CP0C3_DSPP) | (0 << CP0C3_LPA) |          \
53  (0 << CP0C3_VEIC) | (0 << CP0C3_VInt) | (0 << CP0C3_SP) |        \
54  (0 << CP0C3_MT) | (0 << CP0C3_SM) | (0 << CP0C3_TL))
55
56 #ifdef MIPS_HAS_MIPS64
57 #define TARGET_LONG_BITS 64
58 #else
59 #define TARGET_LONG_BITS 32
60 #endif
61
62 #endif /* !defined (__QEMU_MIPS_DEFS_H__) */