aboutsummaryrefslogtreecommitdiff
path: root/target-mips/op.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-25 14:49:47 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-25 14:49:47 +0000
commit387a8fe505dd733968a798c9d3b88fbdd5f93056 (patch)
tree237699e955b70f6b6428c4f62c25fb129015d10f /target-mips/op.c
parentb570094d9bb19e59618902d825da6d2899b8d295 (diff)
downloadqemu-387a8fe505dd733968a798c9d3b88fbdd5f93056.zip
qemu-387a8fe505dd733968a798c9d3b88fbdd5f93056.tar.gz
qemu-387a8fe505dd733968a798c9d3b88fbdd5f93056.tar.bz2
Optimise instructions accessing CP0, by Aurelien Jarno.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3235 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips/op.c')
-rw-r--r--target-mips/op.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/target-mips/op.c b/target-mips/op.c
index dd90163..b353644 100644
--- a/target-mips/op.c
+++ b/target-mips/op.c
@@ -1852,6 +1852,10 @@ void op_mtc0_status (void)
!(val & (1 << CP0St_UX)))
env->hflags &= ~MIPS_HFLAG_64;
#endif
+ if ((val & (1 << CP0St_CU0)) || !(env->hflags & MIPS_HFLAG_UM))
+ env->hflags |= MIPS_HFLAG_CP0;
+ else
+ env->hflags &= ~MIPS_HFLAG_CP0;
if (val & (1 << CP0St_CU1))
env->hflags |= MIPS_HFLAG_FPU;
else
@@ -2316,15 +2320,6 @@ void op_yield(void)
# define DEBUG_FPU_STATE() do { } while(0)
#endif
-void op_cp0_enabled(void)
-{
- if (!(env->CP0_Status & (1 << CP0St_CU0)) &&
- (env->hflags & MIPS_HFLAG_UM)) {
- CALL_FROM_TB2(do_raise_exception_err, EXCP_CpU, 0);
- }
- RETURN();
-}
-
void op_cfc1 (void)
{
CALL_FROM_TB1(do_cfc1, PARAM1);
@@ -3018,6 +3013,10 @@ void op_eret (void)
!(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;
+ else
+ env->hflags &= ~MIPS_HFLAG_CP0;
if (loglevel & CPU_LOG_EXEC)
CALL_FROM_TB0(debug_post_eret);
env->CP0_LLAddr = 1;
@@ -3041,6 +3040,10 @@ void op_deret (void)
!(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;
+ else
+ env->hflags &= ~MIPS_HFLAG_CP0;
if (loglevel & CPU_LOG_EXEC)
CALL_FROM_TB0(debug_post_eret);
env->CP0_LLAddr = 1;
@@ -3049,9 +3052,8 @@ void op_deret (void)
void op_rdhwr_cpunum(void)
{
- if (!(env->hflags & MIPS_HFLAG_UM) ||
- (env->CP0_HWREna & (1 << 0)) ||
- (env->CP0_Status & (1 << CP0St_CU0)))
+ if ((env->hflags & MIPS_HFLAG_CP0) ||
+ (env->CP0_HWREna & (1 << 0)))
T0 = env->CP0_EBase & 0x3ff;
else
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
@@ -3060,9 +3062,8 @@ void op_rdhwr_cpunum(void)
void op_rdhwr_synci_step(void)
{
- if (!(env->hflags & MIPS_HFLAG_UM) ||
- (env->CP0_HWREna & (1 << 1)) ||
- (env->CP0_Status & (1 << CP0St_CU0)))
+ if ((env->hflags & MIPS_HFLAG_CP0) ||
+ (env->CP0_HWREna & (1 << 1)))
T0 = env->SYNCI_Step;
else
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
@@ -3071,9 +3072,8 @@ void op_rdhwr_synci_step(void)
void op_rdhwr_cc(void)
{
- if (!(env->hflags & MIPS_HFLAG_UM) ||
- (env->CP0_HWREna & (1 << 2)) ||
- (env->CP0_Status & (1 << CP0St_CU0)))
+ if ((env->hflags & MIPS_HFLAG_CP0) ||
+ (env->CP0_HWREna & (1 << 2)))
T0 = env->CP0_Count;
else
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
@@ -3082,9 +3082,8 @@ void op_rdhwr_cc(void)
void op_rdhwr_ccres(void)
{
- if (!(env->hflags & MIPS_HFLAG_UM) ||
- (env->CP0_HWREna & (1 << 3)) ||
- (env->CP0_Status & (1 << CP0St_CU0)))
+ if ((env->hflags & MIPS_HFLAG_CP0) ||
+ (env->CP0_HWREna & (1 << 3)))
T0 = env->CCRes;
else
CALL_FROM_TB1(do_raise_exception, EXCP_RI);