diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-09-26 23:52:06 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-09-26 23:52:06 +0000 |
commit | 08fa4bab833f834e1511853dd2331fa3d6d5d469 (patch) | |
tree | 7da59ed6f5bba4553e357e53fce51078accbc5f8 /target-mips/exec.h | |
parent | fe253235b2b3c78587c049b8504c2ef2ea7b5ced (diff) |
hflags computation cleanup, by Aurelien Jarno.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3243 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips/exec.h')
-rw-r--r-- | target-mips/exec.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/target-mips/exec.h b/target-mips/exec.h index d5aadedb81..9ff3f08b59 100644 --- a/target-mips/exec.h +++ b/target-mips/exec.h @@ -243,7 +243,8 @@ static inline void regs_to_env(void) { } -static inline int cpu_halted(CPUState *env) { +static inline int cpu_halted(CPUState *env) +{ if (!env->halted) return 0; if (env->interrupt_request & @@ -254,4 +255,27 @@ static inline int cpu_halted(CPUState *env) { return EXCP_HALTED; } +static inline void compute_hflags(CPUState *env) +{ + env->hflags &= ~(MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | MIPS_HFLAG_F64 | + MIPS_HFLAG_FPU | MIPS_HFLAG_UM); + if (!(env->CP0_Status & (1 << CP0St_EXL)) && + !(env->CP0_Status & (1 << CP0St_ERL)) && + !(env->hflags & MIPS_HFLAG_DM) && + (env->CP0_Status & (1 << CP0St_UM))) + env->hflags |= MIPS_HFLAG_UM; +#ifdef TARGET_MIPS64 + if (!(env->hflags & MIPS_HFLAG_UM) || + (env->CP0_Status & (1 << CP0St_PX)) || + (env->CP0_Status & (1 << CP0St_UX))) + env->hflags |= MIPS_HFLAG_64; +#endif + if ((env->CP0_Status & (1 << CP0St_CU0)) || !(env->hflags & MIPS_HFLAG_UM)) + env->hflags |= MIPS_HFLAG_CP0; + if (env->CP0_Status & (1 << CP0St_CU1)) + env->hflags |= MIPS_HFLAG_FPU; + if (env->CP0_Status & (1 << CP0St_FR)) + env->hflags |= MIPS_HFLAG_F64; +} + #endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |