]>
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 | ||
8c0fdd85 TS |
20 | void do_mtc0_status_debug(uint32_t old, uint32_t val); |
21 | void do_mtc0_status_irqraise_debug(void); | |
6ea83fed | 22 | void dump_fpu(CPUState *env); |
5fafdf24 | 23 | void fpu_dump_state(CPUState *env, FILE *f, |
6ea83fed FB |
24 | int (*fpu_fprintf)(FILE *f, const char *fmt, ...), |
25 | int flags); | |
6af0bf9c | 26 | |
6af0bf9c | 27 | void cpu_mips_clock_init (CPUState *env); |
814b9a47 | 28 | void cpu_mips_tlb_flush (CPUState *env, int flush_global); |
6af0bf9c | 29 | |
c904ef0e | 30 | static inline void env_to_regs(void) |
bfed01fc TS |
31 | { |
32 | } | |
33 | ||
c904ef0e | 34 | static inline void regs_to_env(void) |
bfed01fc TS |
35 | { |
36 | } | |
37 | ||
c904ef0e | 38 | static inline int cpu_halted(CPUState *env) |
08fa4bab | 39 | { |
bfed01fc TS |
40 | if (!env->halted) |
41 | return 0; | |
42 | if (env->interrupt_request & | |
43 | (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)) { | |
44 | env->halted = 0; | |
45 | return 0; | |
46 | } | |
47 | return EXCP_HALTED; | |
48 | } | |
49 | ||
c904ef0e | 50 | static inline void compute_hflags(CPUState *env) |
08fa4bab | 51 | { |
b8aa4598 | 52 | env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | |
2623c1ec AJ |
53 | MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | |
54 | MIPS_HFLAG_UX); | |
08fa4bab TS |
55 | if (!(env->CP0_Status & (1 << CP0St_EXL)) && |
56 | !(env->CP0_Status & (1 << CP0St_ERL)) && | |
671880e6 | 57 | !(env->hflags & MIPS_HFLAG_DM)) { |
623a930e | 58 | env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; |
671880e6 | 59 | } |
d26bc211 | 60 | #if defined(TARGET_MIPS64) |
623a930e | 61 | if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) || |
08fa4bab TS |
62 | (env->CP0_Status & (1 << CP0St_PX)) || |
63 | (env->CP0_Status & (1 << CP0St_UX))) | |
64 | env->hflags |= MIPS_HFLAG_64; | |
2623c1ec AJ |
65 | if (env->CP0_Status & (1 << CP0St_UX)) |
66 | env->hflags |= MIPS_HFLAG_UX; | |
08fa4bab | 67 | #endif |
671880e6 | 68 | if ((env->CP0_Status & (1 << CP0St_CU0)) || |
623a930e | 69 | !(env->hflags & MIPS_HFLAG_KSU)) |
08fa4bab TS |
70 | env->hflags |= MIPS_HFLAG_CP0; |
71 | if (env->CP0_Status & (1 << CP0St_CU1)) | |
72 | env->hflags |= MIPS_HFLAG_FPU; | |
73 | if (env->CP0_Status & (1 << CP0St_FR)) | |
74 | env->hflags |= MIPS_HFLAG_F64; | |
b8aa4598 | 75 | if (env->insn_flags & ISA_MIPS32R2) { |
f01be154 | 76 | if (env->active_fpu.fcr0 & (1 << FCR0_F64)) |
b8aa4598 TS |
77 | env->hflags |= MIPS_HFLAG_COP1X; |
78 | } else if (env->insn_flags & ISA_MIPS32) { | |
79 | if (env->hflags & MIPS_HFLAG_64) | |
80 | env->hflags |= MIPS_HFLAG_COP1X; | |
81 | } else if (env->insn_flags & ISA_MIPS4) { | |
82 | /* All supported MIPS IV CPUs use the XX (CU3) to enable | |
83 | and disable the MIPS IV extensions to the MIPS III ISA. | |
84 | Some other MIPS IV CPUs ignore the bit, so the check here | |
85 | would be too restrictive for them. */ | |
86 | if (env->CP0_Status & (1 << CP0St_CU3)) | |
87 | env->hflags |= MIPS_HFLAG_COP1X; | |
88 | } | |
08fa4bab TS |
89 | } |
90 | ||
6af0bf9c | 91 | #endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |