Commit c1942362bcb9e7255d25eec219b2a61d6581615e

Authored by bellard
1 parent 0b7a4a97

use direct jump only for jumps in the same page - stop translation after mtsr[in]


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1628 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 26 additions and 15 deletions
target-ppc/translate.c
... ... @@ -1727,16 +1727,25 @@ GEN_HANDLER(stfiwx, 0x1F, 0x17, 0x1E, 0x00000001, PPC_FLOAT)
1727 1727  
1728 1728 /*** Branch ***/
1729 1729  
1730   -static inline void gen_jmp_tb(long tb, int n, uint32_t dest)
1731   -{
1732   - if (n == 0)
1733   - gen_op_goto_tb0(TBPARAM(tb));
1734   - else
1735   - gen_op_goto_tb1(TBPARAM(tb));
1736   - gen_op_set_T1(dest);
1737   - gen_op_b_T1();
1738   - gen_op_set_T0(tb + n);
1739   - gen_op_exit_tb();
  1730 +static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
  1731 +{
  1732 + TranslationBlock *tb;
  1733 + tb = ctx->tb;
  1734 + if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
  1735 + if (n == 0)
  1736 + gen_op_goto_tb0(TBPARAM(tb));
  1737 + else
  1738 + gen_op_goto_tb1(TBPARAM(tb));
  1739 + gen_op_set_T1(dest);
  1740 + gen_op_b_T1();
  1741 + gen_op_set_T0((long)tb + n);
  1742 + gen_op_exit_tb();
  1743 + } else {
  1744 + gen_op_set_T1(dest);
  1745 + gen_op_b_T1();
  1746 + gen_op_set_T0(0);
  1747 + gen_op_exit_tb();
  1748 + }
1740 1749 }
1741 1750  
1742 1751 /* b ba bl bla */
... ... @@ -1754,7 +1763,7 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
1754 1763 if (LK(ctx->opcode)) {
1755 1764 gen_op_setlr(ctx->nip);
1756 1765 }
1757   - gen_jmp_tb((long)ctx->tb, 0, target);
  1766 + gen_goto_tb(ctx, 0, target);
1758 1767 ctx->exception = EXCP_BRANCH;
1759 1768 }
1760 1769  
... ... @@ -1805,7 +1814,7 @@ static inline void gen_bcond(DisasContext *ctx, int type)
1805 1814 case 4:
1806 1815 case 6:
1807 1816 if (type == BCOND_IM) {
1808   - gen_jmp_tb((long)ctx->tb, 0, target);
  1817 + gen_goto_tb(ctx, 0, target);
1809 1818 } else {
1810 1819 gen_op_b_T1();
1811 1820 }
... ... @@ -1847,9 +1856,9 @@ static inline void gen_bcond(DisasContext *ctx, int type)
1847 1856 if (type == BCOND_IM) {
1848 1857 int l1 = gen_new_label();
1849 1858 gen_op_jz_T0(l1);
1850   - gen_jmp_tb((long)ctx->tb, 0, target);
  1859 + gen_goto_tb(ctx, 0, target);
1851 1860 gen_set_label(l1);
1852   - gen_jmp_tb((long)ctx->tb, 1, ctx->nip);
  1861 + gen_goto_tb(ctx, 1, ctx->nip);
1853 1862 } else {
1854 1863 gen_op_btest_T1(ctx->nip);
1855 1864 }
... ... @@ -2269,6 +2278,7 @@ GEN_HANDLER(mtsr, 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT)
2269 2278 }
2270 2279 gen_op_load_gpr_T0(rS(ctx->opcode));
2271 2280 gen_op_store_sr(SR(ctx->opcode));
  2281 + RET_MTMSR(ctx);
2272 2282 #endif
2273 2283 }
2274 2284  
... ... @@ -2285,6 +2295,7 @@ GEN_HANDLER(mtsrin, 0x1F, 0x12, 0x07, 0x001F0001, PPC_SEGMENT)
2285 2295 gen_op_load_gpr_T0(rS(ctx->opcode));
2286 2296 gen_op_load_gpr_T1(rB(ctx->opcode));
2287 2297 gen_op_store_srin();
  2298 + RET_MTMSR(ctx);
2288 2299 #endif
2289 2300 }
2290 2301  
... ... @@ -2598,7 +2609,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
2598 2609 #endif
2599 2610 }
2600 2611 if (ctx.exception == EXCP_NONE) {
2601   - gen_jmp_tb((long)ctx.tb, 0, ctx.nip);
  2612 + gen_goto_tb(&ctx, 0, ctx.nip);
2602 2613 } else if (ctx.exception != EXCP_BRANCH) {
2603 2614 gen_op_set_T0(0);
2604 2615 }
... ...