Commit 35cdaad645d7a97e67690582feb1fc3a050c92ad

Authored by j_mayer
1 parent c294fc58

Code provision for new PowerPC embedded target support with:

- 1 kB page size
- 64 bits GPR
- 64 bits physical address space
- SPE extension support.
Change TARGET_PPCSPE into TARGET_PPCEMB


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2718 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/cpu.h
@@ -23,11 +23,13 @@ @@ -23,11 +23,13 @@
23 #include "config.h" 23 #include "config.h"
24 #include <inttypes.h> 24 #include <inttypes.h>
25 25
  26 +#if !defined(TARGET_PPCEMB)
26 #if defined(TARGET_PPC64) || (HOST_LONG_BITS >= 64) 27 #if defined(TARGET_PPC64) || (HOST_LONG_BITS >= 64)
27 /* When using 64 bits temporary registers, 28 /* When using 64 bits temporary registers,
28 * we can use 64 bits GPR with no extra cost 29 * we can use 64 bits GPR with no extra cost
29 */ 30 */
30 -#define TARGET_PPCSPE 31 +#define TARGET_PPCEMB
  32 +#endif
31 #endif 33 #endif
32 34
33 #if defined (TARGET_PPC64) 35 #if defined (TARGET_PPC64)
@@ -35,7 +37,8 @@ typedef uint64_t ppc_gpr_t; @@ -35,7 +37,8 @@ typedef uint64_t ppc_gpr_t;
35 #define TARGET_LONG_BITS 64 37 #define TARGET_LONG_BITS 64
36 #define TARGET_GPR_BITS 64 38 #define TARGET_GPR_BITS 64
37 #define REGX "%016" PRIx64 39 #define REGX "%016" PRIx64
38 -#elif defined(TARGET_PPCSPE) 40 +#define TARGET_PAGE_BITS 12
  41 +#elif defined(TARGET_PPCEMB)
39 /* e500v2 have 36 bits physical address space */ 42 /* e500v2 have 36 bits physical address space */
40 #define TARGET_PHYS_ADDR_BITS 64 43 #define TARGET_PHYS_ADDR_BITS 64
41 /* GPR are 64 bits: used by vector extension */ 44 /* GPR are 64 bits: used by vector extension */
@@ -43,11 +46,14 @@ typedef uint64_t ppc_gpr_t; @@ -43,11 +46,14 @@ typedef uint64_t ppc_gpr_t;
43 #define TARGET_LONG_BITS 32 46 #define TARGET_LONG_BITS 32
44 #define TARGET_GPR_BITS 64 47 #define TARGET_GPR_BITS 64
45 #define REGX "%016" PRIx64 48 #define REGX "%016" PRIx64
  49 +/* Pages can be 1 kB small */
  50 +#define TARGET_PAGE_BITS 10
46 #else 51 #else
47 typedef uint32_t ppc_gpr_t; 52 typedef uint32_t ppc_gpr_t;
48 #define TARGET_LONG_BITS 32 53 #define TARGET_LONG_BITS 32
49 #define TARGET_GPR_BITS 32 54 #define TARGET_GPR_BITS 32
50 #define REGX "%08" PRIx32 55 #define REGX "%08" PRIx32
  56 +#define TARGET_PAGE_BITS 12
51 #endif 57 #endif
52 58
53 #include "cpu-defs.h" 59 #include "cpu-defs.h"
@@ -893,7 +899,6 @@ int ppcemb_tlb_search (CPUPPCState *env, target_ulong address); @@ -893,7 +899,6 @@ int ppcemb_tlb_search (CPUPPCState *env, target_ulong address);
893 int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp); 899 int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp);
894 int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); 900 int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val);
895 901
896 -#define TARGET_PAGE_BITS 12  
897 #include "cpu-all.h" 902 #include "cpu-all.h"
898 903
899 /*****************************************************************************/ 904 /*****************************************************************************/
target-ppc/exec.h
@@ -43,7 +43,7 @@ register unsigned long T1 asm(AREG2); @@ -43,7 +43,7 @@ register unsigned long T1 asm(AREG2);
43 register unsigned long T2 asm(AREG3); 43 register unsigned long T2 asm(AREG3);
44 #endif 44 #endif
45 /* We may, sometime, need 64 bits registers on 32 bits target */ 45 /* We may, sometime, need 64 bits registers on 32 bits target */
46 -#if defined(TARGET_PPC64) || defined(TARGET_PPCSPE) || (HOST_LONG_BITS == 64) 46 +#if defined(TARGET_PPC64) || defined(TARGET_PPCEMB) || (HOST_LONG_BITS == 64)
47 #define T0_64 T0 47 #define T0_64 T0
48 #define T1_64 T1 48 #define T1_64 T1
49 #define T2_64 T2 49 #define T2_64 T2
target-ppc/op.c
@@ -2479,7 +2479,7 @@ void OPPROTO op_store_booke_tsr (void) @@ -2479,7 +2479,7 @@ void OPPROTO op_store_booke_tsr (void)
2479 2479
2480 #endif /* !defined(CONFIG_USER_ONLY) */ 2480 #endif /* !defined(CONFIG_USER_ONLY) */
2481 2481
2482 -#if defined(TARGET_PPCSPE) 2482 +#if defined(TARGET_PPCEMB)
2483 /* SPE extension */ 2483 /* SPE extension */
2484 void OPPROTO op_splatw_T1_64 (void) 2484 void OPPROTO op_splatw_T1_64 (void)
2485 { 2485 {
@@ -3198,4 +3198,4 @@ void OPPROTO op_efdtsteq (void) @@ -3198,4 +3198,4 @@ void OPPROTO op_efdtsteq (void)
3198 T0 = _do_efdtsteq(T0_64, T1_64); 3198 T0 = _do_efdtsteq(T0_64, T1_64);
3199 RETURN(); 3199 RETURN();
3200 } 3200 }
3201 -#endif /* defined(TARGET_PPCSPE) */ 3201 +#endif /* defined(TARGET_PPCEMB) */
target-ppc/op_helper.c
@@ -1340,7 +1340,7 @@ void do_440_dlmzb (void) @@ -1340,7 +1340,7 @@ void do_440_dlmzb (void)
1340 T0 = i; 1340 T0 = i;
1341 } 1341 }
1342 1342
1343 -#if defined(TARGET_PPCSPE) 1343 +#if defined(TARGET_PPCEMB)
1344 /* SPE extension helpers */ 1344 /* SPE extension helpers */
1345 /* Use a table to make this quicker */ 1345 /* Use a table to make this quicker */
1346 static uint8_t hbrev[16] = { 1346 static uint8_t hbrev[16] = {
@@ -2200,7 +2200,7 @@ DO_SPE_OP1(fsctuiz); @@ -2200,7 +2200,7 @@ DO_SPE_OP1(fsctuiz);
2200 DO_SPE_OP1(fsctsf); 2200 DO_SPE_OP1(fsctsf);
2201 /* evfsctuf */ 2201 /* evfsctuf */
2202 DO_SPE_OP1(fsctuf); 2202 DO_SPE_OP1(fsctuf);
2203 -#endif /* defined(TARGET_PPCSPE) */ 2203 +#endif /* defined(TARGET_PPCEMB) */
2204 2204
2205 /*****************************************************************************/ 2205 /*****************************************************************************/
2206 /* Softmmu support */ 2206 /* Softmmu support */
target-ppc/op_helper.h
@@ -183,7 +183,7 @@ void do_load_403_pb (int num); @@ -183,7 +183,7 @@ void do_load_403_pb (int num);
183 void do_store_403_pb (int num); 183 void do_store_403_pb (int num);
184 #endif 184 #endif
185 185
186 -#if defined(TARGET_PPCSPE) 186 +#if defined(TARGET_PPCEMB)
187 /* SPE extension helpers */ 187 /* SPE extension helpers */
188 void do_brinc (void); 188 void do_brinc (void);
189 /* Fixed-point vector helpers */ 189 /* Fixed-point vector helpers */
@@ -264,7 +264,7 @@ void do_evfsctsi (void); @@ -264,7 +264,7 @@ void do_evfsctsi (void);
264 void do_evfsctui (void); 264 void do_evfsctui (void);
265 void do_evfsctsiz (void); 265 void do_evfsctsiz (void);
266 void do_evfsctuiz (void); 266 void do_evfsctuiz (void);
267 -#endif /* defined(TARGET_PPCSPE) */ 267 +#endif /* defined(TARGET_PPCEMB) */
268 268
269 /* Inlined helpers: used in micro-operation as well as helpers */ 269 /* Inlined helpers: used in micro-operation as well as helpers */
270 /* Generic fixed-point helpers */ 270 /* Generic fixed-point helpers */
@@ -338,7 +338,7 @@ static inline int _do_cntlzd (uint64_t val) @@ -338,7 +338,7 @@ static inline int _do_cntlzd (uint64_t val)
338 return cnt; 338 return cnt;
339 } 339 }
340 340
341 -#if defined(TARGET_PPCSPE) 341 +#if defined(TARGET_PPCEMB)
342 /* SPE extension */ 342 /* SPE extension */
343 /* Single precision floating-point helpers */ 343 /* Single precision floating-point helpers */
344 static inline uint32_t _do_efsabs (uint32_t val) 344 static inline uint32_t _do_efsabs (uint32_t val)
@@ -459,5 +459,5 @@ static inline int _do_efdtsteq (uint64_t op1, uint64_t op2) @@ -459,5 +459,5 @@ static inline int _do_efdtsteq (uint64_t op1, uint64_t op2)
459 u2.u = op2; 459 u2.u = op2;
460 return float64_eq(u1.f, u2.f, &env->spe_status) ? 1 : 0; 460 return float64_eq(u1.f, u2.f, &env->spe_status) ? 1 : 0;
461 } 461 }
462 -#endif /* defined(TARGET_PPCSPE) */ 462 +#endif /* defined(TARGET_PPCEMB) */
463 #endif 463 #endif
target-ppc/op_mem.h
@@ -37,7 +37,7 @@ static inline uint32_t glue(ld32r, MEMSUFFIX) (target_ulong EA) @@ -37,7 +37,7 @@ static inline uint32_t glue(ld32r, MEMSUFFIX) (target_ulong EA)
37 ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24); 37 ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24);
38 } 38 }
39 39
40 -#if defined(TARGET_PPC64) || defined(TARGET_PPCSPE) 40 +#if defined(TARGET_PPC64) || defined(TARGET_PPCEMB)
41 static inline uint64_t glue(ld64r, MEMSUFFIX) (target_ulong EA) 41 static inline uint64_t glue(ld64r, MEMSUFFIX) (target_ulong EA)
42 { 42 {
43 uint64_t tmp = glue(ldq, MEMSUFFIX)(EA); 43 uint64_t tmp = glue(ldq, MEMSUFFIX)(EA);
@@ -79,7 +79,7 @@ static inline void glue(st32r, MEMSUFFIX) (target_ulong EA, uint32_t data) @@ -79,7 +79,7 @@ static inline void glue(st32r, MEMSUFFIX) (target_ulong EA, uint32_t data)
79 glue(stl, MEMSUFFIX)(EA, tmp); 79 glue(stl, MEMSUFFIX)(EA, tmp);
80 } 80 }
81 81
82 -#if defined(TARGET_PPC64) || defined(TARGET_PPCSPE) 82 +#if defined(TARGET_PPC64) || defined(TARGET_PPCEMB)
83 static inline void glue(st64r, MEMSUFFIX) (target_ulong EA, uint64_t data) 83 static inline void glue(st64r, MEMSUFFIX) (target_ulong EA, uint64_t data)
84 { 84 {
85 uint64_t tmp = ((data & 0xFF00000000000000ULL) >> 56) | 85 uint64_t tmp = ((data & 0xFF00000000000000ULL) >> 56) |
@@ -895,7 +895,7 @@ void OPPROTO glue(op_POWER2_stfq_le, MEMSUFFIX) (void) @@ -895,7 +895,7 @@ void OPPROTO glue(op_POWER2_stfq_le, MEMSUFFIX) (void)
895 RETURN(); 895 RETURN();
896 } 896 }
897 897
898 -#if defined(TARGET_PPCSPE) 898 +#if defined(TARGET_PPCEMB)
899 /* SPE extension */ 899 /* SPE extension */
900 #define _PPC_SPE_LD_OP(name, op) \ 900 #define _PPC_SPE_LD_OP(name, op) \
901 void OPPROTO glue(glue(op_spe_l, name), MEMSUFFIX) (void) \ 901 void OPPROTO glue(glue(op_spe_l, name), MEMSUFFIX) (void) \
@@ -1151,6 +1151,6 @@ static inline uint64_t glue(spe_lwhsplat_le, MEMSUFFIX) (target_ulong EA) @@ -1151,6 +1151,6 @@ static inline uint64_t glue(spe_lwhsplat_le, MEMSUFFIX) (target_ulong EA)
1151 return ret; 1151 return ret;
1152 } 1152 }
1153 PPC_SPE_LD_OP(whsplat_le, spe_lwhsplat_le); 1153 PPC_SPE_LD_OP(whsplat_le, spe_lwhsplat_le);
1154 -#endif /* defined(TARGET_PPCSPE) */ 1154 +#endif /* defined(TARGET_PPCEMB) */
1155 1155
1156 #undef MEMSUFFIX 1156 #undef MEMSUFFIX
target-ppc/op_template.h
@@ -57,7 +57,7 @@ void OPPROTO glue(op_store_T2_gpr_gpr, REG) (void) @@ -57,7 +57,7 @@ void OPPROTO glue(op_store_T2_gpr_gpr, REG) (void)
57 } 57 }
58 #endif 58 #endif
59 59
60 -#if defined(TARGET_PPCSPE) 60 +#if defined(TARGET_PPCEMB)
61 void OPPROTO glue(op_load_gpr64_T0_gpr, REG) (void) 61 void OPPROTO glue(op_load_gpr64_T0_gpr, REG) (void)
62 { 62 {
63 T0_64 = regs->gpr[REG]; 63 T0_64 = regs->gpr[REG];
@@ -97,7 +97,7 @@ void OPPROTO glue(op_store_T2_gpr64_gpr, REG) (void) @@ -97,7 +97,7 @@ void OPPROTO glue(op_store_T2_gpr64_gpr, REG) (void)
97 RETURN(); 97 RETURN();
98 } 98 }
99 #endif 99 #endif
100 -#endif /* defined(TARGET_PPCSPE) */ 100 +#endif /* defined(TARGET_PPCEMB) */
101 101
102 #if REG <= 7 102 #if REG <= 7
103 /* Condition register moves */ 103 /* Condition register moves */
target-ppc/translate.c
@@ -161,7 +161,7 @@ typedef struct DisasContext { @@ -161,7 +161,7 @@ typedef struct DisasContext {
161 int sf_mode; 161 int sf_mode;
162 #endif 162 #endif
163 int fpu_enabled; 163 int fpu_enabled;
164 -#if defined(TARGET_PPCSPE) 164 +#if defined(TARGET_PPCEMB)
165 int spe_enabled; 165 int spe_enabled;
166 #endif 166 #endif
167 ppc_spr_t *spr_cb; /* Needed to check rights for mfspr/mtspr */ 167 ppc_spr_t *spr_cb; /* Needed to check rights for mfspr/mtspr */
@@ -4761,7 +4761,7 @@ GEN_HANDLER(icbt_440, 0x1F, 0x16, 0x00, 0x03E00001, PPC_BOOKE) @@ -4761,7 +4761,7 @@ GEN_HANDLER(icbt_440, 0x1F, 0x16, 0x00, 0x03E00001, PPC_BOOKE)
4761 */ 4761 */
4762 } 4762 }
4763 4763
4764 -#if defined(TARGET_PPCSPE) 4764 +#if defined(TARGET_PPCEMB)
4765 /*** SPE extension ***/ 4765 /*** SPE extension ***/
4766 4766
4767 /* Register moves */ 4767 /* Register moves */
@@ -5740,7 +5740,7 @@ static inline int gen_intermediate_code_internal (CPUState *env, @@ -5740,7 +5740,7 @@ static inline int gen_intermediate_code_internal (CPUState *env,
5740 ctx.sf_mode = msr_sf; 5740 ctx.sf_mode = msr_sf;
5741 #endif 5741 #endif
5742 ctx.fpu_enabled = msr_fp; 5742 ctx.fpu_enabled = msr_fp;
5743 -#if defined(TARGET_PPCSPE) 5743 +#if defined(TARGET_PPCEMB)
5744 ctx.spe_enabled = msr_spe; 5744 ctx.spe_enabled = msr_spe;
5745 #endif 5745 #endif
5746 ctx.singlestep_enabled = env->singlestep_enabled; 5746 ctx.singlestep_enabled = env->singlestep_enabled;