diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-06-04 22:22:27 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-06-04 22:22:27 +0000 |
commit | 8dd4983c4e0c4e4f2ed87060a770ba99e03f3b9e (patch) | |
tree | 0058cba4fd8aaa7a16af9c11270f8d1b2b3f3fc5 | |
parent | 71be0fc3eb3f8ac523e1b1b2ae138a5c9a613dee (diff) |
fixed lsw[ix] / stsw[ix] potential exception bug - mtcrf workaround for Mac OS X 10.4 - use direct jump at page boundary
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1441 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | target-ppc/translate.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c index cf47f2b3f8..2a828ed291 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -1370,6 +1370,8 @@ GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001, PPC_INTEGER) gen_op_load_gpr_T0(ra); } gen_op_set_T1(nb); + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_op_update_nip((ctx)->nip - 4); op_ldsts(lswi, start); } @@ -1388,6 +1390,8 @@ GEN_HANDLER(lswx, 0x1F, 0x15, 0x10, 0x00000001, PPC_INTEGER) gen_op_add(); } gen_op_load_xer_bc(); + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_op_update_nip((ctx)->nip - 4); op_ldstsx(lswx, rD(ctx->opcode), ra, rb); } @@ -1404,6 +1408,8 @@ GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_INTEGER) if (nb == 0) nb = 32; gen_op_set_T1(nb); + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_op_update_nip((ctx)->nip - 4); op_ldsts(stsw, rS(ctx->opcode)); } @@ -1421,6 +1427,8 @@ GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_INTEGER) gen_op_add(); } gen_op_load_xer_bc(); + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_op_update_nip((ctx)->nip - 4); op_ldsts(stsw, rS(ctx->opcode)); } @@ -2123,7 +2131,8 @@ GEN_HANDLER(mftb, 0x1F, 0x13, 0x0B, 0x00000001, PPC_MISC) } /* mtcrf */ -GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00100801, PPC_MISC) +/* The mask should be 0x00100801, but Mac OS X 10.4 use an alternate form */ +GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_MISC) { gen_op_load_gpr_T0(rS(ctx->opcode)); gen_op_store_cr(CRM(ctx->opcode)); @@ -3312,10 +3321,14 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, ctx.exception != EXCP_TRAP)) { RET_EXCP(ctxp, EXCP_TRACE, 0); } + if (ctx.exception != EXCP_NONE) + break; /* if we reach a page boundary, stop generation */ if ((ctx.nip & (TARGET_PAGE_SIZE - 1)) == 0) { - RET_EXCP(ctxp, EXCP_BRANCH, 0); - } + gen_op_b((long)ctx.tb, ctx.nip); + ctx.exception = EXCP_BRANCH; + break; + } } if (ctx.exception == EXCP_NONE) { gen_op_b((unsigned long)ctx.tb, ctx.nip); |