PowerPC emulation optimization:
avoid stopping translation after most SPR updates
when a context-synchronization instruction is also needed.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3265 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index dc4e758..e88cfaf 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -3230,7 +3230,8 @@
gen_op_load_gpr_T0(rS(ctx->opcode));
gen_op_store_msr();
/* Must stop the translation as machine state (may have) changed */
- GEN_SYNC(ctx);
+ /* Note that mtmsr is not always defined as context-synchronizing */
+ GEN_STOP(ctx);
#endif
}
#endif
@@ -3253,7 +3254,8 @@
#endif
gen_op_store_msr();
/* Must stop the translation as machine state (may have) changed */
- GEN_SYNC(ctx);
+ /* Note that mtmsrd is not always defined as context-synchronizing */
+ GEN_STOP(ctx);
#endif
}
@@ -4936,6 +4938,9 @@
}
gen_op_load_gpr_T0(rD(ctx->opcode));
gen_op_wrte();
+ /* Stop translation to have a chance to raise an exception
+ * if we just set msr_ee to 1
+ */
GEN_STOP(ctx);
#endif
}
@@ -4952,6 +4957,9 @@
}
gen_op_set_T0(ctx->opcode & 0x00010000);
gen_op_wrte();
+ /* Stop translation to have a chance to raise an exception
+ * if we just set msr_ee to 1
+ */
GEN_STOP(ctx);
#endif
}
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 109dcdc..53a6abf 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -189,34 +189,22 @@
static void spr_write_ibatu (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_ibatu((sprn - SPR_IBAT0U) / 2);
- GEN_STOP(ctx);
}
static void spr_write_ibatu_h (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_ibatu((sprn - SPR_IBAT4U) / 2);
- GEN_STOP(ctx);
}
static void spr_write_ibatl (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_ibatl((sprn - SPR_IBAT0L) / 2);
- GEN_STOP(ctx);
}
static void spr_write_ibatl_h (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_ibatl((sprn - SPR_IBAT4L) / 2);
- GEN_STOP(ctx);
}
/* DBAT0U...DBAT7U */
@@ -233,34 +221,22 @@
static void spr_write_dbatu (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_dbatu((sprn - SPR_DBAT0U) / 2);
- GEN_STOP(ctx);
}
static void spr_write_dbatu_h (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_dbatu((sprn - SPR_DBAT4U) / 2);
- GEN_STOP(ctx);
}
static void spr_write_dbatl (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_dbatl((sprn - SPR_DBAT0L) / 2);
- GEN_STOP(ctx);
}
static void spr_write_dbatl_h (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_dbatl((sprn - SPR_DBAT4L) / 2);
- GEN_STOP(ctx);
}
/* SDR1 */
@@ -271,10 +247,7 @@
static void spr_write_sdr1 (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_sdr1();
- GEN_STOP(ctx);
}
/* 64 bits PowerPC specific SPRs */
@@ -291,7 +264,6 @@
DisasContext *ctx = opaque;
gen_op_store_asr();
- GEN_STOP(ctx);
}
#endif
#endif
@@ -329,18 +301,12 @@
static void spr_write_601_ubatu (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_601_batu((sprn - SPR_IBAT0U) / 2);
- GEN_STOP(ctx);
}
static void spr_write_601_ubatl (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_601_batl((sprn - SPR_IBAT0L) / 2);
- GEN_STOP(ctx);
}
#endif
@@ -367,13 +333,7 @@
static void spr_write_40x_sler (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_40x_sler();
- /* We must stop the translation as we may have changed
- * some regions endianness
- */
- GEN_STOP(ctx);
}
static void spr_write_booke_tcr (void *opaque, int sprn)
@@ -397,10 +357,7 @@
static void spr_write_403_pbr (void *opaque, int sprn)
{
- DisasContext *ctx = opaque;
-
gen_op_store_403_pb(sprn - SPR_403_PBL1);
- GEN_STOP(ctx);
}
static void spr_write_pir (void *opaque, int sprn)