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