MIPS TLB performance improvements, by Daniel Jacobowitz.
[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, uses TLB */
33 #define MIPS_CONFIG0_1                                          \
34 ((1 << CP0C0_M) | (0 << CP0C0_K23) | (0 << CP0C0_KU) |          \
35  (1 << CP0C0_MT) | (2 << CP0C0_K0))
36 #ifdef TARGET_WORDS_BIGENDIAN
37 #define MIPS_CONFIG0 (MIPS_CONFIG0_1 | (1 << CP0C0_BE))
38 #else
39 #define MIPS_CONFIG0 MIPS_CONFIG0_1
40 #endif
41 /* 16 TLBs, 64 sets Icache, 16 bytes Icache line, 2-way Icache,
42  * 64 sets Dcache, 16 bytes Dcache line, 2-way Dcache,
43  * no performance counters, watch registers present, no code compression,
44  * EJTAG present, FPU enable bit depending on MIPS_USES_FPU
45  */
46 #define MIPS_CONFIG1                                            \
47 ((15 << CP0C1_MMU) |                                            \
48  (0x000 << CP0C1_IS) | (0x3 << CP0C1_IL) | (0x01 << CP0C1_IA) | \
49  (0x000 << CP0C1_DS) | (0x3 << CP0C1_DL) | (0x01 << CP0C1_DA) | \
50  (0 << CP0C1_PC) | (1 << CP0C1_WR) | (0 << CP0C1_CA) |          \
51  (1 << CP0C1_EP) | (MIPS_USES_FPU << CP0C1_FP))
52 #elif (MIPS_CPU == MIPS_R4Kp)
53 /* 32 bits target */
54 #define TARGET_LONG_BITS 32
55 /* real pages are variable size... */
56 #define TARGET_PAGE_BITS 12
57 /* Uses MIPS R4Kx enhancements to MIPS32 architecture */
58 #define MIPS_USES_R4K_EXT
59 /* Uses MIPS R4Km FPM MMU model */
60 #define MIPS_USES_R4K_FPM
61 #else
62 #error "MIPS CPU not defined"
63 /* Remainder for other flags */
64 //#define TARGET_MIPS64
65 //#define MIPS_USES_FPU
66 #endif
67
68 #endif /* !defined (__QEMU_MIPS_DEFS_H__) */