aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-29 15:02:38 +0000
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-29 15:02:38 +0000
commitdee96f6ca300da3dc3bc97635d9c3d97a73b5e48 (patch)
treee7e8c27710a3f625f65e9564615015427c024e8c
parent58a7d32872badb7b94d2010e0100a25443e0ef77 (diff)
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
-rw-r--r--target-ppc/translate.c12
-rw-r--r--target-ppc/translate_init.c43
2 files changed, 10 insertions, 45 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index dc4e758914..e88cfafaee 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -3230,7 +3230,8 @@ GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001FF801, PPC_64B)
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 @@ GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
#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_HANDLER(wrtee, 0x1F, 0x03, 0x04, 0x000FFC01, PPC_EMB_COMMON)
}
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_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_EMB_COMMON)
}
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 109dcdc256..53a6abf9c8 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -189,34 +189,22 @@ static void spr_read_ibat_h (void *opaque, int sprn)
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_read_dbat_h (void *opaque, int sprn)
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_read_sdr1 (void *opaque, int sprn)
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 @@ static void spr_write_asr (void *opaque, int sprn)
DisasContext *ctx = opaque;
gen_op_store_asr();
- GEN_STOP(ctx);
}
#endif
#endif
@@ -329,18 +301,12 @@ static void spr_read_601_ubat (void *opaque, int sprn)
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_dbcr0 (void *opaque, int sprn)
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_read_403_pbr (void *opaque, int sprn)
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)