Commit e2be8d8d7ed7ca8bd3fdf7f6207cabd9cfb32b8e

Authored by aurel32
1 parent 064f6633

PPC: convert effective address computation to TCG

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5490 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.c
... ... @@ -2899,19 +2899,6 @@ void ppc_hw_interrupt (CPUPPCState *env)
2899 2899 }
2900 2900 #endif /* !CONFIG_USER_ONLY */
2901 2901  
2902   -void cpu_dump_EA (target_ulong EA)
2903   -{
2904   - FILE *f;
2905   -
2906   - if (logfile) {
2907   - f = logfile;
2908   - } else {
2909   - f = stdout;
2910   - return;
2911   - }
2912   - fprintf(f, "Memory access at address " ADDRX "\n", EA);
2913   -}
2914   -
2915 2902 void cpu_dump_rfi (target_ulong RA, target_ulong msr)
2916 2903 {
2917 2904 FILE *f;
... ...
target-ppc/op.c
... ... @@ -26,12 +26,6 @@
26 26 #include "helper_regs.h"
27 27 #include "op_helper.h"
28 28  
29   -void OPPROTO op_print_mem_EA (void)
30   -{
31   - do_print_mem_EA(T0);
32   - RETURN();
33   -}
34   -
35 29 /* PowerPC state maintenance operations */
36 30 /* set_Rc0 */
37 31 void OPPROTO op_set_Rc0 (void)
... ...
target-ppc/op_helper.c
... ... @@ -60,12 +60,6 @@ void do_raise_exception (uint32_t exception)
60 60 do_raise_exception_err(exception, 0);
61 61 }
62 62  
63   -void cpu_dump_EA (target_ulong EA);
64   -void do_print_mem_EA (target_ulong EA)
65   -{
66   - cpu_dump_EA(EA);
67   -}
68   -
69 63 /*****************************************************************************/
70 64 /* Registers load and stores */
71 65 void do_load_cr (void)
... ...
target-ppc/translate.c
... ... @@ -37,7 +37,6 @@
37 37 /* Include definitions for instructions classes and implementations flags */
38 38 //#define DO_SINGLE_STEP
39 39 //#define PPC_DEBUG_DISAS
40   -//#define DEBUG_MEMORY_ACCESSES
41 40 //#define DO_PPC_STATISTICS
42 41 //#define OPTIMIZE_FPRF_UPDATE
43 42  
... ... @@ -2107,48 +2106,37 @@ GEN_HANDLER(mtfsfi, 0x3F, 0x06, 0x04, 0x006f0800, PPC_FLOAT)
2107 2106  
2108 2107 /*** Addressing modes ***/
2109 2108 /* Register indirect with immediate index : EA = (rA|0) + SIMM */
2110   -static always_inline void gen_addr_imm_index (DisasContext *ctx,
  2109 +static always_inline void gen_addr_imm_index (TCGv EA,
  2110 + DisasContext *ctx,
2111 2111 target_long maskl)
2112 2112 {
2113 2113 target_long simm = SIMM(ctx->opcode);
2114 2114  
2115 2115 simm &= ~maskl;
2116   - if (rA(ctx->opcode) == 0) {
2117   - tcg_gen_movi_tl(cpu_T[0], simm);
2118   - } else {
2119   - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
2120   - if (likely(simm != 0))
2121   - tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm);
2122   - }
2123   -#ifdef DEBUG_MEMORY_ACCESSES
2124   - gen_op_print_mem_EA();
2125   -#endif
  2116 + if (rA(ctx->opcode) == 0)
  2117 + tcg_gen_movi_tl(EA, simm);
  2118 + else if (likely(simm != 0))
  2119 + tcg_gen_addi_tl(EA, cpu_gpr[rA(ctx->opcode)], simm);
  2120 + else
  2121 + tcg_gen_mov_tl(EA, cpu_gpr[rA(ctx->opcode)]);
2126 2122 }
2127 2123  
2128   -static always_inline void gen_addr_reg_index (DisasContext *ctx)
  2124 +static always_inline void gen_addr_reg_index (TCGv EA,
  2125 + DisasContext *ctx)
2129 2126 {
2130   - if (rA(ctx->opcode) == 0) {
2131   - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
2132   - } else {
2133   - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
2134   - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
2135   - tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
2136   - }
2137   -#ifdef DEBUG_MEMORY_ACCESSES
2138   - gen_op_print_mem_EA();
2139   -#endif
  2127 + if (rA(ctx->opcode) == 0)
  2128 + tcg_gen_mov_tl(EA, cpu_gpr[rB(ctx->opcode)]);
  2129 + else
  2130 + tcg_gen_add_tl(EA, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]);
2140 2131 }
2141 2132  
2142   -static always_inline void gen_addr_register (DisasContext *ctx)
  2133 +static always_inline void gen_addr_register (TCGv EA,
  2134 + DisasContext *ctx)
2143 2135 {
2144   - if (rA(ctx->opcode) == 0) {
2145   - tcg_gen_movi_tl(cpu_T[0], 0);
2146   - } else {
2147   - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
2148   - }
2149   -#ifdef DEBUG_MEMORY_ACCESSES
2150   - gen_op_print_mem_EA();
2151   -#endif
  2136 + if (rA(ctx->opcode) == 0)
  2137 + tcg_gen_movi_tl(EA, 0);
  2138 + else
  2139 + tcg_gen_mov_tl(EA, cpu_gpr[rA(ctx->opcode)]);
2152 2140 }
2153 2141  
2154 2142 #if defined(TARGET_PPC64)
... ... @@ -2213,7 +2201,7 @@ static GenOpFunc *gen_op_st##width[NB_MEM_FUNCS] = { \
2213 2201 #define GEN_LD(width, opc, type) \
2214 2202 GEN_HANDLER(l##width, opc, 0xFF, 0xFF, 0x00000000, type) \
2215 2203 { \
2216   - gen_addr_imm_index(ctx, 0); \
  2204 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2217 2205 op_ldst(l##width); \
2218 2206 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
2219 2207 }
... ... @@ -2227,9 +2215,9 @@ GEN_HANDLER(l##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
2227 2215 return; \
2228 2216 } \
2229 2217 if (type == PPC_64B) \
2230   - gen_addr_imm_index(ctx, 0x03); \
  2218 + gen_addr_imm_index(cpu_T[0], ctx, 0x03); \
2231 2219 else \
2232   - gen_addr_imm_index(ctx, 0); \
  2220 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2233 2221 op_ldst(l##width); \
2234 2222 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
2235 2223 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2243,7 +2231,7 @@ GEN_HANDLER(l##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \
2243 2231 GEN_EXCP_INVAL(ctx); \
2244 2232 return; \
2245 2233 } \
2246   - gen_addr_reg_index(ctx); \
  2234 + gen_addr_reg_index(cpu_T[0], ctx); \
2247 2235 op_ldst(l##width); \
2248 2236 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
2249 2237 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2252,7 +2240,7 @@ GEN_HANDLER(l##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \
2252 2240 #define GEN_LDX(width, opc2, opc3, type) \
2253 2241 GEN_HANDLER(l##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
2254 2242 { \
2255   - gen_addr_reg_index(ctx); \
  2243 + gen_addr_reg_index(cpu_T[0], ctx); \
2256 2244 op_ldst(l##width); \
2257 2245 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
2258 2246 }
... ... @@ -2292,7 +2280,7 @@ GEN_HANDLER(ld, 0x3A, 0xFF, 0xFF, 0x00000000, PPC_64B)
2292 2280 return;
2293 2281 }
2294 2282 }
2295   - gen_addr_imm_index(ctx, 0x03);
  2283 + gen_addr_imm_index(cpu_T[0], ctx, 0x03);
2296 2284 if (ctx->opcode & 0x02) {
2297 2285 /* lwa (lwau is undefined) */
2298 2286 op_ldst(lwa);
... ... @@ -2328,7 +2316,7 @@ GEN_HANDLER(lq, 0x38, 0xFF, 0xFF, 0x00000000, PPC_64BX)
2328 2316 GEN_EXCP(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);
2329 2317 return;
2330 2318 }
2331   - gen_addr_imm_index(ctx, 0x0F);
  2319 + gen_addr_imm_index(cpu_T[0], ctx, 0x0F);
2332 2320 op_ldst(ld);
2333 2321 tcg_gen_mov_tl(cpu_gpr[rd], cpu_T[1]);
2334 2322 tcg_gen_addi_tl(cpu_T[0], cpu_T[0], 8);
... ... @@ -2342,7 +2330,7 @@ GEN_HANDLER(lq, 0x38, 0xFF, 0xFF, 0x00000000, PPC_64BX)
2342 2330 #define GEN_ST(width, opc, type) \
2343 2331 GEN_HANDLER(st##width, opc, 0xFF, 0xFF, 0x00000000, type) \
2344 2332 { \
2345   - gen_addr_imm_index(ctx, 0); \
  2333 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2346 2334 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
2347 2335 op_ldst(st##width); \
2348 2336 }
... ... @@ -2355,9 +2343,9 @@ GEN_HANDLER(st##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
2355 2343 return; \
2356 2344 } \
2357 2345 if (type == PPC_64B) \
2358   - gen_addr_imm_index(ctx, 0x03); \
  2346 + gen_addr_imm_index(cpu_T[0], ctx, 0x03); \
2359 2347 else \
2360   - gen_addr_imm_index(ctx, 0); \
  2348 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2361 2349 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
2362 2350 op_ldst(st##width); \
2363 2351 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2370,7 +2358,7 @@ GEN_HANDLER(st##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \
2370 2358 GEN_EXCP_INVAL(ctx); \
2371 2359 return; \
2372 2360 } \
2373   - gen_addr_reg_index(ctx); \
  2361 + gen_addr_reg_index(cpu_T[0], ctx); \
2374 2362 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
2375 2363 op_ldst(st##width); \
2376 2364 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2379,7 +2367,7 @@ GEN_HANDLER(st##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \
2379 2367 #define GEN_STX(width, opc2, opc3, type) \
2380 2368 GEN_HANDLER(st##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
2381 2369 { \
2382   - gen_addr_reg_index(ctx); \
  2370 + gen_addr_reg_index(cpu_T[0], ctx); \
2383 2371 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
2384 2372 op_ldst(st##width); \
2385 2373 }
... ... @@ -2424,7 +2412,7 @@ GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64B)
2424 2412 GEN_EXCP(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);
2425 2413 return;
2426 2414 }
2427   - gen_addr_imm_index(ctx, 0x03);
  2415 + gen_addr_imm_index(cpu_T[0], ctx, 0x03);
2428 2416 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rs]);
2429 2417 op_ldst(std);
2430 2418 tcg_gen_addi_tl(cpu_T[0], cpu_T[0], 8);
... ... @@ -2439,7 +2427,7 @@ GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64B)
2439 2427 return;
2440 2428 }
2441 2429 }
2442   - gen_addr_imm_index(ctx, 0x03);
  2430 + gen_addr_imm_index(cpu_T[0], ctx, 0x03);
2443 2431 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rs]);
2444 2432 op_ldst(std);
2445 2433 if (Rc(ctx->opcode))
... ... @@ -2475,7 +2463,7 @@ GEN_HANDLER(lmw, 0x2E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
2475 2463 {
2476 2464 /* NIP cannot be restored if the memory exception comes from an helper */
2477 2465 gen_update_nip(ctx, ctx->nip - 4);
2478   - gen_addr_imm_index(ctx, 0);
  2466 + gen_addr_imm_index(cpu_T[0], ctx, 0);
2479 2467 op_ldstm(lmw, rD(ctx->opcode));
2480 2468 }
2481 2469  
... ... @@ -2484,7 +2472,7 @@ GEN_HANDLER(stmw, 0x2F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
2484 2472 {
2485 2473 /* NIP cannot be restored if the memory exception comes from an helper */
2486 2474 gen_update_nip(ctx, ctx->nip - 4);
2487   - gen_addr_imm_index(ctx, 0);
  2475 + gen_addr_imm_index(cpu_T[0], ctx, 0);
2488 2476 op_ldstm(stmw, rS(ctx->opcode));
2489 2477 }
2490 2478  
... ... @@ -2551,7 +2539,7 @@ GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001, PPC_STRING)
2551 2539 }
2552 2540 /* NIP cannot be restored if the memory exception comes from an helper */
2553 2541 gen_update_nip(ctx, ctx->nip - 4);
2554   - gen_addr_register(ctx);
  2542 + gen_addr_register(cpu_T[0], ctx);
2555 2543 tcg_gen_movi_tl(cpu_T[1], nb);
2556 2544 op_ldsts(lswi, start);
2557 2545 }
... ... @@ -2564,7 +2552,7 @@ GEN_HANDLER(lswx, 0x1F, 0x15, 0x10, 0x00000001, PPC_STRING)
2564 2552  
2565 2553 /* NIP cannot be restored if the memory exception comes from an helper */
2566 2554 gen_update_nip(ctx, ctx->nip - 4);
2567   - gen_addr_reg_index(ctx);
  2555 + gen_addr_reg_index(cpu_T[0], ctx);
2568 2556 if (ra == 0) {
2569 2557 ra = rb;
2570 2558 }
... ... @@ -2579,7 +2567,7 @@ GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_STRING)
2579 2567  
2580 2568 /* NIP cannot be restored if the memory exception comes from an helper */
2581 2569 gen_update_nip(ctx, ctx->nip - 4);
2582   - gen_addr_register(ctx);
  2570 + gen_addr_register(cpu_T[0], ctx);
2583 2571 if (nb == 0)
2584 2572 nb = 32;
2585 2573 tcg_gen_movi_tl(cpu_T[1], nb);
... ... @@ -2591,7 +2579,7 @@ GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_STRING)
2591 2579 {
2592 2580 /* NIP cannot be restored if the memory exception comes from an helper */
2593 2581 gen_update_nip(ctx, ctx->nip - 4);
2594   - gen_addr_reg_index(ctx);
  2582 + gen_addr_reg_index(cpu_T[0], ctx);
2595 2583 gen_op_load_xer_bc();
2596 2584 op_ldsts(stsw, rS(ctx->opcode));
2597 2585 }
... ... @@ -2622,7 +2610,7 @@ GEN_HANDLER(lwarx, 0x1F, 0x14, 0x00, 0x00000001, PPC_RES)
2622 2610 {
2623 2611 /* NIP cannot be restored if the memory exception comes from an helper */
2624 2612 gen_update_nip(ctx, ctx->nip - 4);
2625   - gen_addr_reg_index(ctx);
  2613 + gen_addr_reg_index(cpu_T[0], ctx);
2626 2614 op_lwarx();
2627 2615 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]);
2628 2616 }
... ... @@ -2632,7 +2620,7 @@ GEN_HANDLER2(stwcx_, &quot;stwcx.&quot;, 0x1F, 0x16, 0x04, 0x00000000, PPC_RES)
2632 2620 {
2633 2621 /* NIP cannot be restored if the memory exception comes from an helper */
2634 2622 gen_update_nip(ctx, ctx->nip - 4);
2635   - gen_addr_reg_index(ctx);
  2623 + gen_addr_reg_index(cpu_T[0], ctx);
2636 2624 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
2637 2625 op_stwcx();
2638 2626 }
... ... @@ -2652,7 +2640,7 @@ GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_64B)
2652 2640 {
2653 2641 /* NIP cannot be restored if the memory exception comes from an helper */
2654 2642 gen_update_nip(ctx, ctx->nip - 4);
2655   - gen_addr_reg_index(ctx);
  2643 + gen_addr_reg_index(cpu_T[0], ctx);
2656 2644 op_ldarx();
2657 2645 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]);
2658 2646 }
... ... @@ -2662,7 +2650,7 @@ GEN_HANDLER2(stdcx_, &quot;stdcx.&quot;, 0x1F, 0x16, 0x06, 0x00000000, PPC_64B)
2662 2650 {
2663 2651 /* NIP cannot be restored if the memory exception comes from an helper */
2664 2652 gen_update_nip(ctx, ctx->nip - 4);
2665   - gen_addr_reg_index(ctx);
  2653 + gen_addr_reg_index(cpu_T[0], ctx);
2666 2654 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
2667 2655 op_stdcx();
2668 2656 }
... ... @@ -2689,7 +2677,7 @@ GEN_HANDLER(l##width, opc, 0xFF, 0xFF, 0x00000000, type) \
2689 2677 GEN_EXCP_NO_FP(ctx); \
2690 2678 return; \
2691 2679 } \
2692   - gen_addr_imm_index(ctx, 0); \
  2680 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2693 2681 op_ldst(l##width); \
2694 2682 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
2695 2683 }
... ... @@ -2705,7 +2693,7 @@ GEN_HANDLER(l##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
2705 2693 GEN_EXCP_INVAL(ctx); \
2706 2694 return; \
2707 2695 } \
2708   - gen_addr_imm_index(ctx, 0); \
  2696 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2709 2697 op_ldst(l##width); \
2710 2698 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
2711 2699 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2722,7 +2710,7 @@ GEN_HANDLER(l##width##ux, 0x1F, 0x17, opc, 0x00000001, type) \
2722 2710 GEN_EXCP_INVAL(ctx); \
2723 2711 return; \
2724 2712 } \
2725   - gen_addr_reg_index(ctx); \
  2713 + gen_addr_reg_index(cpu_T[0], ctx); \
2726 2714 op_ldst(l##width); \
2727 2715 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
2728 2716 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2735,7 +2723,7 @@ GEN_HANDLER(l##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
2735 2723 GEN_EXCP_NO_FP(ctx); \
2736 2724 return; \
2737 2725 } \
2738   - gen_addr_reg_index(ctx); \
  2726 + gen_addr_reg_index(cpu_T[0], ctx); \
2739 2727 op_ldst(l##width); \
2740 2728 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
2741 2729 }
... ... @@ -2760,7 +2748,7 @@ GEN_HANDLER(st##width, opc, 0xFF, 0xFF, 0x00000000, type) \
2760 2748 GEN_EXCP_NO_FP(ctx); \
2761 2749 return; \
2762 2750 } \
2763   - gen_addr_imm_index(ctx, 0); \
  2751 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2764 2752 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
2765 2753 op_ldst(st##width); \
2766 2754 }
... ... @@ -2776,7 +2764,7 @@ GEN_HANDLER(st##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
2776 2764 GEN_EXCP_INVAL(ctx); \
2777 2765 return; \
2778 2766 } \
2779   - gen_addr_imm_index(ctx, 0); \
  2767 + gen_addr_imm_index(cpu_T[0], ctx, 0); \
2780 2768 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
2781 2769 op_ldst(st##width); \
2782 2770 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2793,7 +2781,7 @@ GEN_HANDLER(st##width##ux, 0x1F, 0x17, opc, 0x00000001, type) \
2793 2781 GEN_EXCP_INVAL(ctx); \
2794 2782 return; \
2795 2783 } \
2796   - gen_addr_reg_index(ctx); \
  2784 + gen_addr_reg_index(cpu_T[0], ctx); \
2797 2785 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
2798 2786 op_ldst(st##width); \
2799 2787 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
... ... @@ -2806,7 +2794,7 @@ GEN_HANDLER(st##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
2806 2794 GEN_EXCP_NO_FP(ctx); \
2807 2795 return; \
2808 2796 } \
2809   - gen_addr_reg_index(ctx); \
  2797 + gen_addr_reg_index(cpu_T[0], ctx); \
2810 2798 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
2811 2799 op_ldst(st##width); \
2812 2800 }
... ... @@ -3456,7 +3444,7 @@ GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000001, PPC_MISC)
3456 3444 GEN_HANDLER(dcbf, 0x1F, 0x16, 0x02, 0x03C00001, PPC_CACHE)
3457 3445 {
3458 3446 /* XXX: specification says this is treated as a load by the MMU */
3459   - gen_addr_reg_index(ctx);
  3447 + gen_addr_reg_index(cpu_T[0], ctx);
3460 3448 op_ldst(lbz);
3461 3449 }
3462 3450  
... ... @@ -3470,7 +3458,7 @@ GEN_HANDLER(dcbi, 0x1F, 0x16, 0x0E, 0x03E00001, PPC_CACHE)
3470 3458 GEN_EXCP_PRIVOPC(ctx);
3471 3459 return;
3472 3460 }
3473   - gen_addr_reg_index(ctx);
  3461 + gen_addr_reg_index(cpu_T[0], ctx);
3474 3462 /* XXX: specification says this should be treated as a store by the MMU */
3475 3463 op_ldst(lbz);
3476 3464 op_ldst(stb);
... ... @@ -3481,7 +3469,7 @@ GEN_HANDLER(dcbi, 0x1F, 0x16, 0x0E, 0x03E00001, PPC_CACHE)
3481 3469 GEN_HANDLER(dcbst, 0x1F, 0x16, 0x01, 0x03E00001, PPC_CACHE)
3482 3470 {
3483 3471 /* XXX: specification say this is treated as a load by the MMU */
3484   - gen_addr_reg_index(ctx);
  3472 + gen_addr_reg_index(cpu_T[0], ctx);
3485 3473 op_ldst(lbz);
3486 3474 }
3487 3475  
... ... @@ -3580,14 +3568,14 @@ static always_inline void handler_dcbz (DisasContext *ctx,
3580 3568  
3581 3569 GEN_HANDLER(dcbz, 0x1F, 0x16, 0x1F, 0x03E00001, PPC_CACHE_DCBZ)
3582 3570 {
3583   - gen_addr_reg_index(ctx);
  3571 + gen_addr_reg_index(cpu_T[0], ctx);
3584 3572 handler_dcbz(ctx, ctx->dcache_line_size);
3585 3573 gen_op_check_reservation();
3586 3574 }
3587 3575  
3588 3576 GEN_HANDLER2(dcbz_970, "dcbz", 0x1F, 0x16, 0x1F, 0x03C00001, PPC_CACHE_DCBZT)
3589 3577 {
3590   - gen_addr_reg_index(ctx);
  3578 + gen_addr_reg_index(cpu_T[0], ctx);
3591 3579 if (ctx->opcode & 0x00200000)
3592 3580 handler_dcbz(ctx, ctx->dcache_line_size);
3593 3581 else
... ... @@ -3613,7 +3601,7 @@ GEN_HANDLER(icbi, 0x1F, 0x16, 0x1E, 0x03E00001, PPC_CACHE_ICBI)
3613 3601 {
3614 3602 /* NIP cannot be restored if the memory exception comes from an helper */
3615 3603 gen_update_nip(ctx, ctx->nip - 4);
3616   - gen_addr_reg_index(ctx);
  3604 + gen_addr_reg_index(cpu_T[0], ctx);
3617 3605 op_icbi();
3618 3606 }
3619 3607  
... ... @@ -3865,7 +3853,7 @@ static GenOpFunc *gen_op_ecowx[NB_MEM_FUNCS] = {
3865 3853 GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN)
3866 3854 {
3867 3855 /* Should check EAR[E] & alignment ! */
3868   - gen_addr_reg_index(ctx);
  3856 + gen_addr_reg_index(cpu_T[0], ctx);
3869 3857 op_eciwx();
3870 3858 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
3871 3859 }
... ... @@ -3874,7 +3862,7 @@ GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN)
3874 3862 GEN_HANDLER(ecowx, 0x1F, 0x16, 0x09, 0x00000001, PPC_EXTERN)
3875 3863 {
3876 3864 /* Should check EAR[E] & alignment ! */
3877   - gen_addr_reg_index(ctx);
  3865 + gen_addr_reg_index(cpu_T[0], ctx);
3878 3866 tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
3879 3867 op_ecowx();
3880 3868 }
... ... @@ -4011,7 +3999,7 @@ GEN_HANDLER(lscbx, 0x1F, 0x15, 0x08, 0x00000000, PPC_POWER_BR)
4011 3999 int ra = rA(ctx->opcode);
4012 4000 int rb = rB(ctx->opcode);
4013 4001  
4014   - gen_addr_reg_index(ctx);
  4002 + gen_addr_reg_index(cpu_T[0], ctx);
4015 4003 if (ra == 0) {
4016 4004 ra = rb;
4017 4005 }
... ... @@ -4416,7 +4404,7 @@ GEN_HANDLER(mfsri, 0x1F, 0x13, 0x13, 0x00000001, PPC_POWER)
4416 4404 int ra = rA(ctx->opcode);
4417 4405 int rd = rD(ctx->opcode);
4418 4406  
4419   - gen_addr_reg_index(ctx);
  4407 + gen_addr_reg_index(cpu_T[0], ctx);
4420 4408 gen_op_POWER_mfsri();
4421 4409 tcg_gen_mov_tl(cpu_gpr[rd], cpu_T[0]);
4422 4410 if (ra != 0 && ra != rd)
... ... @@ -4433,7 +4421,7 @@ GEN_HANDLER(rac, 0x1F, 0x12, 0x19, 0x00000001, PPC_POWER)
4433 4421 GEN_EXCP_PRIVOPC(ctx);
4434 4422 return;
4435 4423 }
4436   - gen_addr_reg_index(ctx);
  4424 + gen_addr_reg_index(cpu_T[0], ctx);
4437 4425 gen_op_POWER_rac();
4438 4426 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
4439 4427 #endif
... ... @@ -4488,7 +4476,7 @@ GEN_HANDLER(lfq, 0x38, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
4488 4476 {
4489 4477 /* NIP cannot be restored if the memory exception comes from an helper */
4490 4478 gen_update_nip(ctx, ctx->nip - 4);
4491   - gen_addr_imm_index(ctx, 0);
  4479 + gen_addr_imm_index(cpu_T[0], ctx, 0);
4492 4480 op_POWER2_lfq();
4493 4481 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
4494 4482 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
... ... @@ -4501,7 +4489,7 @@ GEN_HANDLER(lfqu, 0x39, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
4501 4489  
4502 4490 /* NIP cannot be restored if the memory exception comes from an helper */
4503 4491 gen_update_nip(ctx, ctx->nip - 4);
4504   - gen_addr_imm_index(ctx, 0);
  4492 + gen_addr_imm_index(cpu_T[0], ctx, 0);
4505 4493 op_POWER2_lfq();
4506 4494 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
4507 4495 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
... ... @@ -4516,7 +4504,7 @@ GEN_HANDLER(lfqux, 0x1F, 0x17, 0x19, 0x00000001, PPC_POWER2)
4516 4504  
4517 4505 /* NIP cannot be restored if the memory exception comes from an helper */
4518 4506 gen_update_nip(ctx, ctx->nip - 4);
4519   - gen_addr_reg_index(ctx);
  4507 + gen_addr_reg_index(cpu_T[0], ctx);
4520 4508 op_POWER2_lfq();
4521 4509 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
4522 4510 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
... ... @@ -4529,7 +4517,7 @@ GEN_HANDLER(lfqx, 0x1F, 0x17, 0x18, 0x00000001, PPC_POWER2)
4529 4517 {
4530 4518 /* NIP cannot be restored if the memory exception comes from an helper */
4531 4519 gen_update_nip(ctx, ctx->nip - 4);
4532   - gen_addr_reg_index(ctx);
  4520 + gen_addr_reg_index(cpu_T[0], ctx);
4533 4521 op_POWER2_lfq();
4534 4522 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
4535 4523 tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
... ... @@ -4540,7 +4528,7 @@ GEN_HANDLER(stfq, 0x3C, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
4540 4528 {
4541 4529 /* NIP cannot be restored if the memory exception comes from an helper */
4542 4530 gen_update_nip(ctx, ctx->nip - 4);
4543   - gen_addr_imm_index(ctx, 0);
  4531 + gen_addr_imm_index(cpu_T[0], ctx, 0);
4544 4532 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
4545 4533 tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
4546 4534 op_POWER2_stfq();
... ... @@ -4553,7 +4541,7 @@ GEN_HANDLER(stfqu, 0x3D, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
4553 4541  
4554 4542 /* NIP cannot be restored if the memory exception comes from an helper */
4555 4543 gen_update_nip(ctx, ctx->nip - 4);
4556   - gen_addr_imm_index(ctx, 0);
  4544 + gen_addr_imm_index(cpu_T[0], ctx, 0);
4557 4545 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
4558 4546 tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
4559 4547 op_POWER2_stfq();
... ... @@ -4568,7 +4556,7 @@ GEN_HANDLER(stfqux, 0x1F, 0x17, 0x1D, 0x00000001, PPC_POWER2)
4568 4556  
4569 4557 /* NIP cannot be restored if the memory exception comes from an helper */
4570 4558 gen_update_nip(ctx, ctx->nip - 4);
4571   - gen_addr_reg_index(ctx);
  4559 + gen_addr_reg_index(cpu_T[0], ctx);
4572 4560 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
4573 4561 tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
4574 4562 op_POWER2_stfq();
... ... @@ -4581,7 +4569,7 @@ GEN_HANDLER(stfqx, 0x1F, 0x17, 0x1C, 0x00000001, PPC_POWER2)
4581 4569 {
4582 4570 /* NIP cannot be restored if the memory exception comes from an helper */
4583 4571 gen_update_nip(ctx, ctx->nip - 4);
4584   - gen_addr_reg_index(ctx);
  4572 + gen_addr_reg_index(cpu_T[0], ctx);
4585 4573 tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
4586 4574 tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
4587 4575 op_POWER2_stfq();
... ... @@ -4605,7 +4593,7 @@ GEN_HANDLER(tlbiva, 0x1F, 0x12, 0x18, 0x03FFF801, PPC_TLBIVA)
4605 4593 GEN_EXCP_PRIVOPC(ctx);
4606 4594 return;
4607 4595 }
4608   - gen_addr_reg_index(ctx);
  4596 + gen_addr_reg_index(cpu_T[0], ctx);
4609 4597 /* Use the same micro-ops as for tlbie */
4610 4598 #if defined(TARGET_PPC64)
4611 4599 if (ctx->sf_mode)
... ... @@ -4905,7 +4893,7 @@ GEN_HANDLER(dcread, 0x1F, 0x06, 0x0F, 0x00000001, PPC_4xx_COMMON)
4905 4893 GEN_EXCP_PRIVOPC(ctx);
4906 4894 return;
4907 4895 }
4908   - gen_addr_reg_index(ctx);
  4896 + gen_addr_reg_index(cpu_T[0], ctx);
4909 4897 op_ldst(lwz);
4910 4898 tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
4911 4899 #endif
... ... @@ -5051,7 +5039,7 @@ GEN_HANDLER2(tlbsx_40x, &quot;tlbsx&quot;, 0x1F, 0x12, 0x1C, 0x00000000, PPC_40x_TLB)
5051 5039 GEN_EXCP_PRIVOPC(ctx);
5052 5040 return;
5053 5041 }
5054   - gen_addr_reg_index(ctx);
  5042 + gen_addr_reg_index(cpu_T[0], ctx);
5055 5043 gen_op_4xx_tlbsx();
5056 5044 if (Rc(ctx->opcode))
5057 5045 gen_op_4xx_tlbsx_check();
... ... @@ -5123,7 +5111,7 @@ GEN_HANDLER2(tlbsx_440, &quot;tlbsx&quot;, 0x1F, 0x12, 0x1C, 0x00000000, PPC_BOOKE)
5123 5111 GEN_EXCP_PRIVOPC(ctx);
5124 5112 return;
5125 5113 }
5126   - gen_addr_reg_index(ctx);
  5114 + gen_addr_reg_index(cpu_T[0], ctx);
5127 5115 gen_op_440_tlbsx();
5128 5116 if (Rc(ctx->opcode))
5129 5117 gen_op_4xx_tlbsx_check();
... ... @@ -5260,7 +5248,7 @@ GEN_HANDLER(l##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC) \
5260 5248 GEN_EXCP_NO_VR(ctx); \
5261 5249 return; \
5262 5250 } \
5263   - gen_addr_reg_index(ctx); \
  5251 + gen_addr_reg_index(cpu_T[0], ctx); \
5264 5252 op_vr_ldst(vr_l##name); \
5265 5253 gen_store_avr(rD(ctx->opcode), 0); \
5266 5254 }
... ... @@ -5272,7 +5260,7 @@ GEN_HANDLER(st##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC) \
5272 5260 GEN_EXCP_NO_VR(ctx); \
5273 5261 return; \
5274 5262 } \
5275   - gen_addr_reg_index(ctx); \
  5263 + gen_addr_reg_index(cpu_T[0], ctx); \
5276 5264 gen_load_avr(0, rS(ctx->opcode)); \
5277 5265 op_vr_ldst(vr_st##name); \
5278 5266 }
... ... @@ -5370,7 +5358,7 @@ static always_inline void gen_evl##name##x (DisasContext *ctx) \
5370 5358 GEN_EXCP_NO_AP(ctx); \
5371 5359 return; \
5372 5360 } \
5373   - gen_addr_reg_index(ctx); \
  5361 + gen_addr_reg_index(cpu_T[0], ctx); \
5374 5362 op_spe_ldst(spe_l##name); \
5375 5363 gen_store_gpr64(rD(ctx->opcode), cpu_T64[1]); \
5376 5364 }
... ... @@ -5399,7 +5387,7 @@ static always_inline void gen_evst##name##x (DisasContext *ctx) \
5399 5387 GEN_EXCP_NO_AP(ctx); \
5400 5388 return; \
5401 5389 } \
5402   - gen_addr_reg_index(ctx); \
  5390 + gen_addr_reg_index(cpu_T[0], ctx); \
5403 5391 gen_load_gpr64(cpu_T64[1], rS(ctx->opcode)); \
5404 5392 op_spe_ldst(spe_st##name); \
5405 5393 }
... ...