Commit 7863667f35531557f10e7f920e4361f621a14e3f

Authored by j_mayer
1 parent 2f619698

Always make PowerPC hypervisor mode memory accesses and instructions

available for full system emulation, then removing all #if TARGET_PPC64H
  from micro-ops and code translator.
Add new macros to dramatically simplify memory access tables definitions
  in target-ppc/translate.c.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3654 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/cpu.h
... ... @@ -305,11 +305,9 @@ struct ppc_spr_t {
305 305 #if !defined(CONFIG_USER_ONLY)
306 306 void (*oea_read)(void *opaque, int spr_num);
307 307 void (*oea_write)(void *opaque, int spr_num);
308   -#if defined(TARGET_PPC64H)
309 308 void (*hea_read)(void *opaque, int spr_num);
310 309 void (*hea_write)(void *opaque, int spr_num);
311 310 #endif
312   -#endif
313 311 const unsigned char *name;
314 312 };
315 313  
... ... @@ -510,11 +508,7 @@ enum {
510 508  
511 509 /*****************************************************************************/
512 510 /* The whole PowerPC CPU context */
513   -#if defined(TARGET_PPC64H)
514 511 #define NB_MMU_MODES 3
515   -#else
516   -#define NB_MMU_MODES 2
517   -#endif
518 512  
519 513 struct CPUPPCState {
520 514 /* First are the most commonly used resources
... ... @@ -783,9 +777,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val);
783 777 /* MMU modes definitions */
784 778 #define MMU_MODE0_SUFFIX _user
785 779 #define MMU_MODE1_SUFFIX _kernel
786   -#if defined(TARGET_PPC64H)
787 780 #define MMU_MODE2_SUFFIX _hypv
788   -#endif
789 781 #define MMU_USER_IDX 0
790 782 static inline int cpu_mmu_index (CPUState *env)
791 783 {
... ...
target-ppc/op.c
... ... @@ -1987,12 +1987,10 @@ void OPPROTO op_fneg (void)
1987 1987 #define MEMSUFFIX _kernel
1988 1988 #include "op_helper.h"
1989 1989 #include "op_mem.h"
1990   -#if defined(TARGET_PPC64H)
1991 1990 #define MEMSUFFIX _hypv
1992 1991 #include "op_helper.h"
1993 1992 #include "op_mem.h"
1994 1993 #endif
1995   -#endif
1996 1994  
1997 1995 /* Special op to check and maybe clear reservation */
1998 1996 void OPPROTO op_check_reservation (void)
... ... @@ -2031,9 +2029,7 @@ void OPPROTO op_rfid (void)
2031 2029 do_rfid();
2032 2030 RETURN();
2033 2031 }
2034   -#endif
2035 2032  
2036   -#if defined(TARGET_PPC64H)
2037 2033 void OPPROTO op_hrfid (void)
2038 2034 {
2039 2035 do_hrfid();
... ...
target-ppc/op_helper.c
... ... @@ -33,12 +33,10 @@
33 33 #define MEMSUFFIX _kernel
34 34 #include "op_helper.h"
35 35 #include "op_helper_mem.h"
36   -#if defined(TARGET_PPC64H)
37 36 #define MEMSUFFIX _hypv
38 37 #include "op_helper.h"
39 38 #include "op_helper_mem.h"
40 39 #endif
41   -#endif
42 40  
43 41 //#define DEBUG_OP
44 42 //#define DEBUG_EXCEPTIONS
... ... @@ -1475,8 +1473,7 @@ void do_rfid (void)
1475 1473 __do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
1476 1474 ~((target_ulong)0xFFFF0000), 0);
1477 1475 }
1478   -#endif
1479   -#if defined(TARGET_PPC64H)
  1476 +
1480 1477 void do_hrfid (void)
1481 1478 {
1482 1479 __do_rfi(env->spr[SPR_HSRR0], env->spr[SPR_HSRR1],
... ...
target-ppc/op_helper.h
... ... @@ -146,8 +146,6 @@ void do_store_msr (void);
146 146 void do_rfi (void);
147 147 #if defined(TARGET_PPC64)
148 148 void do_rfid (void);
149   -#endif
150   -#if defined(TARGET_PPC64H)
151 149 void do_hrfid (void);
152 150 #endif
153 151 void do_load_6xx_tlb (int is_code);
... ...
target-ppc/translate.c
... ... @@ -1250,7 +1250,6 @@ GEN_HANDLER(or, 0x1F, 0x1C, 0x0D, 0x00000000, PPC_INTEGER)
1250 1250 gen_op_store_pri(6);
1251 1251 }
1252 1252 break;
1253   -#if defined(TARGET_PPC64H)
1254 1253 case 7:
1255 1254 if (ctx->supervisor > 1) {
1256 1255 /* Set process priority to very high */
... ... @@ -1258,7 +1257,6 @@ GEN_HANDLER(or, 0x1F, 0x1C, 0x0D, 0x00000000, PPC_INTEGER)
1258 1257 }
1259 1258 break;
1260 1259 #endif
1261   -#endif
1262 1260 default:
1263 1261 /* nop */
1264 1262 break;
... ... @@ -2103,136 +2101,64 @@ static always_inline void gen_addr_register (DisasContext *ctx)
2103 2101 #endif
2104 2102 }
2105 2103  
2106   -/*** Integer load ***/
2107   -#define op_ldst(name) (*gen_op_##name[ctx->mem_idx])()
  2104 +#if defined(TARGET_PPC64)
  2105 +#define _GEN_MEM_FUNCS(name, mode) \
  2106 + &gen_op_##name##_##mode, \
  2107 + &gen_op_##name##_le_##mode, \
  2108 + &gen_op_##name##_64_##mode, \
  2109 + &gen_op_##name##_le_64_##mode
  2110 +#else
  2111 +#define _GEN_MEM_FUNCS(name, mode) \
  2112 + &gen_op_##name##_##mode, \
  2113 + &gen_op_##name##_le_##mode
  2114 +#endif
2108 2115 #if defined(CONFIG_USER_ONLY)
2109 2116 #if defined(TARGET_PPC64)
2110   -/* User mode only - 64 bits */
2111   -#define OP_LD_TABLE(width) \
2112   -static GenOpFunc *gen_op_l##width[] = { \
2113   - &gen_op_l##width##_raw, \
2114   - &gen_op_l##width##_le_raw, \
2115   - &gen_op_l##width##_64_raw, \
2116   - &gen_op_l##width##_le_64_raw, \
2117   -};
2118   -#define OP_ST_TABLE(width) \
2119   -static GenOpFunc *gen_op_st##width[] = { \
2120   - &gen_op_st##width##_raw, \
2121   - &gen_op_st##width##_le_raw, \
2122   - &gen_op_st##width##_64_raw, \
2123   - &gen_op_st##width##_le_64_raw, \
2124   -};
2125   -/* Byte access routine are endian safe */
2126   -#define gen_op_stb_le_64_raw gen_op_stb_64_raw
2127   -#define gen_op_lbz_le_64_raw gen_op_lbz_64_raw
  2117 +#define NB_MEM_FUNCS 4
2128 2118 #else
2129   -/* User mode only - 32 bits */
2130   -#define OP_LD_TABLE(width) \
2131   -static GenOpFunc *gen_op_l##width[] = { \
2132   - &gen_op_l##width##_raw, \
2133   - &gen_op_l##width##_le_raw, \
2134   -};
2135   -#define OP_ST_TABLE(width) \
2136   -static GenOpFunc *gen_op_st##width[] = { \
2137   - &gen_op_st##width##_raw, \
2138   - &gen_op_st##width##_le_raw, \
2139   -};
  2119 +#define NB_MEM_FUNCS 2
2140 2120 #endif
2141   -/* Byte access routine are endian safe */
2142   -#define gen_op_stb_le_raw gen_op_stb_raw
2143   -#define gen_op_lbz_le_raw gen_op_lbz_raw
  2121 +#define GEN_MEM_FUNCS(name) \
  2122 + _GEN_MEM_FUNCS(name, raw)
2144 2123 #else
2145 2124 #if defined(TARGET_PPC64)
2146   -#if defined(TARGET_PPC64H)
2147   -/* Full system - 64 bits with hypervisor mode */
2148   -#define OP_LD_TABLE(width) \
2149   -static GenOpFunc *gen_op_l##width[] = { \
2150   - &gen_op_l##width##_user, \
2151   - &gen_op_l##width##_le_user, \
2152   - &gen_op_l##width##_64_user, \
2153   - &gen_op_l##width##_le_64_user, \
2154   - &gen_op_l##width##_kernel, \
2155   - &gen_op_l##width##_le_kernel, \
2156   - &gen_op_l##width##_64_kernel, \
2157   - &gen_op_l##width##_le_64_kernel, \
2158   - &gen_op_l##width##_hypv, \
2159   - &gen_op_l##width##_le_hypv, \
2160   - &gen_op_l##width##_64_hypv, \
2161   - &gen_op_l##width##_le_64_hypv, \
2162   -};
2163   -#define OP_ST_TABLE(width) \
2164   -static GenOpFunc *gen_op_st##width[] = { \
2165   - &gen_op_st##width##_user, \
2166   - &gen_op_st##width##_le_user, \
2167   - &gen_op_st##width##_64_user, \
2168   - &gen_op_st##width##_le_64_user, \
2169   - &gen_op_st##width##_kernel, \
2170   - &gen_op_st##width##_le_kernel, \
2171   - &gen_op_st##width##_64_kernel, \
2172   - &gen_op_st##width##_le_64_kernel, \
2173   - &gen_op_st##width##_hypv, \
2174   - &gen_op_st##width##_le_hypv, \
2175   - &gen_op_st##width##_64_hypv, \
2176   - &gen_op_st##width##_le_64_hypv, \
2177   -};
2178   -/* Byte access routine are endian safe */
2179   -#define gen_op_stb_le_hypv gen_op_stb_64_hypv
2180   -#define gen_op_lbz_le_hypv gen_op_lbz_64_hypv
2181   -#define gen_op_stb_le_64_hypv gen_op_stb_64_hypv
2182   -#define gen_op_lbz_le_64_hypv gen_op_lbz_64_hypv
  2125 +#define NB_MEM_FUNCS 12
2183 2126 #else
2184   -/* Full system - 64 bits */
2185   -#define OP_LD_TABLE(width) \
2186   -static GenOpFunc *gen_op_l##width[] = { \
2187   - &gen_op_l##width##_user, \
2188   - &gen_op_l##width##_le_user, \
2189   - &gen_op_l##width##_64_user, \
2190   - &gen_op_l##width##_le_64_user, \
2191   - &gen_op_l##width##_kernel, \
2192   - &gen_op_l##width##_le_kernel, \
2193   - &gen_op_l##width##_64_kernel, \
2194   - &gen_op_l##width##_le_64_kernel, \
2195   -};
2196   -#define OP_ST_TABLE(width) \
2197   -static GenOpFunc *gen_op_st##width[] = { \
2198   - &gen_op_st##width##_user, \
2199   - &gen_op_st##width##_le_user, \
2200   - &gen_op_st##width##_64_user, \
2201   - &gen_op_st##width##_le_64_user, \
2202   - &gen_op_st##width##_kernel, \
2203   - &gen_op_st##width##_le_kernel, \
2204   - &gen_op_st##width##_64_kernel, \
2205   - &gen_op_st##width##_le_64_kernel, \
2206   -};
  2127 +#define NB_MEM_FUNCS 6
2207 2128 #endif
  2129 +#define GEN_MEM_FUNCS(name) \
  2130 + _GEN_MEM_FUNCS(name, user), \
  2131 + _GEN_MEM_FUNCS(name, kernel), \
  2132 + _GEN_MEM_FUNCS(name, hypv)
  2133 +#endif
  2134 +
  2135 +/*** Integer load ***/
  2136 +#define op_ldst(name) (*gen_op_##name[ctx->mem_idx])()
2208 2137 /* Byte access routine are endian safe */
2209   -#define gen_op_stb_le_64_user gen_op_stb_64_user
  2138 +#define gen_op_lbz_le_raw gen_op_lbz_raw
  2139 +#define gen_op_lbz_le_user gen_op_lbz_user
  2140 +#define gen_op_lbz_le_kernel gen_op_lbz_kernel
  2141 +#define gen_op_lbz_le_hypv gen_op_lbz_hypv
  2142 +#define gen_op_lbz_le_64_raw gen_op_lbz_64_raw
2210 2143 #define gen_op_lbz_le_64_user gen_op_lbz_64_user
2211   -#define gen_op_stb_le_64_kernel gen_op_stb_64_kernel
2212 2144 #define gen_op_lbz_le_64_kernel gen_op_lbz_64_kernel
2213   -#else
2214   -/* Full system - 32 bits */
  2145 +#define gen_op_lbz_le_64_hypv gen_op_lbz_64_hypv
  2146 +#define gen_op_stb_le_raw gen_op_stb_raw
  2147 +#define gen_op_stb_le_user gen_op_stb_user
  2148 +#define gen_op_stb_le_kernel gen_op_stb_kernel
  2149 +#define gen_op_stb_le_hypv gen_op_stb_hypv
  2150 +#define gen_op_stb_le_64_raw gen_op_stb_64_raw
  2151 +#define gen_op_stb_le_64_user gen_op_stb_64_user
  2152 +#define gen_op_stb_le_64_kernel gen_op_stb_64_kernel
  2153 +#define gen_op_stb_le_64_hypv gen_op_stb_64_hypv
2215 2154 #define OP_LD_TABLE(width) \
2216   -static GenOpFunc *gen_op_l##width[] = { \
2217   - &gen_op_l##width##_user, \
2218   - &gen_op_l##width##_le_user, \
2219   - &gen_op_l##width##_kernel, \
2220   - &gen_op_l##width##_le_kernel, \
  2155 +static GenOpFunc *gen_op_l##width[NB_MEM_FUNCS] = { \
  2156 + GEN_MEM_FUNCS(l##width), \
2221 2157 };
2222 2158 #define OP_ST_TABLE(width) \
2223   -static GenOpFunc *gen_op_st##width[] = { \
2224   - &gen_op_st##width##_user, \
2225   - &gen_op_st##width##_le_user, \
2226   - &gen_op_st##width##_kernel, \
2227   - &gen_op_st##width##_le_kernel, \
  2159 +static GenOpFunc *gen_op_st##width[NB_MEM_FUNCS] = { \
  2160 + GEN_MEM_FUNCS(st##width), \
2228 2161 };
2229   -#endif
2230   -/* Byte access routine are endian safe */
2231   -#define gen_op_stb_le_user gen_op_stb_user
2232   -#define gen_op_lbz_le_user gen_op_lbz_user
2233   -#define gen_op_stb_le_kernel gen_op_stb_kernel
2234   -#define gen_op_lbz_le_kernel gen_op_lbz_kernel
2235   -#endif
2236 2162  
2237 2163 #define GEN_LD(width, opc, type) \
2238 2164 GEN_HANDLER(l##width, opc, 0xFF, 0xFF, 0x00000000, type) \
... ... @@ -2487,75 +2413,12 @@ GEN_STX(wbr, 0x16, 0x14, PPC_INTEGER);
2487 2413  
2488 2414 /*** Integer load and store multiple ***/
2489 2415 #define op_ldstm(name, reg) (*gen_op_##name[ctx->mem_idx])(reg)
2490   -#if defined(CONFIG_USER_ONLY)
2491   -/* User-mode only */
2492   -static GenOpFunc1 *gen_op_lmw[] = {
2493   - &gen_op_lmw_raw,
2494   - &gen_op_lmw_le_raw,
2495   -#if defined(TARGET_PPC64)
2496   - &gen_op_lmw_64_raw,
2497   - &gen_op_lmw_le_64_raw,
2498   -#endif
  2416 +static GenOpFunc1 *gen_op_lmw[NB_MEM_FUNCS] = {
  2417 + GEN_MEM_FUNCS(lmw),
2499 2418 };
2500   -static GenOpFunc1 *gen_op_stmw[] = {
2501   - &gen_op_stmw_raw,
2502   - &gen_op_stmw_le_raw,
2503   -#if defined(TARGET_PPC64)
2504   - &gen_op_stmw_64_raw,
2505   - &gen_op_stmw_le_64_raw,
2506   -#endif
  2419 +static GenOpFunc1 *gen_op_stmw[NB_MEM_FUNCS] = {
  2420 + GEN_MEM_FUNCS(stmw),
2507 2421 };
2508   -#else
2509   -#if defined(TARGET_PPC64)
2510   -/* Full system - 64 bits mode */
2511   -static GenOpFunc1 *gen_op_lmw[] = {
2512   - &gen_op_lmw_user,
2513   - &gen_op_lmw_le_user,
2514   - &gen_op_lmw_64_user,
2515   - &gen_op_lmw_le_64_user,
2516   - &gen_op_lmw_kernel,
2517   - &gen_op_lmw_le_kernel,
2518   - &gen_op_lmw_64_kernel,
2519   - &gen_op_lmw_le_64_kernel,
2520   -#if defined(TARGET_PPC64H)
2521   - &gen_op_lmw_hypv,
2522   - &gen_op_lmw_le_hypv,
2523   - &gen_op_lmw_64_hypv,
2524   - &gen_op_lmw_le_64_hypv,
2525   -#endif
2526   -};
2527   -static GenOpFunc1 *gen_op_stmw[] = {
2528   - &gen_op_stmw_user,
2529   - &gen_op_stmw_le_user,
2530   - &gen_op_stmw_64_user,
2531   - &gen_op_stmw_le_64_user,
2532   - &gen_op_stmw_kernel,
2533   - &gen_op_stmw_le_kernel,
2534   - &gen_op_stmw_64_kernel,
2535   - &gen_op_stmw_le_64_kernel,
2536   -#if defined(TARGET_PPC64H)
2537   - &gen_op_stmw_hypv,
2538   - &gen_op_stmw_le_hypv,
2539   - &gen_op_stmw_64_hypv,
2540   - &gen_op_stmw_le_64_hypv,
2541   -#endif
2542   -};
2543   -#else
2544   -/* Full system - 32 bits mode */
2545   -static GenOpFunc1 *gen_op_lmw[] = {
2546   - &gen_op_lmw_user,
2547   - &gen_op_lmw_le_user,
2548   - &gen_op_lmw_kernel,
2549   - &gen_op_lmw_le_kernel,
2550   -};
2551   -static GenOpFunc1 *gen_op_stmw[] = {
2552   - &gen_op_stmw_user,
2553   - &gen_op_stmw_le_user,
2554   - &gen_op_stmw_kernel,
2555   - &gen_op_stmw_le_kernel,
2556   -};
2557   -#endif
2558   -#endif
2559 2422  
2560 2423 /* lmw */
2561 2424 GEN_HANDLER(lmw, 0x2E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
... ... @@ -2578,105 +2441,15 @@ GEN_HANDLER(stmw, 0x2F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
2578 2441 /*** Integer load and store strings ***/
2579 2442 #define op_ldsts(name, start) (*gen_op_##name[ctx->mem_idx])(start)
2580 2443 #define op_ldstsx(name, rd, ra, rb) (*gen_op_##name[ctx->mem_idx])(rd, ra, rb)
2581   -#if defined(CONFIG_USER_ONLY)
2582   -/* User-mode only */
2583   -static GenOpFunc1 *gen_op_lswi[] = {
2584   - &gen_op_lswi_raw,
2585   - &gen_op_lswi_le_raw,
2586   -#if defined(TARGET_PPC64)
2587   - &gen_op_lswi_64_raw,
2588   - &gen_op_lswi_le_64_raw,
2589   -#endif
2590   -};
2591   -static GenOpFunc3 *gen_op_lswx[] = {
2592   - &gen_op_lswx_raw,
2593   - &gen_op_lswx_le_raw,
2594   -#if defined(TARGET_PPC64)
2595   - &gen_op_lswx_64_raw,
2596   - &gen_op_lswx_le_64_raw,
2597   -#endif
  2444 +static GenOpFunc1 *gen_op_lswi[NB_MEM_FUNCS] = {
  2445 + GEN_MEM_FUNCS(lswi),
2598 2446 };
2599   -static GenOpFunc1 *gen_op_stsw[] = {
2600   - &gen_op_stsw_raw,
2601   - &gen_op_stsw_le_raw,
2602   -#if defined(TARGET_PPC64)
2603   - &gen_op_stsw_64_raw,
2604   - &gen_op_stsw_le_64_raw,
2605   -#endif
2606   -};
2607   -#else
2608   -#if defined(TARGET_PPC64)
2609   -/* Full system - 64 bits mode */
2610   -static GenOpFunc1 *gen_op_lswi[] = {
2611   - &gen_op_lswi_user,
2612   - &gen_op_lswi_le_user,
2613   - &gen_op_lswi_64_user,
2614   - &gen_op_lswi_le_64_user,
2615   - &gen_op_lswi_kernel,
2616   - &gen_op_lswi_le_kernel,
2617   - &gen_op_lswi_64_kernel,
2618   - &gen_op_lswi_le_64_kernel,
2619   -#if defined(TARGET_PPC64H)
2620   - &gen_op_lswi_hypv,
2621   - &gen_op_lswi_le_hypv,
2622   - &gen_op_lswi_64_hypv,
2623   - &gen_op_lswi_le_64_hypv,
2624   -#endif
  2447 +static GenOpFunc3 *gen_op_lswx[NB_MEM_FUNCS] = {
  2448 + GEN_MEM_FUNCS(lswx),
2625 2449 };
2626   -static GenOpFunc3 *gen_op_lswx[] = {
2627   - &gen_op_lswx_user,
2628   - &gen_op_lswx_le_user,
2629   - &gen_op_lswx_64_user,
2630   - &gen_op_lswx_le_64_user,
2631   - &gen_op_lswx_kernel,
2632   - &gen_op_lswx_le_kernel,
2633   - &gen_op_lswx_64_kernel,
2634   - &gen_op_lswx_le_64_kernel,
2635   -#if defined(TARGET_PPC64H)
2636   - &gen_op_lswx_hypv,
2637   - &gen_op_lswx_le_hypv,
2638   - &gen_op_lswx_64_hypv,
2639   - &gen_op_lswx_le_64_hypv,
2640   -#endif
2641   -};
2642   -static GenOpFunc1 *gen_op_stsw[] = {
2643   - &gen_op_stsw_user,
2644   - &gen_op_stsw_le_user,
2645   - &gen_op_stsw_64_user,
2646   - &gen_op_stsw_le_64_user,
2647   - &gen_op_stsw_kernel,
2648   - &gen_op_stsw_le_kernel,
2649   - &gen_op_stsw_64_kernel,
2650   - &gen_op_stsw_le_64_kernel,
2651   -#if defined(TARGET_PPC64H)
2652   - &gen_op_stsw_hypv,
2653   - &gen_op_stsw_le_hypv,
2654   - &gen_op_stsw_64_hypv,
2655   - &gen_op_stsw_le_64_hypv,
2656   -#endif
2657   -};
2658   -#else
2659   -/* Full system - 32 bits mode */
2660   -static GenOpFunc1 *gen_op_lswi[] = {
2661   - &gen_op_lswi_user,
2662   - &gen_op_lswi_le_user,
2663   - &gen_op_lswi_kernel,
2664   - &gen_op_lswi_le_kernel,
  2450 +static GenOpFunc1 *gen_op_stsw[NB_MEM_FUNCS] = {
  2451 + GEN_MEM_FUNCS(stsw),
2665 2452 };
2666   -static GenOpFunc3 *gen_op_lswx[] = {
2667   - &gen_op_lswx_user,
2668   - &gen_op_lswx_le_user,
2669   - &gen_op_lswx_kernel,
2670   - &gen_op_lswx_le_kernel,
2671   -};
2672   -static GenOpFunc1 *gen_op_stsw[] = {
2673   - &gen_op_stsw_user,
2674   - &gen_op_stsw_le_user,
2675   - &gen_op_stsw_kernel,
2676   - &gen_op_stsw_le_kernel,
2677   -};
2678   -#endif
2679   -#endif
2680 2453  
2681 2454 /* lswi */
2682 2455 /* PowerPC32 specification says we must generate an exception if
... ... @@ -2762,75 +2535,12 @@ GEN_HANDLER(isync, 0x13, 0x16, 0x04, 0x03FFF801, PPC_MEM)
2762 2535  
2763 2536 #define op_lwarx() (*gen_op_lwarx[ctx->mem_idx])()
2764 2537 #define op_stwcx() (*gen_op_stwcx[ctx->mem_idx])()
2765   -#if defined(CONFIG_USER_ONLY)
2766   -/* User-mode only */
2767   -static GenOpFunc *gen_op_lwarx[] = {
2768   - &gen_op_lwarx_raw,
2769   - &gen_op_lwarx_le_raw,
2770   -#if defined(TARGET_PPC64)
2771   - &gen_op_lwarx_64_raw,
2772   - &gen_op_lwarx_le_64_raw,
2773   -#endif
2774   -};
2775   -static GenOpFunc *gen_op_stwcx[] = {
2776   - &gen_op_stwcx_raw,
2777   - &gen_op_stwcx_le_raw,
2778   -#if defined(TARGET_PPC64)
2779   - &gen_op_stwcx_64_raw,
2780   - &gen_op_stwcx_le_64_raw,
2781   -#endif
  2538 +static GenOpFunc *gen_op_lwarx[NB_MEM_FUNCS] = {
  2539 + GEN_MEM_FUNCS(lwarx),
2782 2540 };
2783   -#else
2784   -#if defined(TARGET_PPC64)
2785   -/* Full system - 64 bits mode */
2786   -static GenOpFunc *gen_op_lwarx[] = {
2787   - &gen_op_lwarx_user,
2788   - &gen_op_lwarx_le_user,
2789   - &gen_op_lwarx_64_user,
2790   - &gen_op_lwarx_le_64_user,
2791   - &gen_op_lwarx_kernel,
2792   - &gen_op_lwarx_le_kernel,
2793   - &gen_op_lwarx_64_kernel,
2794   - &gen_op_lwarx_le_64_kernel,
2795   -#if defined(TARGET_PPC64H)
2796   - &gen_op_lwarx_hypv,
2797   - &gen_op_lwarx_le_hypv,
2798   - &gen_op_lwarx_64_hypv,
2799   - &gen_op_lwarx_le_64_hypv,
2800   -#endif
  2541 +static GenOpFunc *gen_op_stwcx[NB_MEM_FUNCS] = {
  2542 + GEN_MEM_FUNCS(stwcx),
2801 2543 };
2802   -static GenOpFunc *gen_op_stwcx[] = {
2803   - &gen_op_stwcx_user,
2804   - &gen_op_stwcx_le_user,
2805   - &gen_op_stwcx_64_user,
2806   - &gen_op_stwcx_le_64_user,
2807   - &gen_op_stwcx_kernel,
2808   - &gen_op_stwcx_le_kernel,
2809   - &gen_op_stwcx_64_kernel,
2810   - &gen_op_stwcx_le_64_kernel,
2811   -#if defined(TARGET_PPC64H)
2812   - &gen_op_stwcx_hypv,
2813   - &gen_op_stwcx_le_hypv,
2814   - &gen_op_stwcx_64_hypv,
2815   - &gen_op_stwcx_le_64_hypv,
2816   -#endif
2817   -};
2818   -#else
2819   -/* Full system - 32 bits mode */
2820   -static GenOpFunc *gen_op_lwarx[] = {
2821   - &gen_op_lwarx_user,
2822   - &gen_op_lwarx_le_user,
2823   - &gen_op_lwarx_kernel,
2824   - &gen_op_lwarx_le_kernel,
2825   -};
2826   -static GenOpFunc *gen_op_stwcx[] = {
2827   - &gen_op_stwcx_user,
2828   - &gen_op_stwcx_le_user,
2829   - &gen_op_stwcx_kernel,
2830   - &gen_op_stwcx_le_kernel,
2831   -};
2832   -#endif
2833   -#endif
2834 2544  
2835 2545 /* lwarx */
2836 2546 GEN_HANDLER(lwarx, 0x1F, 0x14, 0x00, 0x00000001, PPC_RES)
... ... @@ -2855,55 +2565,12 @@ GEN_HANDLER2(stwcx_, "stwcx.", 0x1F, 0x16, 0x04, 0x00000000, PPC_RES)
2855 2565 #if defined(TARGET_PPC64)
2856 2566 #define op_ldarx() (*gen_op_ldarx[ctx->mem_idx])()
2857 2567 #define op_stdcx() (*gen_op_stdcx[ctx->mem_idx])()
2858   -#if defined(CONFIG_USER_ONLY)
2859   -/* User-mode only */
2860   -static GenOpFunc *gen_op_ldarx[] = {
2861   - &gen_op_ldarx_raw,
2862   - &gen_op_ldarx_le_raw,
2863   - &gen_op_ldarx_64_raw,
2864   - &gen_op_ldarx_le_64_raw,
  2568 +static GenOpFunc *gen_op_ldarx[NB_MEM_FUNCS] = {
  2569 + GEN_MEM_FUNCS(ldarx),
2865 2570 };
2866   -static GenOpFunc *gen_op_stdcx[] = {
2867   - &gen_op_stdcx_raw,
2868   - &gen_op_stdcx_le_raw,
2869   - &gen_op_stdcx_64_raw,
2870   - &gen_op_stdcx_le_64_raw,
  2571 +static GenOpFunc *gen_op_stdcx[NB_MEM_FUNCS] = {
  2572 + GEN_MEM_FUNCS(stdcx),
2871 2573 };
2872   -#else
2873   -/* Full system */
2874   -static GenOpFunc *gen_op_ldarx[] = {
2875   - &gen_op_ldarx_user,
2876   - &gen_op_ldarx_le_user,
2877   - &gen_op_ldarx_64_user,
2878   - &gen_op_ldarx_le_64_user,
2879   - &gen_op_ldarx_kernel,
2880   - &gen_op_ldarx_le_kernel,
2881   - &gen_op_ldarx_64_kernel,
2882   - &gen_op_ldarx_le_64_kernel,
2883   -#if defined(TARGET_PPC64H)
2884   - &gen_op_ldarx_hypv,
2885   - &gen_op_ldarx_le_hypv,
2886   - &gen_op_ldarx_64_hypv,
2887   - &gen_op_ldarx_le_64_hypv,
2888   -#endif
2889   -};
2890   -static GenOpFunc *gen_op_stdcx[] = {
2891   - &gen_op_stdcx_user,
2892   - &gen_op_stdcx_le_user,
2893   - &gen_op_stdcx_64_user,
2894   - &gen_op_stdcx_le_64_user,
2895   - &gen_op_stdcx_kernel,
2896   - &gen_op_stdcx_le_kernel,
2897   - &gen_op_stdcx_64_kernel,
2898   - &gen_op_stdcx_le_64_kernel,
2899   -#if defined(TARGET_PPC64H)
2900   - &gen_op_stdcx_hypv,
2901   - &gen_op_stdcx_le_hypv,
2902   - &gen_op_stdcx_64_hypv,
2903   - &gen_op_stdcx_le_64_hypv,
2904   -#endif
2905   -};
2906   -#endif
2907 2574  
2908 2575 /* ldarx */
2909 2576 GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_64B)
... ... @@ -3406,9 +3073,7 @@ GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B)
3406 3073 GEN_SYNC(ctx);
3407 3074 #endif
3408 3075 }
3409   -#endif
3410 3076  
3411   -#if defined(TARGET_PPC64H)
3412 3077 GEN_HANDLER(hrfid, 0x13, 0x12, 0x08, 0x03FF8001, PPC_64B)
3413 3078 {
3414 3079 #if defined(CONFIG_USER_ONLY)
... ... @@ -3542,12 +3207,9 @@ static always_inline void gen_op_mfspr (DisasContext *ctx)
3542 3207 uint32_t sprn = SPR(ctx->opcode);
3543 3208  
3544 3209 #if !defined(CONFIG_USER_ONLY)
3545   -#if defined(TARGET_PPC64H)
3546 3210 if (ctx->supervisor == 2)
3547 3211 read_cb = ctx->spr_cb[sprn].hea_read;
3548   - else
3549   -#endif
3550   - if (ctx->supervisor)
  3212 + else if (ctx->supervisor)
3551 3213 read_cb = ctx->spr_cb[sprn].oea_read;
3552 3214 else
3553 3215 #endif
... ... @@ -3682,12 +3344,9 @@ GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000001, PPC_MISC)
3682 3344 uint32_t sprn = SPR(ctx->opcode);
3683 3345  
3684 3346 #if !defined(CONFIG_USER_ONLY)
3685   -#if defined(TARGET_PPC64H)
3686 3347 if (ctx->supervisor == 2)
3687 3348 write_cb = ctx->spr_cb[sprn].hea_write;
3688   - else
3689   -#endif
3690   - if (ctx->supervisor)
  3349 + else if (ctx->supervisor)
3691 3350 write_cb = ctx->spr_cb[sprn].oea_write;
3692 3351 else
3693 3352 #endif
... ... @@ -3773,141 +3432,56 @@ GEN_HANDLER(dcbtst, 0x1F, 0x16, 0x07, 0x02000001, PPC_CACHE)
3773 3432  
3774 3433 /* dcbz */
3775 3434 #define op_dcbz(n) (*gen_op_dcbz[n][ctx->mem_idx])()
3776   -#if defined(CONFIG_USER_ONLY)
3777   -/* User-mode only */
3778   -static GenOpFunc *gen_op_dcbz[4][4] = {
3779   - {
3780   - &gen_op_dcbz_l32_raw,
3781   - &gen_op_dcbz_l32_raw,
3782   -#if defined(TARGET_PPC64)
3783   - &gen_op_dcbz_l32_64_raw,
3784   - &gen_op_dcbz_l32_64_raw,
3785   -#endif
3786   - },
3787   - {
3788   - &gen_op_dcbz_l64_raw,
3789   - &gen_op_dcbz_l64_raw,
3790   -#if defined(TARGET_PPC64)
3791   - &gen_op_dcbz_l64_64_raw,
3792   - &gen_op_dcbz_l64_64_raw,
3793   -#endif
3794   - },
3795   - {
3796   - &gen_op_dcbz_l128_raw,
3797   - &gen_op_dcbz_l128_raw,
3798   -#if defined(TARGET_PPC64)
3799   - &gen_op_dcbz_l128_64_raw,
3800   - &gen_op_dcbz_l128_64_raw,
3801   -#endif
3802   - },
3803   - {
3804   - &gen_op_dcbz_raw,
3805   - &gen_op_dcbz_raw,
3806   -#if defined(TARGET_PPC64)
3807   - &gen_op_dcbz_64_raw,
3808   - &gen_op_dcbz_64_raw,
3809   -#endif
3810   - },
3811   -};
3812   -#else
3813   -#if defined(TARGET_PPC64)
3814   -/* Full system - 64 bits mode */
3815   -static GenOpFunc *gen_op_dcbz[4][12] = {
  3435 +static GenOpFunc *gen_op_dcbz[4][NB_MEM_FUNCS] = {
  3436 + /* 32 bytes cache line size */
3816 3437 {
3817   - &gen_op_dcbz_l32_user,
3818   - &gen_op_dcbz_l32_user,
3819   - &gen_op_dcbz_l32_64_user,
3820   - &gen_op_dcbz_l32_64_user,
3821   - &gen_op_dcbz_l32_kernel,
3822   - &gen_op_dcbz_l32_kernel,
3823   - &gen_op_dcbz_l32_64_kernel,
3824   - &gen_op_dcbz_l32_64_kernel,
3825   -#if defined(TARGET_PPC64H)
3826   - &gen_op_dcbz_l32_hypv,
3827   - &gen_op_dcbz_l32_hypv,
3828   - &gen_op_dcbz_l32_64_hypv,
3829   - &gen_op_dcbz_l32_64_hypv,
3830   -#endif
  3438 +#define gen_op_dcbz_l32_le_raw gen_op_dcbz_l32_raw
  3439 +#define gen_op_dcbz_l32_le_user gen_op_dcbz_l32_user
  3440 +#define gen_op_dcbz_l32_le_kernel gen_op_dcbz_l32_kernel
  3441 +#define gen_op_dcbz_l32_le_hypv gen_op_dcbz_l32_hypv
  3442 +#define gen_op_dcbz_l32_le_64_raw gen_op_dcbz_l32_64_raw
  3443 +#define gen_op_dcbz_l32_le_64_user gen_op_dcbz_l32_64_user
  3444 +#define gen_op_dcbz_l32_le_64_kernel gen_op_dcbz_l32_64_kernel
  3445 +#define gen_op_dcbz_l32_le_64_hypv gen_op_dcbz_l32_64_hypv
  3446 + GEN_MEM_FUNCS(dcbz_l32),
3831 3447 },
  3448 + /* 64 bytes cache line size */
3832 3449 {
3833   - &gen_op_dcbz_l64_user,
3834   - &gen_op_dcbz_l64_user,
3835   - &gen_op_dcbz_l64_64_user,
3836   - &gen_op_dcbz_l64_64_user,
3837   - &gen_op_dcbz_l64_kernel,
3838   - &gen_op_dcbz_l64_kernel,
3839   - &gen_op_dcbz_l64_64_kernel,
3840   - &gen_op_dcbz_l64_64_kernel,
3841   -#if defined(TARGET_PPC64H)
3842   - &gen_op_dcbz_l64_hypv,
3843   - &gen_op_dcbz_l64_hypv,
3844   - &gen_op_dcbz_l64_64_hypv,
3845   - &gen_op_dcbz_l64_64_hypv,
3846   -#endif
  3450 +#define gen_op_dcbz_l64_le_raw gen_op_dcbz_l64_raw
  3451 +#define gen_op_dcbz_l64_le_user gen_op_dcbz_l64_user
  3452 +#define gen_op_dcbz_l64_le_kernel gen_op_dcbz_l64_kernel
  3453 +#define gen_op_dcbz_l64_le_hypv gen_op_dcbz_l64_hypv
  3454 +#define gen_op_dcbz_l64_le_64_raw gen_op_dcbz_l64_64_raw
  3455 +#define gen_op_dcbz_l64_le_64_user gen_op_dcbz_l64_64_user
  3456 +#define gen_op_dcbz_l64_le_64_kernel gen_op_dcbz_l64_64_kernel
  3457 +#define gen_op_dcbz_l64_le_64_hypv gen_op_dcbz_l64_64_hypv
  3458 + GEN_MEM_FUNCS(dcbz_l64),
3847 3459 },
  3460 + /* 128 bytes cache line size */
3848 3461 {
3849   - &gen_op_dcbz_l128_user,
3850   - &gen_op_dcbz_l128_user,
3851   - &gen_op_dcbz_l128_64_user,
3852   - &gen_op_dcbz_l128_64_user,
3853   - &gen_op_dcbz_l128_kernel,
3854   - &gen_op_dcbz_l128_kernel,
3855   - &gen_op_dcbz_l128_64_kernel,
3856   - &gen_op_dcbz_l128_64_kernel,
3857   -#if defined(TARGET_PPC64H)
3858   - &gen_op_dcbz_l128_hypv,
3859   - &gen_op_dcbz_l128_hypv,
3860   - &gen_op_dcbz_l128_64_hypv,
3861   - &gen_op_dcbz_l128_64_hypv,
3862   -#endif
  3462 +#define gen_op_dcbz_l128_le_raw gen_op_dcbz_l128_raw
  3463 +#define gen_op_dcbz_l128_le_user gen_op_dcbz_l128_user
  3464 +#define gen_op_dcbz_l128_le_kernel gen_op_dcbz_l128_kernel
  3465 +#define gen_op_dcbz_l128_le_hypv gen_op_dcbz_l128_hypv
  3466 +#define gen_op_dcbz_l128_le_64_raw gen_op_dcbz_l128_64_raw
  3467 +#define gen_op_dcbz_l128_le_64_user gen_op_dcbz_l128_64_user
  3468 +#define gen_op_dcbz_l128_le_64_kernel gen_op_dcbz_l128_64_kernel
  3469 +#define gen_op_dcbz_l128_le_64_hypv gen_op_dcbz_l128_64_hypv
  3470 + GEN_MEM_FUNCS(dcbz_l128),
3863 3471 },
  3472 + /* tunable cache line size */
3864 3473 {
3865   - &gen_op_dcbz_user,
3866   - &gen_op_dcbz_user,
3867   - &gen_op_dcbz_64_user,
3868   - &gen_op_dcbz_64_user,
3869   - &gen_op_dcbz_kernel,
3870   - &gen_op_dcbz_kernel,
3871   - &gen_op_dcbz_64_kernel,
3872   - &gen_op_dcbz_64_kernel,
3873   -#if defined(TARGET_PPC64H)
3874   - &gen_op_dcbz_hypv,
3875   - &gen_op_dcbz_hypv,
3876   - &gen_op_dcbz_64_hypv,
3877   - &gen_op_dcbz_64_hypv,
3878   -#endif
  3474 +#define gen_op_dcbz_le_raw gen_op_dcbz_raw
  3475 +#define gen_op_dcbz_le_user gen_op_dcbz_user
  3476 +#define gen_op_dcbz_le_kernel gen_op_dcbz_kernel
  3477 +#define gen_op_dcbz_le_hypv gen_op_dcbz_hypv
  3478 +#define gen_op_dcbz_le_64_raw gen_op_dcbz_64_raw
  3479 +#define gen_op_dcbz_le_64_user gen_op_dcbz_64_user
  3480 +#define gen_op_dcbz_le_64_kernel gen_op_dcbz_64_kernel
  3481 +#define gen_op_dcbz_le_64_hypv gen_op_dcbz_64_hypv
  3482 + GEN_MEM_FUNCS(dcbz),
3879 3483 },
3880 3484 };
3881   -#else
3882   -/* Full system - 32 bits mode */
3883   -static GenOpFunc *gen_op_dcbz[4][4] = {
3884   - {
3885   - &gen_op_dcbz_l32_user,
3886   - &gen_op_dcbz_l32_user,
3887   - &gen_op_dcbz_l32_kernel,
3888   - &gen_op_dcbz_l32_kernel,
3889   - },
3890   - {
3891   - &gen_op_dcbz_l64_user,
3892   - &gen_op_dcbz_l64_user,
3893   - &gen_op_dcbz_l64_kernel,
3894   - &gen_op_dcbz_l64_kernel,
3895   - },
3896   - {
3897   - &gen_op_dcbz_l128_user,
3898   - &gen_op_dcbz_l128_user,
3899   - &gen_op_dcbz_l128_kernel,
3900   - &gen_op_dcbz_l128_kernel,
3901   - },
3902   - {
3903   - &gen_op_dcbz_user,
3904   - &gen_op_dcbz_user,
3905   - &gen_op_dcbz_kernel,
3906   - &gen_op_dcbz_kernel,
3907   - },
3908   -};
3909   -#endif
3910   -#endif
3911 3485  
3912 3486 static always_inline void handler_dcbz (DisasContext *ctx,
3913 3487 int dcache_line_size)
... ... @@ -3950,45 +3524,17 @@ GEN_HANDLER2(dcbz_970, "dcbz", 0x1F, 0x16, 0x1F, 0x03C00001, PPC_CACHE_DCBZT)
3950 3524  
3951 3525 /* icbi */
3952 3526 #define op_icbi() (*gen_op_icbi[ctx->mem_idx])()
3953   -#if defined(CONFIG_USER_ONLY)
3954   -/* User-mode only */
3955   -static GenOpFunc *gen_op_icbi[] = {
3956   - &gen_op_icbi_raw,
3957   - &gen_op_icbi_raw,
3958   -#if defined(TARGET_PPC64)
3959   - &gen_op_icbi_64_raw,
3960   - &gen_op_icbi_64_raw,
3961   -#endif
3962   -};
3963   -#else
3964   -/* Full system - 64 bits mode */
3965   -#if defined(TARGET_PPC64)
3966   -static GenOpFunc *gen_op_icbi[] = {
3967   - &gen_op_icbi_user,
3968   - &gen_op_icbi_user,
3969   - &gen_op_icbi_64_user,
3970   - &gen_op_icbi_64_user,
3971   - &gen_op_icbi_kernel,
3972   - &gen_op_icbi_kernel,
3973   - &gen_op_icbi_64_kernel,
3974   - &gen_op_icbi_64_kernel,
3975   -#if defined(TARGET_PPC64H)
3976   - &gen_op_icbi_hypv,
3977   - &gen_op_icbi_hypv,
3978   - &gen_op_icbi_64_hypv,
3979   - &gen_op_icbi_64_hypv,
3980   -#endif
3981   -};
3982   -#else
3983   -/* Full system - 32 bits mode */
3984   -static GenOpFunc *gen_op_icbi[] = {
3985   - &gen_op_icbi_user,
3986   - &gen_op_icbi_user,
3987   - &gen_op_icbi_kernel,
3988   - &gen_op_icbi_kernel,
  3527 +#define gen_op_icbi_le_raw gen_op_icbi_raw
  3528 +#define gen_op_icbi_le_user gen_op_icbi_user
  3529 +#define gen_op_icbi_le_kernel gen_op_icbi_kernel
  3530 +#define gen_op_icbi_le_hypv gen_op_icbi_hypv
  3531 +#define gen_op_icbi_le_64_raw gen_op_icbi_64_raw
  3532 +#define gen_op_icbi_le_64_user gen_op_icbi_64_user
  3533 +#define gen_op_icbi_le_64_kernel gen_op_icbi_64_kernel
  3534 +#define gen_op_icbi_le_64_hypv gen_op_icbi_64_hypv
  3535 +static GenOpFunc *gen_op_icbi[NB_MEM_FUNCS] = {
  3536 + GEN_MEM_FUNCS(icbi),
3989 3537 };
3990   -#endif
3991   -#endif
3992 3538  
3993 3539 GEN_HANDLER(icbi, 0x1F, 0x16, 0x1E, 0x03E00001, PPC_CACHE_ICBI)
3994 3540 {
... ... @@ -4239,75 +3785,12 @@ GEN_HANDLER(slbie, 0x1F, 0x12, 0x0D, 0x03FF0001, PPC_SLBI)
4239 3785 /* Optional: */
4240 3786 #define op_eciwx() (*gen_op_eciwx[ctx->mem_idx])()
4241 3787 #define op_ecowx() (*gen_op_ecowx[ctx->mem_idx])()
4242   -#if defined(CONFIG_USER_ONLY)
4243   -/* User-mode only */
4244   -static GenOpFunc *gen_op_eciwx[] = {
4245   - &gen_op_eciwx_raw,
4246   - &gen_op_eciwx_le_raw,
4247   -#if defined(TARGET_PPC64)
4248   - &gen_op_eciwx_64_raw,
4249   - &gen_op_eciwx_le_64_raw,
4250   -#endif
  3788 +static GenOpFunc *gen_op_eciwx[NB_MEM_FUNCS] = {
  3789 + GEN_MEM_FUNCS(eciwx),
4251 3790 };
4252   -static GenOpFunc *gen_op_ecowx[] = {
4253   - &gen_op_ecowx_raw,
4254   - &gen_op_ecowx_le_raw,
4255   -#if defined(TARGET_PPC64)
4256   - &gen_op_ecowx_64_raw,
4257   - &gen_op_ecowx_le_64_raw,
4258   -#endif
  3791 +static GenOpFunc *gen_op_ecowx[NB_MEM_FUNCS] = {
  3792 + GEN_MEM_FUNCS(ecowx),
4259 3793 };
4260   -#else
4261   -#if defined(TARGET_PPC64)
4262   -/* Full system - 64 bits mode */
4263   -static GenOpFunc *gen_op_eciwx[] = {
4264   - &gen_op_eciwx_user,
4265   - &gen_op_eciwx_le_user,
4266   - &gen_op_eciwx_64_user,
4267   - &gen_op_eciwx_le_64_user,
4268   - &gen_op_eciwx_kernel,
4269   - &gen_op_eciwx_le_kernel,
4270   - &gen_op_eciwx_64_kernel,
4271   - &gen_op_eciwx_le_64_kernel,
4272   -#if defined(TARGET_PPC64H)
4273   - &gen_op_eciwx_hypv,
4274   - &gen_op_eciwx_le_hypv,
4275   - &gen_op_eciwx_64_hypv,
4276   - &gen_op_eciwx_le_64_hypv,
4277   -#endif
4278   -};
4279   -static GenOpFunc *gen_op_ecowx[] = {
4280   - &gen_op_ecowx_user,
4281   - &gen_op_ecowx_le_user,
4282   - &gen_op_ecowx_64_user,
4283   - &gen_op_ecowx_le_64_user,
4284   - &gen_op_ecowx_kernel,
4285   - &gen_op_ecowx_le_kernel,
4286   - &gen_op_ecowx_64_kernel,
4287   - &gen_op_ecowx_le_64_kernel,
4288   -#if defined(TARGET_PPC64H)
4289   - &gen_op_ecowx_hypv,
4290   - &gen_op_ecowx_le_hypv,
4291   - &gen_op_ecowx_64_hypv,
4292   - &gen_op_ecowx_le_64_hypv,
4293   -#endif
4294   -};
4295   -#else
4296   -/* Full system - 32 bits mode */
4297   -static GenOpFunc *gen_op_eciwx[] = {
4298   - &gen_op_eciwx_user,
4299   - &gen_op_eciwx_le_user,
4300   - &gen_op_eciwx_kernel,
4301   - &gen_op_eciwx_le_kernel,
4302   -};
4303   -static GenOpFunc *gen_op_ecowx[] = {
4304   - &gen_op_ecowx_user,
4305   - &gen_op_ecowx_le_user,
4306   - &gen_op_ecowx_kernel,
4307   - &gen_op_ecowx_le_kernel,
4308   -};
4309   -#endif
4310   -#endif
4311 3794  
4312 3795 /* eciwx */
4313 3796 GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN)
... ... @@ -4432,22 +3915,26 @@ GEN_HANDLER(dozi, 0x09, 0xFF, 0xFF, 0x00000000, PPC_POWER_BR)
4432 3915 gen_op_store_T0_gpr(rD(ctx->opcode));
4433 3916 }
4434 3917  
4435   -/* As lscbx load from memory byte after byte, it's always endian safe */
  3918 +/* As lscbx load from memory byte after byte, it's always endian safe.
  3919 + * Original POWER is 32 bits only, define 64 bits ops as 32 bits ones
  3920 + */
4436 3921 #define op_POWER_lscbx(start, ra, rb) \
4437 3922 (*gen_op_POWER_lscbx[ctx->mem_idx])(start, ra, rb)
4438   -#if defined(CONFIG_USER_ONLY)
4439   -static GenOpFunc3 *gen_op_POWER_lscbx[] = {
4440   - &gen_op_POWER_lscbx_raw,
4441   - &gen_op_POWER_lscbx_raw,
  3923 +#define gen_op_POWER_lscbx_64_raw gen_op_POWER_lscbx_raw
  3924 +#define gen_op_POWER_lscbx_64_user gen_op_POWER_lscbx_user
  3925 +#define gen_op_POWER_lscbx_64_kernel gen_op_POWER_lscbx_kernel
  3926 +#define gen_op_POWER_lscbx_64_hypv gen_op_POWER_lscbx_hypv
  3927 +#define gen_op_POWER_lscbx_le_raw gen_op_POWER_lscbx_raw
  3928 +#define gen_op_POWER_lscbx_le_user gen_op_POWER_lscbx_user
  3929 +#define gen_op_POWER_lscbx_le_kernel gen_op_POWER_lscbx_kernel
  3930 +#define gen_op_POWER_lscbx_le_hypv gen_op_POWER_lscbx_hypv
  3931 +#define gen_op_POWER_lscbx_le_64_raw gen_op_POWER_lscbx_raw
  3932 +#define gen_op_POWER_lscbx_le_64_user gen_op_POWER_lscbx_user
  3933 +#define gen_op_POWER_lscbx_le_64_kernel gen_op_POWER_lscbx_kernel
  3934 +#define gen_op_POWER_lscbx_le_64_hypv gen_op_POWER_lscbx_hypv
  3935 +static GenOpFunc3 *gen_op_POWER_lscbx[NB_MEM_FUNCS] = {
  3936 + GEN_MEM_FUNCS(POWER_lscbx),
4442 3937 };
4443   -#else
4444   -static GenOpFunc3 *gen_op_POWER_lscbx[] = {
4445   - &gen_op_POWER_lscbx_user,
4446   - &gen_op_POWER_lscbx_user,
4447   - &gen_op_POWER_lscbx_kernel,
4448   - &gen_op_POWER_lscbx_kernel,
4449   -};
4450   -#endif
4451 3938  
4452 3939 /* lscbx - lscbx. */
4453 3940 GEN_HANDLER(lscbx, 0x1F, 0x15, 0x08, 0x00000000, PPC_POWER_BR)
... ... @@ -4901,31 +4388,31 @@ GEN_HANDLER(rfsvc, 0x13, 0x12, 0x02, 0x03FFF0001, PPC_POWER)
4901 4388  
4902 4389 /* POWER2 specific instructions */
4903 4390 /* Quad manipulation (load/store two floats at a time) */
  4391 +/* Original POWER2 is 32 bits only, define 64 bits ops as 32 bits ones */
4904 4392 #define op_POWER2_lfq() (*gen_op_POWER2_lfq[ctx->mem_idx])()
4905 4393 #define op_POWER2_stfq() (*gen_op_POWER2_stfq[ctx->mem_idx])()
4906   -#if defined(CONFIG_USER_ONLY)
4907   -static GenOpFunc *gen_op_POWER2_lfq[] = {
4908   - &gen_op_POWER2_lfq_le_raw,
4909   - &gen_op_POWER2_lfq_raw,
4910   -};
4911   -static GenOpFunc *gen_op_POWER2_stfq[] = {
4912   - &gen_op_POWER2_stfq_le_raw,
4913   - &gen_op_POWER2_stfq_raw,
  4394 +#define gen_op_POWER2_lfq_64_raw gen_op_POWER2_lfq_raw
  4395 +#define gen_op_POWER2_lfq_64_user gen_op_POWER2_lfq_user
  4396 +#define gen_op_POWER2_lfq_64_kernel gen_op_POWER2_lfq_kernel
  4397 +#define gen_op_POWER2_lfq_64_hypv gen_op_POWER2_lfq_hypv
  4398 +#define gen_op_POWER2_lfq_le_64_raw gen_op_POWER2_lfq_le_raw
  4399 +#define gen_op_POWER2_lfq_le_64_user gen_op_POWER2_lfq_le_user
  4400 +#define gen_op_POWER2_lfq_le_64_kernel gen_op_POWER2_lfq_le_kernel
  4401 +#define gen_op_POWER2_lfq_le_64_hypv gen_op_POWER2_lfq_le_hypv
  4402 +#define gen_op_POWER2_stfq_64_raw gen_op_POWER2_stfq_raw
  4403 +#define gen_op_POWER2_stfq_64_user gen_op_POWER2_stfq_user
  4404 +#define gen_op_POWER2_stfq_64_kernel gen_op_POWER2_stfq_kernel
  4405 +#define gen_op_POWER2_stfq_64_hypv gen_op_POWER2_stfq_hypv
  4406 +#define gen_op_POWER2_stfq_le_64_raw gen_op_POWER2_stfq_le_raw
  4407 +#define gen_op_POWER2_stfq_le_64_user gen_op_POWER2_stfq_le_user
  4408 +#define gen_op_POWER2_stfq_le_64_kernel gen_op_POWER2_stfq_le_kernel
  4409 +#define gen_op_POWER2_stfq_le_64_hypv gen_op_POWER2_stfq_le_hypv
  4410 +static GenOpFunc *gen_op_POWER2_lfq[NB_MEM_FUNCS] = {
  4411 + GEN_MEM_FUNCS(POWER2_lfq),
4914 4412 };
4915   -#else
4916   -static GenOpFunc *gen_op_POWER2_lfq[] = {
4917   - &gen_op_POWER2_lfq_le_user,
4918   - &gen_op_POWER2_lfq_user,
4919   - &gen_op_POWER2_lfq_le_kernel,
4920   - &gen_op_POWER2_lfq_kernel,
  4413 +static GenOpFunc *gen_op_POWER2_stfq[NB_MEM_FUNCS] = {
  4414 + GEN_MEM_FUNCS(POWER2_stfq),
4921 4415 };
4922   -static GenOpFunc *gen_op_POWER2_stfq[] = {
4923   - &gen_op_POWER2_stfq_le_user,
4924   - &gen_op_POWER2_stfq_user,
4925   - &gen_op_POWER2_stfq_le_kernel,
4926   - &gen_op_POWER2_stfq_kernel,
4927   -};
4928   -#endif
4929 4416  
4930 4417 /* lfq */
4931 4418 GEN_HANDLER(lfq, 0x38, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
... ... @@ -5687,111 +5174,14 @@ GEN32(gen_op_store_A2_avr, gen_op_store_A2_avr_avr);
5687 5174 #endif
5688 5175  
5689 5176 #define op_vr_ldst(name) (*gen_op_##name[ctx->mem_idx])()
5690   -#if defined(CONFIG_USER_ONLY)
5691   -#if defined(TARGET_PPC64)
5692   -/* User-mode only - 64 bits mode */
5693   -#define OP_VR_LD_TABLE(name) \
5694   -static GenOpFunc *gen_op_vr_l##name[] = { \
5695   - &gen_op_vr_l##name##_raw, \
5696   - &gen_op_vr_l##name##_le_raw, \
5697   - &gen_op_vr_l##name##_64_raw, \
5698   - &gen_op_vr_l##name##_le_64_raw, \
5699   -};
5700   -#define OP_VR_ST_TABLE(name) \
5701   -static GenOpFunc *gen_op_vr_st##name[] = { \
5702   - &gen_op_vr_st##name##_raw, \
5703   - &gen_op_vr_st##name##_le_raw, \
5704   - &gen_op_vr_st##name##_64_raw, \
5705   - &gen_op_vr_st##name##_le_64_raw, \
5706   -};
5707   -#else /* defined(TARGET_PPC64) */
5708   -/* User-mode only - 32 bits mode */
5709   -#define OP_VR_LD_TABLE(name) \
5710   -static GenOpFunc *gen_op_vr_l##name[] = { \
5711   - &gen_op_vr_l##name##_raw, \
5712   - &gen_op_vr_l##name##_le_raw, \
5713   -};
5714   -#define OP_VR_ST_TABLE(name) \
5715   -static GenOpFunc *gen_op_vr_st##name[] = { \
5716   - &gen_op_vr_st##name##_raw, \
5717   - &gen_op_vr_st##name##_le_raw, \
5718   -};
5719   -#endif /* defined(TARGET_PPC64) */
5720   -#else /* defined(CONFIG_USER_ONLY) */
5721   -#if defined(TARGET_PPC64H)
5722   -/* Full system with hypervisor mode */
5723   -#define OP_VR_LD_TABLE(name) \
5724   -static GenOpFunc *gen_op_vr_l##name[] = { \
5725   - &gen_op_vr_l##name##_user, \
5726   - &gen_op_vr_l##name##_le_user, \
5727   - &gen_op_vr_l##name##_64_user, \
5728   - &gen_op_vr_l##name##_le_64_user, \
5729   - &gen_op_vr_l##name##_kernel, \
5730   - &gen_op_vr_l##name##_le_kernel, \
5731   - &gen_op_vr_l##name##_64_kernel, \
5732   - &gen_op_vr_l##name##_le_64_kernel, \
5733   - &gen_op_vr_l##name##_hypv, \
5734   - &gen_op_vr_l##name##_le_hypv, \
5735   - &gen_op_vr_l##name##_64_hypv, \
5736   - &gen_op_vr_l##name##_le_64_hypv, \
5737   -};
5738   -#define OP_VR_ST_TABLE(name) \
5739   -static GenOpFunc *gen_op_vr_st##name[] = { \
5740   - &gen_op_vr_st##name##_user, \
5741   - &gen_op_vr_st##name##_le_user, \
5742   - &gen_op_vr_st##name##_64_user, \
5743   - &gen_op_vr_st##name##_le_64_user, \
5744   - &gen_op_vr_st##name##_kernel, \
5745   - &gen_op_vr_st##name##_le_kernel, \
5746   - &gen_op_vr_st##name##_64_kernel, \
5747   - &gen_op_vr_st##name##_le_64_kernel, \
5748   - &gen_op_vr_st##name##_hypv, \
5749   - &gen_op_vr_st##name##_le_hypv, \
5750   - &gen_op_vr_st##name##_64_hypv, \
5751   - &gen_op_vr_st##name##_le_64_hypv, \
5752   -};
5753   -#elif defined(TARGET_PPC64)
5754   -/* Full system - 64 bits mode */
5755 5177 #define OP_VR_LD_TABLE(name) \
5756   -static GenOpFunc *gen_op_vr_l##name[] = { \
5757   - &gen_op_vr_l##name##_user, \
5758   - &gen_op_vr_l##name##_le_user, \
5759   - &gen_op_vr_l##name##_64_user, \
5760   - &gen_op_vr_l##name##_le_64_user, \
5761   - &gen_op_vr_l##name##_kernel, \
5762   - &gen_op_vr_l##name##_le_kernel, \
5763   - &gen_op_vr_l##name##_64_kernel, \
5764   - &gen_op_vr_l##name##_le_64_kernel, \
  5178 +static GenOpFunc *gen_op_vr_l##name[NB_MEM_FUNCS] = { \
  5179 + GEN_MEM_FUNCS(vr_l##name), \
5765 5180 };
5766 5181 #define OP_VR_ST_TABLE(name) \
5767   -static GenOpFunc *gen_op_vr_st##name[] = { \
5768   - &gen_op_vr_st##name##_user, \
5769   - &gen_op_vr_st##name##_le_user, \
5770   - &gen_op_vr_st##name##_64_user, \
5771   - &gen_op_vr_st##name##_le_64_user, \
5772   - &gen_op_vr_st##name##_kernel, \
5773   - &gen_op_vr_st##name##_le_kernel, \
5774   - &gen_op_vr_st##name##_64_kernel, \
5775   - &gen_op_vr_st##name##_le_64_kernel, \
  5182 +static GenOpFunc *gen_op_vr_st##name[NB_MEM_FUNCS] = { \
  5183 + GEN_MEM_FUNCS(vr_st##name), \
5776 5184 };
5777   -#else /* defined(TARGET_PPC64) */
5778   -/* Full system - 32 bits mode */
5779   -#define OP_VR_LD_TABLE(name) \
5780   -static GenOpFunc *gen_op_vr_l##name[] = { \
5781   - &gen_op_vr_l##name##_user, \
5782   - &gen_op_vr_l##name##_le_user, \
5783   - &gen_op_vr_l##name##_kernel, \
5784   - &gen_op_vr_l##name##_le_kernel, \
5785   -};
5786   -#define OP_VR_ST_TABLE(name) \
5787   -static GenOpFunc *gen_op_vr_st##name[] = { \
5788   - &gen_op_vr_st##name##_user, \
5789   - &gen_op_vr_st##name##_le_user, \
5790   - &gen_op_vr_st##name##_kernel, \
5791   - &gen_op_vr_st##name##_le_kernel, \
5792   -};
5793   -#endif /* defined(TARGET_PPC64) */
5794   -#endif /* defined(CONFIG_USER_ONLY) */
5795 5185  
5796 5186 #define GEN_VR_LDX(name, opc2, opc3) \
5797 5187 GEN_HANDLER(l##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC) \
... ... @@ -5830,7 +5220,6 @@ GEN_VR_STX(vx, 0x07, 0x07);
5830 5220 GEN_VR_STX(vxl, 0x07, 0x0F);
5831 5221  
5832 5222 /*** SPE extension ***/
5833   -
5834 5223 /* Register moves */
5835 5224 #if !defined(TARGET_PPC64)
5836 5225  
... ... @@ -5893,111 +5282,14 @@ static always_inline void gen_addr_spe_imm_index (DisasContext *ctx, int sh)
5893 5282 }
5894 5283  
5895 5284 #define op_spe_ldst(name) (*gen_op_##name[ctx->mem_idx])()
5896   -#if defined(CONFIG_USER_ONLY)
5897   -#if defined(TARGET_PPC64)
5898   -/* User-mode only - 64 bits mode */
5899   -#define OP_SPE_LD_TABLE(name) \
5900   -static GenOpFunc *gen_op_spe_l##name[] = { \
5901   - &gen_op_spe_l##name##_raw, \
5902   - &gen_op_spe_l##name##_le_raw, \
5903   - &gen_op_spe_l##name##_64_raw, \
5904   - &gen_op_spe_l##name##_le_64_raw, \
5905   -};
5906   -#define OP_SPE_ST_TABLE(name) \
5907   -static GenOpFunc *gen_op_spe_st##name[] = { \
5908   - &gen_op_spe_st##name##_raw, \
5909   - &gen_op_spe_st##name##_le_raw, \
5910   - &gen_op_spe_st##name##_64_raw, \
5911   - &gen_op_spe_st##name##_le_64_raw, \
5912   -};
5913   -#else /* defined(TARGET_PPC64) */
5914   -/* User-mode only - 32 bits mode */
5915   -#define OP_SPE_LD_TABLE(name) \
5916   -static GenOpFunc *gen_op_spe_l##name[] = { \
5917   - &gen_op_spe_l##name##_raw, \
5918   - &gen_op_spe_l##name##_le_raw, \
5919   -};
5920   -#define OP_SPE_ST_TABLE(name) \
5921   -static GenOpFunc *gen_op_spe_st##name[] = { \
5922   - &gen_op_spe_st##name##_raw, \
5923   - &gen_op_spe_st##name##_le_raw, \
5924   -};
5925   -#endif /* defined(TARGET_PPC64) */
5926   -#else /* defined(CONFIG_USER_ONLY) */
5927   -#if defined(TARGET_PPC64H)
5928   -/* Full system with hypervisor mode */
5929 5285 #define OP_SPE_LD_TABLE(name) \
5930   -static GenOpFunc *gen_op_spe_l##name[] = { \
5931   - &gen_op_spe_l##name##_user, \
5932   - &gen_op_spe_l##name##_le_user, \
5933   - &gen_op_spe_l##name##_64_user, \
5934   - &gen_op_spe_l##name##_le_64_user, \
5935   - &gen_op_spe_l##name##_kernel, \
5936   - &gen_op_spe_l##name##_le_kernel, \
5937   - &gen_op_spe_l##name##_64_kernel, \
5938   - &gen_op_spe_l##name##_le_64_kernel, \
5939   - &gen_op_spe_l##name##_hypv, \
5940   - &gen_op_spe_l##name##_le_hypv, \
5941   - &gen_op_spe_l##name##_64_hypv, \
5942   - &gen_op_spe_l##name##_le_64_hypv, \
  5286 +static GenOpFunc *gen_op_spe_l##name[NB_MEM_FUNCS] = { \
  5287 + GEN_MEM_FUNCS(spe_l##name), \
5943 5288 };
5944 5289 #define OP_SPE_ST_TABLE(name) \
5945   -static GenOpFunc *gen_op_spe_st##name[] = { \
5946   - &gen_op_spe_st##name##_user, \
5947   - &gen_op_spe_st##name##_le_user, \
5948   - &gen_op_spe_st##name##_64_user, \
5949   - &gen_op_spe_st##name##_le_64_user, \
5950   - &gen_op_spe_st##name##_kernel, \
5951   - &gen_op_spe_st##name##_le_kernel, \
5952   - &gen_op_spe_st##name##_64_kernel, \
5953   - &gen_op_spe_st##name##_le_64_kernel, \
5954   - &gen_op_spe_st##name##_hypv, \
5955   - &gen_op_spe_st##name##_le_hypv, \
5956   - &gen_op_spe_st##name##_64_hypv, \
5957   - &gen_op_spe_st##name##_le_64_hypv, \
5958   -};
5959   -#elif defined(TARGET_PPC64)
5960   -/* Full system - 64 bits mode */
5961   -#define OP_SPE_LD_TABLE(name) \
5962   -static GenOpFunc *gen_op_spe_l##name[] = { \
5963   - &gen_op_spe_l##name##_user, \
5964   - &gen_op_spe_l##name##_le_user, \
5965   - &gen_op_spe_l##name##_64_user, \
5966   - &gen_op_spe_l##name##_le_64_user, \
5967   - &gen_op_spe_l##name##_kernel, \
5968   - &gen_op_spe_l##name##_le_kernel, \
5969   - &gen_op_spe_l##name##_64_kernel, \
5970   - &gen_op_spe_l##name##_le_64_kernel, \
  5290 +static GenOpFunc *gen_op_spe_st##name[NB_MEM_FUNCS] = { \
  5291 + GEN_MEM_FUNCS(spe_st##name), \
5971 5292 };
5972   -#define OP_SPE_ST_TABLE(name) \
5973   -static GenOpFunc *gen_op_spe_st##name[] = { \
5974   - &gen_op_spe_st##name##_user, \
5975   - &gen_op_spe_st##name##_le_user, \
5976   - &gen_op_spe_st##name##_64_user, \
5977   - &gen_op_spe_st##name##_le_64_user, \
5978   - &gen_op_spe_st##name##_kernel, \
5979   - &gen_op_spe_st##name##_le_kernel, \
5980   - &gen_op_spe_st##name##_64_kernel, \
5981   - &gen_op_spe_st##name##_le_64_kernel, \
5982   -};
5983   -#else /* defined(TARGET_PPC64) */
5984   -/* Full system - 32 bits mode */
5985   -#define OP_SPE_LD_TABLE(name) \
5986   -static GenOpFunc *gen_op_spe_l##name[] = { \
5987   - &gen_op_spe_l##name##_user, \
5988   - &gen_op_spe_l##name##_le_user, \
5989   - &gen_op_spe_l##name##_kernel, \
5990   - &gen_op_spe_l##name##_le_kernel, \
5991   -};
5992   -#define OP_SPE_ST_TABLE(name) \
5993   -static GenOpFunc *gen_op_spe_st##name[] = { \
5994   - &gen_op_spe_st##name##_user, \
5995   - &gen_op_spe_st##name##_le_user, \
5996   - &gen_op_spe_st##name##_kernel, \
5997   - &gen_op_spe_st##name##_le_kernel, \
5998   -};
5999   -#endif /* defined(TARGET_PPC64) */
6000   -#endif /* defined(CONFIG_USER_ONLY) */
6001 5293  
6002 5294 #define GEN_SPE_LD(name, sh) \
6003 5295 static always_inline void gen_evl##name (DisasContext *ctx) \
... ... @@ -6258,45 +5550,38 @@ GEN_HANDLER2(evsel3, "evsel", 0x04, 0x1f, 0x09, 0x00000000, PPC_SPE)
6258 5550 /* In that case, we already have 64 bits load & stores
6259 5551 * so, spe_ldd is equivalent to ld and spe_std is equivalent to std
6260 5552 */
6261   -#if defined(CONFIG_USER_ONLY)
6262   -#define gen_op_spe_ldd_raw gen_op_ld_raw
6263   -#define gen_op_spe_ldd_64_raw gen_op_ld_64_raw
6264   -#define gen_op_spe_ldd_le_raw gen_op_ld_le_raw
6265   -#define gen_op_spe_ldd_le_64_raw gen_op_ld_le_64_raw
6266   -#define gen_op_spe_stdd_raw gen_op_ld_raw
6267   -#define gen_op_spe_stdd_64_raw gen_op_std_64_raw
6268   -#define gen_op_spe_stdd_le_raw gen_op_std_le_raw
6269   -#define gen_op_spe_stdd_le_64_raw gen_op_std_le_64_raw
6270   -#else /* defined(CONFIG_USER_ONLY) */
6271   -#if defined(TARGET_PPC64H)
6272   -#define gen_op_spe_ldd_hypv gen_op_ld_hypv
6273   -#define gen_op_spe_ldd_64_hypv gen_op_ld_64_hypv
6274   -#define gen_op_spe_ldd_le_hypv gen_op_ld_hypv
6275   -#define gen_op_spe_ldd_le_64_hypv gen_op_ld_64_hypv
6276   -#endif
6277   -#define gen_op_spe_ldd_kernel gen_op_ld_kernel
6278   -#define gen_op_spe_ldd_64_kernel gen_op_ld_64_kernel
6279   -#define gen_op_spe_ldd_le_kernel gen_op_ld_kernel
6280   -#define gen_op_spe_ldd_le_64_kernel gen_op_ld_64_kernel
6281   -#define gen_op_spe_ldd_user gen_op_ld_user
6282   -#define gen_op_spe_ldd_64_user gen_op_ld_64_user
6283   -#define gen_op_spe_ldd_le_user gen_op_ld_le_user
6284   -#define gen_op_spe_ldd_le_64_user gen_op_ld_le_64_user
6285   -#if defined(TARGET_PPC64H)
6286   -#define gen_op_spe_stdd_hypv gen_op_std_hypv
6287   -#define gen_op_spe_stdd_64_hypv gen_op_std_64_hypv
6288   -#define gen_op_spe_stdd_le_hypv gen_op_std_hypv
6289   -#define gen_op_spe_stdd_le_64_hypv gen_op_std_64_hypv
6290   -#endif
6291   -#define gen_op_spe_stdd_kernel gen_op_std_kernel
6292   -#define gen_op_spe_stdd_64_kernel gen_op_std_64_kernel
6293   -#define gen_op_spe_stdd_le_kernel gen_op_std_kernel
6294   -#define gen_op_spe_stdd_le_64_kernel gen_op_std_64_kernel
6295   -#define gen_op_spe_stdd_user gen_op_std_user
6296   -#define gen_op_spe_stdd_64_user gen_op_std_64_user
6297   -#define gen_op_spe_stdd_le_user gen_op_std_le_user
6298   -#define gen_op_spe_stdd_le_64_user gen_op_std_le_64_user
6299   -#endif /* defined(CONFIG_USER_ONLY) */
  5553 +#define gen_op_spe_ldd_raw gen_op_ld_raw
  5554 +#define gen_op_spe_ldd_user gen_op_ld_user
  5555 +#define gen_op_spe_ldd_kernel gen_op_ld_kernel
  5556 +#define gen_op_spe_ldd_hypv gen_op_ld_hypv
  5557 +#define gen_op_spe_ldd_64_raw gen_op_ld_64_raw
  5558 +#define gen_op_spe_ldd_64_user gen_op_ld_64_user
  5559 +#define gen_op_spe_ldd_64_kernel gen_op_ld_64_kernel
  5560 +#define gen_op_spe_ldd_64_hypv gen_op_ld_64_hypv
  5561 +#define gen_op_spe_ldd_le_raw gen_op_ld_le_raw
  5562 +#define gen_op_spe_ldd_le_user gen_op_ld_le_user
  5563 +#define gen_op_spe_ldd_le_kernel gen_op_ld_le_kernel
  5564 +#define gen_op_spe_ldd_le_hypv gen_op_ld_le_hypv
  5565 +#define gen_op_spe_ldd_le_64_raw gen_op_ld_le_64_raw
  5566 +#define gen_op_spe_ldd_le_64_user gen_op_ld_le_64_user
  5567 +#define gen_op_spe_ldd_le_64_kernel gen_op_ld_le_64_kernel
  5568 +#define gen_op_spe_ldd_le_64_hypv gen_op_ld_le_64_hypv
  5569 +#define gen_op_spe_stdd_raw gen_op_std_raw
  5570 +#define gen_op_spe_stdd_user gen_op_std_user
  5571 +#define gen_op_spe_stdd_kernel gen_op_std_kernel
  5572 +#define gen_op_spe_stdd_hypv gen_op_std_hypv
  5573 +#define gen_op_spe_stdd_64_raw gen_op_std_64_raw
  5574 +#define gen_op_spe_stdd_64_user gen_op_std_64_user
  5575 +#define gen_op_spe_stdd_64_kernel gen_op_std_64_kernel
  5576 +#define gen_op_spe_stdd_64_hypv gen_op_std_64_hypv
  5577 +#define gen_op_spe_stdd_le_raw gen_op_std_le_raw
  5578 +#define gen_op_spe_stdd_le_user gen_op_std_le_user
  5579 +#define gen_op_spe_stdd_le_kernel gen_op_std_le_kernel
  5580 +#define gen_op_spe_stdd_le_hypv gen_op_std_le_hypv
  5581 +#define gen_op_spe_stdd_le_64_raw gen_op_std_le_64_raw
  5582 +#define gen_op_spe_stdd_le_64_user gen_op_std_le_64_user
  5583 +#define gen_op_spe_stdd_le_64_kernel gen_op_std_le_64_kernel
  5584 +#define gen_op_spe_stdd_le_64_hypv gen_op_std_le_64_hypv
6300 5585 #endif /* defined(TARGET_PPC64) */
6301 5586 GEN_SPEOP_LDST(dd, 3);
6302 5587 GEN_SPEOP_LDST(dw, 3);
... ... @@ -6308,27 +5593,22 @@ GEN_SPEOP_ST(who, 2);
6308 5593  
6309 5594 #if defined(TARGET_PPC64)
6310 5595 /* In that case, spe_stwwo is equivalent to stw */
6311   -#if defined(CONFIG_USER_ONLY)
6312   -#define gen_op_spe_stwwo_raw gen_op_stw_raw
6313   -#define gen_op_spe_stwwo_le_raw gen_op_stw_le_raw
6314   -#define gen_op_spe_stwwo_64_raw gen_op_stw_64_raw
6315   -#define gen_op_spe_stwwo_le_64_raw gen_op_stw_le_64_raw
6316   -#else
6317   -#define gen_op_spe_stwwo_user gen_op_stw_user
6318   -#define gen_op_spe_stwwo_le_user gen_op_stw_le_user
6319   -#define gen_op_spe_stwwo_64_user gen_op_stw_64_user
6320   -#define gen_op_spe_stwwo_le_64_user gen_op_stw_le_64_user
6321   -#define gen_op_spe_stwwo_kernel gen_op_stw_kernel
6322   -#define gen_op_spe_stwwo_le_kernel gen_op_stw_le_kernel
6323   -#define gen_op_spe_stwwo_64_kernel gen_op_stw_64_kernel
  5596 +#define gen_op_spe_stwwo_raw gen_op_stw_raw
  5597 +#define gen_op_spe_stwwo_user gen_op_stw_user
  5598 +#define gen_op_spe_stwwo_kernel gen_op_stw_kernel
  5599 +#define gen_op_spe_stwwo_hypv gen_op_stw_hypv
  5600 +#define gen_op_spe_stwwo_le_raw gen_op_stw_le_raw
  5601 +#define gen_op_spe_stwwo_le_user gen_op_stw_le_user
  5602 +#define gen_op_spe_stwwo_le_kernel gen_op_stw_le_kernel
  5603 +#define gen_op_spe_stwwo_le_hypv gen_op_stw_le_hypv
  5604 +#define gen_op_spe_stwwo_64_raw gen_op_stw_64_raw
  5605 +#define gen_op_spe_stwwo_64_user gen_op_stw_64_user
  5606 +#define gen_op_spe_stwwo_64_kernel gen_op_stw_64_kernel
  5607 +#define gen_op_spe_stwwo_64_hypv gen_op_stw_64_hypv
  5608 +#define gen_op_spe_stwwo_le_64_raw gen_op_stw_le_64_raw
  5609 +#define gen_op_spe_stwwo_le_64_user gen_op_stw_le_64_user
6324 5610 #define gen_op_spe_stwwo_le_64_kernel gen_op_stw_le_64_kernel
6325   -#if defined(TARGET_PPC64H)
6326   -#define gen_op_spe_stwwo_hypv gen_op_stw_hypv
6327   -#define gen_op_spe_stwwo_le_hypv gen_op_stw_le_hypv
6328   -#define gen_op_spe_stwwo_64_hypv gen_op_stw_64_hypv
6329   -#define gen_op_spe_stwwo_le_64_hypv gen_op_stw_le_64_hypv
6330   -#endif
6331   -#endif
  5611 +#define gen_op_spe_stwwo_le_64_hypv gen_op_stw_le_64_hypv
6332 5612 #endif
6333 5613 #define _GEN_OP_SPE_STWWE(suffix) \
6334 5614 static always_inline void gen_op_spe_stwwe_##suffix (void) \
... ... @@ -6364,11 +5644,9 @@ _GEN_OP_SPE_STWWE_LE(suffix)
6364 5644 #if defined(CONFIG_USER_ONLY)
6365 5645 GEN_OP_SPE_STWWE(raw);
6366 5646 #else /* defined(CONFIG_USER_ONLY) */
6367   -#if defined(TARGET_PPC64H)
6368   -GEN_OP_SPE_STWWE(hypv);
6369   -#endif
6370   -GEN_OP_SPE_STWWE(kernel);
6371 5647 GEN_OP_SPE_STWWE(user);
  5648 +GEN_OP_SPE_STWWE(kernel);
  5649 +GEN_OP_SPE_STWWE(hypv);
6372 5650 #endif /* defined(CONFIG_USER_ONLY) */
6373 5651 GEN_SPEOP_ST(wwe, 2);
6374 5652 GEN_SPEOP_ST(wwo, 2);
... ... @@ -6418,107 +5696,67 @@ GEN_OP_SPE_LHX(le_64_raw);
6418 5696 GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_raw);
6419 5697 #endif
6420 5698 #else
6421   -#if defined(TARGET_PPC64H)
6422   -GEN_OP_SPE_LHE(hypv);
6423   -#endif
6424   -GEN_OP_SPE_LHE(kernel);
6425 5699 GEN_OP_SPE_LHE(user);
6426   -#if defined(TARGET_PPC64H)
6427   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, hypv);
6428   -#endif
6429   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, kernel);
  5700 +GEN_OP_SPE_LHE(kernel);
  5701 +GEN_OP_SPE_LHE(hypv);
6430 5702 GEN_SPE_LDSPLAT(hhesplat, spe_lhe, user);
6431   -#if defined(TARGET_PPC64H)
6432   -GEN_OP_SPE_LHE(le_hypv);
6433   -#endif
6434   -GEN_OP_SPE_LHE(le_kernel);
  5703 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, kernel);
  5704 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, hypv);
6435 5705 GEN_OP_SPE_LHE(le_user);
6436   -#if defined(TARGET_PPC64H)
6437   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_hypv);
6438   -#endif
6439   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_kernel);
  5706 +GEN_OP_SPE_LHE(le_kernel);
  5707 +GEN_OP_SPE_LHE(le_hypv);
6440 5708 GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_user);
6441   -#if defined(TARGET_PPC64H)
6442   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, hypv);
6443   -#endif
6444   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, kernel);
  5709 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_kernel);
  5710 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_hypv);
6445 5711 GEN_SPE_LDSPLAT(hhousplat, spe_lh, user);
6446   -#if defined(TARGET_PPC64H)
6447   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_hypv);
6448   -#endif
6449   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_kernel);
  5712 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, kernel);
  5713 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, hypv);
6450 5714 GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_user);
6451   -#if defined(TARGET_PPC64H)
6452   -GEN_OP_SPE_LHX(hypv);
6453   -#endif
6454   -GEN_OP_SPE_LHX(kernel);
  5715 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_kernel);
  5716 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_hypv);
6455 5717 GEN_OP_SPE_LHX(user);
6456   -#if defined(TARGET_PPC64H)
6457   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, hypv);
6458   -#endif
6459   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, kernel);
  5718 +GEN_OP_SPE_LHX(kernel);
  5719 +GEN_OP_SPE_LHX(hypv);
6460 5720 GEN_SPE_LDSPLAT(hhossplat, spe_lhx, user);
6461   -#if defined(TARGET_PPC64H)
6462   -GEN_OP_SPE_LHX(le_hypv);
6463   -#endif
6464   -GEN_OP_SPE_LHX(le_kernel);
  5721 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, kernel);
  5722 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, hypv);
6465 5723 GEN_OP_SPE_LHX(le_user);
6466   -#if defined(TARGET_PPC64H)
6467   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_hypv);
6468   -#endif
6469   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_kernel);
  5724 +GEN_OP_SPE_LHX(le_kernel);
  5725 +GEN_OP_SPE_LHX(le_hypv);
6470 5726 GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_user);
  5727 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_kernel);
  5728 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_hypv);
6471 5729 #if defined(TARGET_PPC64)
6472   -#if defined(TARGET_PPC64H)
6473   -GEN_OP_SPE_LHE(64_hypv);
6474   -#endif
6475   -GEN_OP_SPE_LHE(64_kernel);
6476 5730 GEN_OP_SPE_LHE(64_user);
6477   -#if defined(TARGET_PPC64H)
6478   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_hypv);
6479   -#endif
6480   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_kernel);
  5731 +GEN_OP_SPE_LHE(64_kernel);
  5732 +GEN_OP_SPE_LHE(64_hypv);
6481 5733 GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_user);
6482   -#if defined(TARGET_PPC64H)
6483   -GEN_OP_SPE_LHE(le_64_hypv);
6484   -#endif
6485   -GEN_OP_SPE_LHE(le_64_kernel);
  5734 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_kernel);
  5735 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_hypv);
6486 5736 GEN_OP_SPE_LHE(le_64_user);
6487   -#if defined(TARGET_PPC64H)
6488   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_hypv);
6489   -#endif
6490   -GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_kernel);
  5737 +GEN_OP_SPE_LHE(le_64_kernel);
  5738 +GEN_OP_SPE_LHE(le_64_hypv);
6491 5739 GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_user);
6492   -#if defined(TARGET_PPC64H)
6493   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_hypv);
6494   -#endif
6495   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_kernel);
  5740 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_kernel);
  5741 +GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_hypv);
6496 5742 GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_user);
6497   -#if defined(TARGET_PPC64H)
6498   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_hypv);
6499   -#endif
6500   -GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_kernel);
  5743 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_kernel);
  5744 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_hypv);
6501 5745 GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_user);
6502   -#if defined(TARGET_PPC64H)
6503   -GEN_OP_SPE_LHX(64_hypv);
6504   -#endif
6505   -GEN_OP_SPE_LHX(64_kernel);
  5746 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_kernel);
  5747 +GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_hypv);
6506 5748 GEN_OP_SPE_LHX(64_user);
6507   -#if defined(TARGET_PPC64H)
6508   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_hypv);
6509   -#endif
6510   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_kernel);
  5749 +GEN_OP_SPE_LHX(64_kernel);
  5750 +GEN_OP_SPE_LHX(64_hypv);
6511 5751 GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_user);
6512   -#if defined(TARGET_PPC64H)
6513   -GEN_OP_SPE_LHX(le_64_hypv);
6514   -#endif
6515   -GEN_OP_SPE_LHX(le_64_kernel);
  5752 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_kernel);
  5753 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_hypv);
6516 5754 GEN_OP_SPE_LHX(le_64_user);
6517   -#if defined(TARGET_PPC64H)
6518   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_hypv);
6519   -#endif
6520   -GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_kernel);
  5755 +GEN_OP_SPE_LHX(le_64_kernel);
  5756 +GEN_OP_SPE_LHX(le_64_hypv);
6521 5757 GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_user);
  5758 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_kernel);
  5759 +GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_hypv);
6522 5760 #endif
6523 5761 #endif
6524 5762 GEN_SPEOP_LD(hhesplat, 1);
... ...
translate-all.c
... ... @@ -264,7 +264,8 @@ int cpu_restore_state(TranslationBlock *tb,
264 264 #else
265 265 #define CASE3(op)\
266 266 case INDEX_op_ ## op ## _user:\
267   - case INDEX_op_ ## op ## _kernel
  267 + case INDEX_op_ ## op ## _kernel:\
  268 + case INDEX_op_ ## op ## _hypv
268 269 #endif
269 270  
270 271 CASE3(stfd):
... ...