]>
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 FB |
26 | |
27 | int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw, | |
6ebbf390 | 28 | int mmu_idx, int is_softmmu); |
6af0bf9c | 29 | void do_interrupt (CPUState *env); |
29929e34 | 30 | void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra); |
6af0bf9c | 31 | |
6af0bf9c | 32 | void do_raise_exception_err (uint32_t exception, int error_code); |
6af0bf9c FB |
33 | void do_raise_exception (uint32_t exception); |
34 | ||
6af0bf9c FB |
35 | uint32_t cpu_mips_get_random (CPUState *env); |
36 | uint32_t cpu_mips_get_count (CPUState *env); | |
37 | void cpu_mips_store_count (CPUState *env, uint32_t value); | |
38 | void cpu_mips_store_compare (CPUState *env, uint32_t value); | |
42532189 TS |
39 | void cpu_mips_start_count(CPUState *env); |
40 | void cpu_mips_stop_count(CPUState *env); | |
a4bc3afc | 41 | void cpu_mips_update_irq (CPUState *env); |
6af0bf9c | 42 | void cpu_mips_clock_init (CPUState *env); |
814b9a47 | 43 | void cpu_mips_tlb_flush (CPUState *env, int flush_global); |
6af0bf9c | 44 | |
c904ef0e | 45 | static inline void env_to_regs(void) |
bfed01fc TS |
46 | { |
47 | } | |
48 | ||
c904ef0e | 49 | static inline void regs_to_env(void) |
bfed01fc TS |
50 | { |
51 | } | |
52 | ||
c904ef0e | 53 | static inline int cpu_halted(CPUState *env) |
08fa4bab | 54 | { |
bfed01fc TS |
55 | if (!env->halted) |
56 | return 0; | |
57 | if (env->interrupt_request & | |
58 | (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)) { | |
59 | env->halted = 0; | |
60 | return 0; | |
61 | } | |
62 | return EXCP_HALTED; | |
63 | } | |
64 | ||
c904ef0e | 65 | static inline void compute_hflags(CPUState *env) |
08fa4bab | 66 | { |
b8aa4598 | 67 | env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | |
2623c1ec AJ |
68 | MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | |
69 | MIPS_HFLAG_UX); | |
08fa4bab TS |
70 | if (!(env->CP0_Status & (1 << CP0St_EXL)) && |
71 | !(env->CP0_Status & (1 << CP0St_ERL)) && | |
671880e6 | 72 | !(env->hflags & MIPS_HFLAG_DM)) { |
623a930e | 73 | env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; |
671880e6 | 74 | } |
d26bc211 | 75 | #if defined(TARGET_MIPS64) |
623a930e | 76 | if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) || |
08fa4bab TS |
77 | (env->CP0_Status & (1 << CP0St_PX)) || |
78 | (env->CP0_Status & (1 << CP0St_UX))) | |
79 | env->hflags |= MIPS_HFLAG_64; | |
2623c1ec AJ |
80 | if (env->CP0_Status & (1 << CP0St_UX)) |
81 | env->hflags |= MIPS_HFLAG_UX; | |
08fa4bab | 82 | #endif |
671880e6 | 83 | if ((env->CP0_Status & (1 << CP0St_CU0)) || |
623a930e | 84 | !(env->hflags & MIPS_HFLAG_KSU)) |
08fa4bab TS |
85 | env->hflags |= MIPS_HFLAG_CP0; |
86 | if (env->CP0_Status & (1 << CP0St_CU1)) | |
87 | env->hflags |= MIPS_HFLAG_FPU; | |
88 | if (env->CP0_Status & (1 << CP0St_FR)) | |
89 | env->hflags |= MIPS_HFLAG_F64; | |
b8aa4598 | 90 | if (env->insn_flags & ISA_MIPS32R2) { |
f01be154 | 91 | if (env->active_fpu.fcr0 & (1 << FCR0_F64)) |
b8aa4598 TS |
92 | env->hflags |= MIPS_HFLAG_COP1X; |
93 | } else if (env->insn_flags & ISA_MIPS32) { | |
94 | if (env->hflags & MIPS_HFLAG_64) | |
95 | env->hflags |= MIPS_HFLAG_COP1X; | |
96 | } else if (env->insn_flags & ISA_MIPS4) { | |
97 | /* All supported MIPS IV CPUs use the XX (CU3) to enable | |
98 | and disable the MIPS IV extensions to the MIPS III ISA. | |
99 | Some other MIPS IV CPUs ignore the bit, so the check here | |
100 | would be too restrictive for them. */ | |
101 | if (env->CP0_Status & (1 << CP0St_CU3)) | |
102 | env->hflags |= MIPS_HFLAG_COP1X; | |
103 | } | |
08fa4bab TS |
104 | } |
105 | ||
6af0bf9c | 106 | #endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |