Commit e85e7c6ea411c42e24e6e7b8ff5cdd99faae317a
1 parent
b5334159
Use the new TARGET_ABI32 feature to implement a ppc64abi32-linux-user target
(PowerPC 64 running in 32 bits mode). Use the new TARGET_ABI_DIR feature to implement a ppcemb-linux-user target (PowerPC 32 with 64 bits GPRs and vector extensions). git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3409 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
24 additions
and
11 deletions
configure
| ... | ... | @@ -504,7 +504,7 @@ if test -z "$target_list" ; then |
| 504 | 504 | fi |
| 505 | 505 | # the following are Linux specific |
| 506 | 506 | if [ "$linux_user" = "yes" ] ; then |
| 507 | - target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user ppc-linux-user ppc64-linux-user x86_64-linux-user cris-linux-user $target_list" | |
| 507 | + target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user ppc-linux-user ppcemb-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list" | |
| 508 | 508 | fi |
| 509 | 509 | # the following are Darwin specific |
| 510 | 510 | if [ "$darwin_user" = "yes" ] ; then |
| ... | ... | @@ -937,6 +937,7 @@ target_bigendian="no" |
| 937 | 937 | [ "$target_cpu" = "ppc" ] && target_bigendian=yes |
| 938 | 938 | [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes |
| 939 | 939 | [ "$target_cpu" = "ppc64" ] && target_bigendian=yes |
| 940 | +[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes | |
| 940 | 941 | [ "$target_cpu" = "ppc64h" ] && target_bigendian=yes |
| 941 | 942 | [ "$target_cpu" = "mips" ] && target_bigendian=yes |
| 942 | 943 | [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes |
| ... | ... | @@ -1040,6 +1041,7 @@ elif test "$target_cpu" = "ppc" ; then |
| 1040 | 1041 | echo "#define TARGET_PPC 1" >> $config_h |
| 1041 | 1042 | elif test "$target_cpu" = "ppcemb" ; then |
| 1042 | 1043 | echo "TARGET_ARCH=ppcemb" >> $config_mak |
| 1044 | + echo "TARGET_ABI_DIR=ppc" >> $config_mak | |
| 1043 | 1045 | echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h |
| 1044 | 1046 | echo "#define TARGET_PPC 1" >> $config_h |
| 1045 | 1047 | echo "#define TARGET_PPCEMB 1" >> $config_h |
| ... | ... | @@ -1048,6 +1050,13 @@ elif test "$target_cpu" = "ppc64" ; then |
| 1048 | 1050 | echo "#define TARGET_ARCH \"ppc64\"" >> $config_h |
| 1049 | 1051 | echo "#define TARGET_PPC 1" >> $config_h |
| 1050 | 1052 | echo "#define TARGET_PPC64 1" >> $config_h |
| 1053 | +elif test "$target_cpu" = "ppc64abi32" ; then | |
| 1054 | + echo "TARGET_ARCH=ppc64" >> $config_mak | |
| 1055 | + echo "#define TARGET_ARCH \"ppc64\"" >> $config_h | |
| 1056 | + echo "TARGET_ABI_DIR=ppc" >> $config_mak | |
| 1057 | + echo "#define TARGET_PPC 1" >> $config_h | |
| 1058 | + echo "#define TARGET_PPC64 1" >> $config_h | |
| 1059 | + echo "#define TARGET_ABI32 1" >> $config_h | |
| 1051 | 1060 | elif test "$target_cpu" = "ppc64h" ; then |
| 1052 | 1061 | echo "TARGET_ARCH=ppc64h" >> $config_mak |
| 1053 | 1062 | echo "#define TARGET_ARCH \"ppc64h\"" >> $config_h | ... | ... |
linux-user/elfload.c
| ... | ... | @@ -269,7 +269,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i |
| 269 | 269 | |
| 270 | 270 | #define ELF_START_MMAP 0x80000000 |
| 271 | 271 | |
| 272 | -#ifdef TARGET_PPC64 | |
| 272 | +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) | |
| 273 | 273 | |
| 274 | 274 | #define elf_check_arch(x) ( (x) == EM_PPC64 ) |
| 275 | 275 | |
| ... | ... | @@ -325,13 +325,13 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info * |
| 325 | 325 | { |
| 326 | 326 | abi_ulong pos = infop->start_stack; |
| 327 | 327 | abi_ulong tmp; |
| 328 | -#ifdef TARGET_PPC64 | |
| 328 | +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) | |
| 329 | 329 | abi_ulong entry, toc; |
| 330 | 330 | #endif |
| 331 | 331 | |
| 332 | 332 | _regs->msr = 1 << MSR_PR; /* Set user mode */ |
| 333 | 333 | _regs->gpr[1] = infop->start_stack; |
| 334 | -#ifdef TARGET_PPC64 | |
| 334 | +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) | |
| 335 | 335 | entry = ldq_raw(infop->entry) + infop->load_addr; |
| 336 | 336 | toc = ldq_raw(infop->entry + 8) + infop->load_addr; |
| 337 | 337 | _regs->gpr[2] = toc; | ... | ... |
linux-user/main.c
| ... | ... | @@ -1008,7 +1008,7 @@ void cpu_loop(CPUPPCState *env) |
| 1008 | 1008 | "Aborting\n"); |
| 1009 | 1009 | break; |
| 1010 | 1010 | #endif /* defined(TARGET_PPCEMB) */ |
| 1011 | -#if defined(TARGET_PPC64) /* PowerPC 64 */ | |
| 1011 | +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) /* PowerPC 64 */ | |
| 1012 | 1012 | case POWERPC_EXCP_DSEG: /* Data segment exception */ |
| 1013 | 1013 | cpu_abort(env, "Data segment exception while in user mode. " |
| 1014 | 1014 | "Aborting\n"); |
| ... | ... | @@ -1017,19 +1017,21 @@ void cpu_loop(CPUPPCState *env) |
| 1017 | 1017 | cpu_abort(env, "Instruction segment exception " |
| 1018 | 1018 | "while in user mode. Aborting\n"); |
| 1019 | 1019 | break; |
| 1020 | -#endif /* defined(TARGET_PPC64) */ | |
| 1021 | -#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ | |
| 1020 | +#endif /* defined(TARGET_PPC64) && !defined(TARGET_ABI32) */ | |
| 1021 | +#if defined(TARGET_PPC64H) && !defined(TARGET_ABI32) | |
| 1022 | + /* PowerPC 64 with hypervisor mode support */ | |
| 1022 | 1023 | case POWERPC_EXCP_HDECR: /* Hypervisor decrementer exception */ |
| 1023 | 1024 | cpu_abort(env, "Hypervisor decrementer interrupt " |
| 1024 | 1025 | "while in user mode. Aborting\n"); |
| 1025 | 1026 | break; |
| 1026 | -#endif /* defined(TARGET_PPC64H) */ | |
| 1027 | +#endif /* defined(TARGET_PPC64H) && !defined(TARGET_ABI32) */ | |
| 1027 | 1028 | case POWERPC_EXCP_TRACE: /* Trace exception */ |
| 1028 | 1029 | /* Nothing to do: |
| 1029 | 1030 | * we use this exception to emulate step-by-step execution mode. |
| 1030 | 1031 | */ |
| 1031 | 1032 | break; |
| 1032 | -#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ | |
| 1033 | +#if defined(TARGET_PPC64H) && !defined(TARGET_ABI32) | |
| 1034 | + /* PowerPC 64 with hypervisor mode support */ | |
| 1033 | 1035 | case POWERPC_EXCP_HDSI: /* Hypervisor data storage exception */ |
| 1034 | 1036 | cpu_abort(env, "Hypervisor data storage exception " |
| 1035 | 1037 | "while in user mode. Aborting\n"); |
| ... | ... | @@ -1046,7 +1048,7 @@ void cpu_loop(CPUPPCState *env) |
| 1046 | 1048 | cpu_abort(env, "Hypervisor instruction segment exception " |
| 1047 | 1049 | "while in user mode. Aborting\n"); |
| 1048 | 1050 | break; |
| 1049 | -#endif /* defined(TARGET_PPC64H) */ | |
| 1051 | +#endif /* defined(TARGET_PPC64H) && !defined(TARGET_ABI32) */ | |
| 1050 | 1052 | case POWERPC_EXCP_VPU: /* Vector unavailable exception */ |
| 1051 | 1053 | EXCP_DUMP(env, "No Altivec instructions allowed\n"); |
| 1052 | 1054 | info.si_signo = TARGET_SIGILL; |
| ... | ... | @@ -2170,8 +2172,10 @@ int main(int argc, char **argv) |
| 2170 | 2172 | if (i != 12 && i != 6 && i != 13) |
| 2171 | 2173 | env->msr[i] = (regs->msr >> i) & 1; |
| 2172 | 2174 | } |
| 2173 | -#if defined(TARGET_PPC64) | |
| 2175 | +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) | |
| 2174 | 2176 | msr_sf = 1; |
| 2177 | +#else | |
| 2178 | + msr_sf = 0; | |
| 2175 | 2179 | #endif |
| 2176 | 2180 | env->nip = regs->nip; |
| 2177 | 2181 | for(i = 0; i < 32; i++) { | ... | ... |