root / target-mips / exec.h @ 941694d0
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 | 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 | 6a4955a8 | aliguori | static inline int cpu_has_work(CPUState *env) |
37 | 6a4955a8 | aliguori | { |
38 | 6a4955a8 | aliguori | return (env->interrupt_request &
|
39 | 6a4955a8 | aliguori | (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)); |
40 | 6a4955a8 | aliguori | } |
41 | 6a4955a8 | aliguori | |
42 | 6a4955a8 | aliguori | |
43 | c904ef0e | ths | static inline int cpu_halted(CPUState *env) |
44 | 08fa4bab | ths | { |
45 | bfed01fc | ths | if (!env->halted)
|
46 | bfed01fc | ths | return 0; |
47 | 6a4955a8 | aliguori | if (cpu_has_work(env)) {
|
48 | bfed01fc | ths | env->halted = 0;
|
49 | bfed01fc | ths | return 0; |
50 | bfed01fc | ths | } |
51 | bfed01fc | ths | return EXCP_HALTED;
|
52 | bfed01fc | ths | } |
53 | bfed01fc | ths | |
54 | c904ef0e | ths | static inline void compute_hflags(CPUState *env) |
55 | 08fa4bab | ths | { |
56 | b8aa4598 | ths | env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | |
57 | 2623c1ec | aurel32 | MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | |
58 | 2623c1ec | aurel32 | MIPS_HFLAG_UX); |
59 | 08fa4bab | ths | if (!(env->CP0_Status & (1 << CP0St_EXL)) && |
60 | 08fa4bab | ths | !(env->CP0_Status & (1 << CP0St_ERL)) &&
|
61 | 671880e6 | ths | !(env->hflags & MIPS_HFLAG_DM)) { |
62 | 623a930e | ths | env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; |
63 | 671880e6 | ths | } |
64 | d26bc211 | ths | #if defined(TARGET_MIPS64)
|
65 | 623a930e | ths | if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) ||
|
66 | 08fa4bab | ths | (env->CP0_Status & (1 << CP0St_PX)) ||
|
67 | 08fa4bab | ths | (env->CP0_Status & (1 << CP0St_UX)))
|
68 | 08fa4bab | ths | env->hflags |= MIPS_HFLAG_64; |
69 | 2623c1ec | aurel32 | if (env->CP0_Status & (1 << CP0St_UX)) |
70 | 2623c1ec | aurel32 | env->hflags |= MIPS_HFLAG_UX; |
71 | 08fa4bab | ths | #endif
|
72 | 671880e6 | ths | if ((env->CP0_Status & (1 << CP0St_CU0)) || |
73 | 623a930e | ths | !(env->hflags & MIPS_HFLAG_KSU)) |
74 | 08fa4bab | ths | env->hflags |= MIPS_HFLAG_CP0; |
75 | 08fa4bab | ths | if (env->CP0_Status & (1 << CP0St_CU1)) |
76 | 08fa4bab | ths | env->hflags |= MIPS_HFLAG_FPU; |
77 | 08fa4bab | ths | if (env->CP0_Status & (1 << CP0St_FR)) |
78 | 08fa4bab | ths | env->hflags |= MIPS_HFLAG_F64; |
79 | b8aa4598 | ths | if (env->insn_flags & ISA_MIPS32R2) {
|
80 | f01be154 | ths | if (env->active_fpu.fcr0 & (1 << FCR0_F64)) |
81 | b8aa4598 | ths | env->hflags |= MIPS_HFLAG_COP1X; |
82 | b8aa4598 | ths | } else if (env->insn_flags & ISA_MIPS32) { |
83 | b8aa4598 | ths | if (env->hflags & MIPS_HFLAG_64)
|
84 | b8aa4598 | ths | env->hflags |= MIPS_HFLAG_COP1X; |
85 | b8aa4598 | ths | } else if (env->insn_flags & ISA_MIPS4) { |
86 | b8aa4598 | ths | /* All supported MIPS IV CPUs use the XX (CU3) to enable
|
87 | b8aa4598 | ths | and disable the MIPS IV extensions to the MIPS III ISA.
|
88 | b8aa4598 | ths | Some other MIPS IV CPUs ignore the bit, so the check here
|
89 | b8aa4598 | ths | would be too restrictive for them. */
|
90 | b8aa4598 | ths | if (env->CP0_Status & (1 << CP0St_CU3)) |
91 | b8aa4598 | ths | env->hflags |= MIPS_HFLAG_COP1X; |
92 | b8aa4598 | ths | } |
93 | 08fa4bab | ths | } |
94 | 08fa4bab | ths | |
95 | 6af0bf9c | bellard | #endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |