root / target-mips / exec.h @ eda48c34
History | View | Annotate | Download (2.7 kB)
1 |
#if !defined(__QEMU_MIPS_EXEC_H__)
|
---|---|
2 |
#define __QEMU_MIPS_EXEC_H__
|
3 |
|
4 |
//#define DEBUG_OP
|
5 |
|
6 |
#include "config.h" |
7 |
#include "mips-defs.h" |
8 |
#include "dyngen-exec.h" |
9 |
#include "cpu-defs.h" |
10 |
|
11 |
register struct CPUMIPSState *env asm(AREG0); |
12 |
|
13 |
#include "cpu.h" |
14 |
#include "exec-all.h" |
15 |
|
16 |
#if !defined(CONFIG_USER_ONLY)
|
17 |
#include "softmmu_exec.h" |
18 |
#endif /* !defined(CONFIG_USER_ONLY) */ |
19 |
|
20 |
static inline int cpu_has_work(CPUState *env) |
21 |
{ |
22 |
int has_work = 0; |
23 |
|
24 |
/* It is implementation dependent if non-enabled interrupts
|
25 |
wake-up the CPU, however most of the implementations only
|
26 |
check for interrupts that can be taken. */
|
27 |
if ((env->interrupt_request & CPU_INTERRUPT_HARD) &&
|
28 |
cpu_mips_hw_interrupts_pending(env)) { |
29 |
has_work = 1;
|
30 |
} |
31 |
|
32 |
if (env->interrupt_request & CPU_INTERRUPT_TIMER) {
|
33 |
has_work = 1;
|
34 |
} |
35 |
|
36 |
return has_work;
|
37 |
} |
38 |
|
39 |
static inline void compute_hflags(CPUState *env) |
40 |
{ |
41 |
env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | |
42 |
MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | |
43 |
MIPS_HFLAG_UX); |
44 |
if (!(env->CP0_Status & (1 << CP0St_EXL)) && |
45 |
!(env->CP0_Status & (1 << CP0St_ERL)) &&
|
46 |
!(env->hflags & MIPS_HFLAG_DM)) { |
47 |
env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; |
48 |
} |
49 |
#if defined(TARGET_MIPS64)
|
50 |
if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) ||
|
51 |
(env->CP0_Status & (1 << CP0St_PX)) ||
|
52 |
(env->CP0_Status & (1 << CP0St_UX)))
|
53 |
env->hflags |= MIPS_HFLAG_64; |
54 |
if (env->CP0_Status & (1 << CP0St_UX)) |
55 |
env->hflags |= MIPS_HFLAG_UX; |
56 |
#endif
|
57 |
if ((env->CP0_Status & (1 << CP0St_CU0)) || |
58 |
!(env->hflags & MIPS_HFLAG_KSU)) |
59 |
env->hflags |= MIPS_HFLAG_CP0; |
60 |
if (env->CP0_Status & (1 << CP0St_CU1)) |
61 |
env->hflags |= MIPS_HFLAG_FPU; |
62 |
if (env->CP0_Status & (1 << CP0St_FR)) |
63 |
env->hflags |= MIPS_HFLAG_F64; |
64 |
if (env->insn_flags & ISA_MIPS32R2) {
|
65 |
if (env->active_fpu.fcr0 & (1 << FCR0_F64)) |
66 |
env->hflags |= MIPS_HFLAG_COP1X; |
67 |
} else if (env->insn_flags & ISA_MIPS32) { |
68 |
if (env->hflags & MIPS_HFLAG_64)
|
69 |
env->hflags |= MIPS_HFLAG_COP1X; |
70 |
} else if (env->insn_flags & ISA_MIPS4) { |
71 |
/* All supported MIPS IV CPUs use the XX (CU3) to enable
|
72 |
and disable the MIPS IV extensions to the MIPS III ISA.
|
73 |
Some other MIPS IV CPUs ignore the bit, so the check here
|
74 |
would be too restrictive for them. */
|
75 |
if (env->CP0_Status & (1 << CP0St_CU3)) |
76 |
env->hflags |= MIPS_HFLAG_COP1X; |
77 |
} |
78 |
} |
79 |
|
80 |
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) |
81 |
{ |
82 |
env->active_tc.PC = tb->pc; |
83 |
env->hflags &= ~MIPS_HFLAG_BMASK; |
84 |
env->hflags |= tb->flags & MIPS_HFLAG_BMASK; |
85 |
} |
86 |
|
87 |
#endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |