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