]>
Commit | Line | Data |
---|---|---|
6af0bf9c FB |
1 | #if !defined(__QEMU_MIPS_EXEC_H__) |
2 | #define __QEMU_MIPS_EXEC_H__ | |
3 | ||
01dbbdf1 | 4 | //#define DEBUG_OP |
6af0bf9c | 5 | |
c570fd16 | 6 | #include "config.h" |
6af0bf9c FB |
7 | #include "mips-defs.h" |
8 | #include "dyngen-exec.h" | |
01179c38 | 9 | #include "cpu-defs.h" |
6af0bf9c FB |
10 | |
11 | register struct CPUMIPSState *env asm(AREG0); | |
12 | ||
6af0bf9c FB |
13 | #include "cpu.h" |
14 | #include "exec-all.h" | |
15 | ||
16 | #if !defined(CONFIG_USER_ONLY) | |
a9049a07 | 17 | #include "softmmu_exec.h" |
6af0bf9c FB |
18 | #endif /* !defined(CONFIG_USER_ONLY) */ |
19 | ||
6ea83fed | 20 | void dump_fpu(CPUState *env); |
5fafdf24 | 21 | void fpu_dump_state(CPUState *env, FILE *f, |
6ea83fed FB |
22 | int (*fpu_fprintf)(FILE *f, const char *fmt, ...), |
23 | int flags); | |
6af0bf9c | 24 | |
6af0bf9c | 25 | void cpu_mips_clock_init (CPUState *env); |
814b9a47 | 26 | void cpu_mips_tlb_flush (CPUState *env, int flush_global); |
6af0bf9c | 27 | |
6a4955a8 AL |
28 | static inline int cpu_has_work(CPUState *env) |
29 | { | |
30 | return (env->interrupt_request & | |
31 | (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)); | |
32 | } | |
33 | ||
34 | ||
c904ef0e | 35 | static inline int cpu_halted(CPUState *env) |
08fa4bab | 36 | { |
bfed01fc TS |
37 | if (!env->halted) |
38 | return 0; | |
6a4955a8 | 39 | if (cpu_has_work(env)) { |
bfed01fc TS |
40 | env->halted = 0; |
41 | return 0; | |
42 | } | |
43 | return EXCP_HALTED; | |
44 | } | |
45 | ||
c904ef0e | 46 | static inline void compute_hflags(CPUState *env) |
08fa4bab | 47 | { |
b8aa4598 | 48 | env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | |
2623c1ec AJ |
49 | MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | |
50 | MIPS_HFLAG_UX); | |
08fa4bab TS |
51 | if (!(env->CP0_Status & (1 << CP0St_EXL)) && |
52 | !(env->CP0_Status & (1 << CP0St_ERL)) && | |
671880e6 | 53 | !(env->hflags & MIPS_HFLAG_DM)) { |
623a930e | 54 | env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; |
671880e6 | 55 | } |
d26bc211 | 56 | #if defined(TARGET_MIPS64) |
623a930e | 57 | if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) || |
08fa4bab TS |
58 | (env->CP0_Status & (1 << CP0St_PX)) || |
59 | (env->CP0_Status & (1 << CP0St_UX))) | |
60 | env->hflags |= MIPS_HFLAG_64; | |
2623c1ec AJ |
61 | if (env->CP0_Status & (1 << CP0St_UX)) |
62 | env->hflags |= MIPS_HFLAG_UX; | |
08fa4bab | 63 | #endif |
671880e6 | 64 | if ((env->CP0_Status & (1 << CP0St_CU0)) || |
623a930e | 65 | !(env->hflags & MIPS_HFLAG_KSU)) |
08fa4bab TS |
66 | env->hflags |= MIPS_HFLAG_CP0; |
67 | if (env->CP0_Status & (1 << CP0St_CU1)) | |
68 | env->hflags |= MIPS_HFLAG_FPU; | |
69 | if (env->CP0_Status & (1 << CP0St_FR)) | |
70 | env->hflags |= MIPS_HFLAG_F64; | |
b8aa4598 | 71 | if (env->insn_flags & ISA_MIPS32R2) { |
f01be154 | 72 | if (env->active_fpu.fcr0 & (1 << FCR0_F64)) |
b8aa4598 TS |
73 | env->hflags |= MIPS_HFLAG_COP1X; |
74 | } else if (env->insn_flags & ISA_MIPS32) { | |
75 | if (env->hflags & MIPS_HFLAG_64) | |
76 | env->hflags |= MIPS_HFLAG_COP1X; | |
77 | } else if (env->insn_flags & ISA_MIPS4) { | |
78 | /* All supported MIPS IV CPUs use the XX (CU3) to enable | |
79 | and disable the MIPS IV extensions to the MIPS III ISA. | |
80 | Some other MIPS IV CPUs ignore the bit, so the check here | |
81 | would be too restrictive for them. */ | |
82 | if (env->CP0_Status & (1 << CP0St_CU3)) | |
83 | env->hflags |= MIPS_HFLAG_COP1X; | |
84 | } | |
08fa4bab TS |
85 | } |
86 | ||
6af0bf9c | 87 | #endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |