1 #if !defined(__QEMU_MIPS_EXEC_H__)
2 #define __QEMU_MIPS_EXEC_H__
8 #include "dyngen-exec.h"
11 register struct CPUMIPSState
*env
asm(AREG0
);
16 #if !defined(CONFIG_USER_ONLY)
17 #include "softmmu_exec.h"
18 #endif /* !defined(CONFIG_USER_ONLY) */
20 void do_mtc0_status_debug(uint32_t old
, uint32_t val
);
21 void do_mtc0_status_irqraise_debug(void);
22 void dump_fpu(CPUState
*env
);
23 void fpu_dump_state(CPUState
*env
, FILE *f
,
24 int (*fpu_fprintf
)(FILE *f
, const char *fmt
, ...),
27 int cpu_mips_handle_mmu_fault (CPUState
*env
, target_ulong address
, int rw
,
28 int mmu_idx
, int is_softmmu
);
29 void do_interrupt (CPUState
*env
);
30 void r4k_invalidate_tlb (CPUState
*env
, int idx
, int use_extra
);
32 void cpu_loop_exit(void);
33 void do_raise_exception_err (uint32_t exception
, int error_code
);
34 void do_raise_exception (uint32_t exception
);
36 void cpu_dump_state(CPUState
*env
, FILE *f
,
37 int (*cpu_fprintf
)(FILE *f
, const char *fmt
, ...),
39 void cpu_mips_irqctrl_init (void);
40 uint32_t cpu_mips_get_random (CPUState
*env
);
41 uint32_t cpu_mips_get_count (CPUState
*env
);
42 void cpu_mips_store_count (CPUState
*env
, uint32_t value
);
43 void cpu_mips_store_compare (CPUState
*env
, uint32_t value
);
44 void cpu_mips_start_count(CPUState
*env
);
45 void cpu_mips_stop_count(CPUState
*env
);
46 void cpu_mips_update_irq (CPUState
*env
);
47 void cpu_mips_clock_init (CPUState
*env
);
48 void cpu_mips_tlb_flush (CPUState
*env
, int flush_global
);
50 static always_inline
void env_to_regs(void)
54 static always_inline
void regs_to_env(void)
58 static always_inline
int cpu_halted(CPUState
*env
)
62 if (env
->interrupt_request
&
63 (CPU_INTERRUPT_HARD
| CPU_INTERRUPT_TIMER
)) {
70 static always_inline
void compute_hflags(CPUState
*env
)
72 env
->hflags
&= ~(MIPS_HFLAG_COP1X
| MIPS_HFLAG_64
| MIPS_HFLAG_CP0
|
73 MIPS_HFLAG_F64
| MIPS_HFLAG_FPU
| MIPS_HFLAG_KSU
);
74 if (!(env
->CP0_Status
& (1 << CP0St_EXL
)) &&
75 !(env
->CP0_Status
& (1 << CP0St_ERL
)) &&
76 !(env
->hflags
& MIPS_HFLAG_DM
)) {
77 env
->hflags
|= (env
->CP0_Status
>> CP0St_KSU
) & MIPS_HFLAG_KSU
;
79 #if defined(TARGET_MIPS64)
80 if (((env
->hflags
& MIPS_HFLAG_KSU
) != MIPS_HFLAG_UM
) ||
81 (env
->CP0_Status
& (1 << CP0St_PX
)) ||
82 (env
->CP0_Status
& (1 << CP0St_UX
)))
83 env
->hflags
|= MIPS_HFLAG_64
;
85 if ((env
->CP0_Status
& (1 << CP0St_CU0
)) ||
86 !(env
->hflags
& MIPS_HFLAG_KSU
))
87 env
->hflags
|= MIPS_HFLAG_CP0
;
88 if (env
->CP0_Status
& (1 << CP0St_CU1
))
89 env
->hflags
|= MIPS_HFLAG_FPU
;
90 if (env
->CP0_Status
& (1 << CP0St_FR
))
91 env
->hflags
|= MIPS_HFLAG_F64
;
92 if (env
->insn_flags
& ISA_MIPS32R2
) {
93 if (env
->fpu
->fcr0
& (1 << FCR0_F64
))
94 env
->hflags
|= MIPS_HFLAG_COP1X
;
95 } else if (env
->insn_flags
& ISA_MIPS32
) {
96 if (env
->hflags
& MIPS_HFLAG_64
)
97 env
->hflags
|= MIPS_HFLAG_COP1X
;
98 } else if (env
->insn_flags
& ISA_MIPS4
) {
99 /* All supported MIPS IV CPUs use the XX (CU3) to enable
100 and disable the MIPS IV extensions to the MIPS III ISA.
101 Some other MIPS IV CPUs ignore the bit, so the check here
102 would be too restrictive for them. */
103 if (env
->CP0_Status
& (1 << CP0St_CU3
))
104 env
->hflags
|= MIPS_HFLAG_COP1X
;
108 #endif /* !defined(__QEMU_MIPS_EXEC_H__) */