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