Add MIPS32R2 instructions, and generally straighten out the instruction
[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 #define MIPS_R4Kc 0x00018000
10 #define MIPS_R4Kp 0x00018300
11
12 /* Emulate MIPS R4Kc for now */
13 #define MIPS_CPU MIPS_R4Kc
14
15 #if (MIPS_CPU == MIPS_R4Kc)
16 /* 32 bits target */
17 #define TARGET_LONG_BITS 32
18 /* real pages are variable size... */
19 #define TARGET_PAGE_BITS 12
20 /* Uses MIPS R4Kx enhancements to MIPS32 architecture */
21 #define MIPS_USES_R4K_EXT
22 /* Uses MIPS R4Kc TLB model */
23 #define MIPS_USES_R4K_TLB
24 #define MIPS_TLB_NB 16
25 #define MIPS_TLB_MAX 128
26 /* basic FPU register support */
27 #define MIPS_USES_FPU 1
28 /* Define a implementation number of 1.
29  * Define a major version 1, minor version 0.
30  */
31 #define MIPS_FCR0 ((0 << 16) | (1 << 8) | (1 << 4) | 0)
32   /* Have config1, is MIPS32R1, uses TLB, no virtual icache,
33      uncached coherency */
34 #define MIPS_CONFIG0_1                                            \
35   ((1 << CP0C0_M) | (0x0 << CP0C0_K23) | (0x0 << CP0C0_KU) |      \
36    (0x0 << CP0C0_AT) | (0x0 << CP0C0_AR) | (0x1 << CP0C0_MT) |    \
37    (0x2 << CP0C0_K0))
38 #ifdef TARGET_WORDS_BIGENDIAN
39 #define MIPS_CONFIG0 (MIPS_CONFIG0_1 | (1 << CP0C0_BE))
40 #else
41 #define MIPS_CONFIG0 MIPS_CONFIG0_1
42 #endif
43 /* Have config2, 16 TLB entries, 64 sets Icache, 16 bytes Icache line,
44    2-way Icache, 64 sets Dcache, 16 bytes Dcache line, 2-way Dcache,
45    no coprocessor2 attached, no MDMX support attached,
46    no performance counters, watch registers present,
47    no code compression, EJTAG present, FPU enable bit depending on
48    MIPS_USES_FPU */
49 #define MIPS_CONFIG1_1                                            \
50 ((1 << CP0C1_M) | ((MIPS_TLB_NB - 1) << CP0C1_MMU) |              \
51  (0x0 << CP0C1_IS) | (0x3 << CP0C1_IL) | (0x1 << CP0C1_IA) |      \
52  (0x0 << CP0C1_DS) | (0x3 << CP0C1_DL) | (0x1 << CP0C1_DA) |      \
53  (0 << CP0C1_C2) | (0 << CP0C1_MD) | (0 << CP0C1_PC) |            \
54  (1 << CP0C1_WR) | (0 << CP0C1_CA) | (1 << CP0C1_EP))
55 #ifdef MIPS_USES_FPU
56 #define MIPS_CONFIG1  (MIPS_CONFIG1_1 | (1 << CP0C1_FP))
57 #else
58 #define MIPS_CONFIG1  (MIPS_CONFIG1_1 | (0 << CP0C1_FP))
59 #endif
60 /* Have config3, no tertiary/secondary caches implemented */
61 #define MIPS_CONFIG2                                              \
62 ((1 << CP0C2_M))
63 /* No config4, no DSP ASE, no large physaddr,
64    no external interrupt controller, no vectored interupts,
65    no 1kb pages, no MT ASE, no SmartMIPS ASE, no trace logic */
66 #define MIPS_CONFIG3                                              \
67 ((0 << CP0C3_M) | (0 << CP0C3_DSPP) | (0 << CP0C3_LPA) |          \
68  (0 << CP0C3_VEIC) | (0 << CP0C3_VInt) | (0 << CP0C3_SP) |        \
69  (0 << CP0C3_MT) | (0 << CP0C3_SM) | (0 << CP0C3_TL))
70 #elif (MIPS_CPU == MIPS_R4Kp)
71 /* 32 bits target */
72 #define TARGET_LONG_BITS 32
73 /* real pages are variable size... */
74 #define TARGET_PAGE_BITS 12
75 /* Uses MIPS R4Kx enhancements to MIPS32 architecture */
76 #define MIPS_USES_R4K_EXT
77 /* Uses MIPS R4Km FPM MMU model */
78 #define MIPS_USES_R4K_FPM
79 #else
80 #error "MIPS CPU not defined"
81 /* Reminder for other flags */
82 //#define TARGET_MIPS64
83 //#define MIPS_USES_FPU
84 #endif
85
86 #endif /* !defined (__QEMU_MIPS_DEFS_H__) */