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
This commit is contained in:
j_mayer 2007-10-18 19:59:49 +00:00
parent b533415989
commit e85e7c6ea4
3 changed files with 24 additions and 11 deletions

11
configure vendored
View File

@ -504,7 +504,7 @@ if test -z "$target_list" ; then
fi fi
# the following are Linux specific # the following are Linux specific
if [ "$linux_user" = "yes" ] ; then if [ "$linux_user" = "yes" ] ; then
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" 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"
fi fi
# the following are Darwin specific # the following are Darwin specific
if [ "$darwin_user" = "yes" ] ; then if [ "$darwin_user" = "yes" ] ; then
@ -937,6 +937,7 @@ target_bigendian="no"
[ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
[ "$target_cpu" = "ppc64h" ] && target_bigendian=yes [ "$target_cpu" = "ppc64h" ] && target_bigendian=yes
[ "$target_cpu" = "mips" ] && target_bigendian=yes [ "$target_cpu" = "mips" ] && target_bigendian=yes
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
@ -1040,6 +1041,7 @@ elif test "$target_cpu" = "ppc" ; then
echo "#define TARGET_PPC 1" >> $config_h echo "#define TARGET_PPC 1" >> $config_h
elif test "$target_cpu" = "ppcemb" ; then elif test "$target_cpu" = "ppcemb" ; then
echo "TARGET_ARCH=ppcemb" >> $config_mak echo "TARGET_ARCH=ppcemb" >> $config_mak
echo "TARGET_ABI_DIR=ppc" >> $config_mak
echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
echo "#define TARGET_PPC 1" >> $config_h echo "#define TARGET_PPC 1" >> $config_h
echo "#define TARGET_PPCEMB 1" >> $config_h echo "#define TARGET_PPCEMB 1" >> $config_h
@ -1048,6 +1050,13 @@ elif test "$target_cpu" = "ppc64" ; then
echo "#define TARGET_ARCH \"ppc64\"" >> $config_h echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
echo "#define TARGET_PPC 1" >> $config_h echo "#define TARGET_PPC 1" >> $config_h
echo "#define TARGET_PPC64 1" >> $config_h echo "#define TARGET_PPC64 1" >> $config_h
elif test "$target_cpu" = "ppc64abi32" ; then
echo "TARGET_ARCH=ppc64" >> $config_mak
echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
echo "TARGET_ABI_DIR=ppc" >> $config_mak
echo "#define TARGET_PPC 1" >> $config_h
echo "#define TARGET_PPC64 1" >> $config_h
echo "#define TARGET_ABI32 1" >> $config_h
elif test "$target_cpu" = "ppc64h" ; then elif test "$target_cpu" = "ppc64h" ; then
echo "TARGET_ARCH=ppc64h" >> $config_mak echo "TARGET_ARCH=ppc64h" >> $config_mak
echo "#define TARGET_ARCH \"ppc64h\"" >> $config_h echo "#define TARGET_ARCH \"ppc64h\"" >> $config_h

View File

@ -269,7 +269,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
#define ELF_START_MMAP 0x80000000 #define ELF_START_MMAP 0x80000000
#ifdef TARGET_PPC64 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
#define elf_check_arch(x) ( (x) == EM_PPC64 ) #define elf_check_arch(x) ( (x) == EM_PPC64 )
@ -325,13 +325,13 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
{ {
abi_ulong pos = infop->start_stack; abi_ulong pos = infop->start_stack;
abi_ulong tmp; abi_ulong tmp;
#ifdef TARGET_PPC64 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
abi_ulong entry, toc; abi_ulong entry, toc;
#endif #endif
_regs->msr = 1 << MSR_PR; /* Set user mode */ _regs->msr = 1 << MSR_PR; /* Set user mode */
_regs->gpr[1] = infop->start_stack; _regs->gpr[1] = infop->start_stack;
#ifdef TARGET_PPC64 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
entry = ldq_raw(infop->entry) + infop->load_addr; entry = ldq_raw(infop->entry) + infop->load_addr;
toc = ldq_raw(infop->entry + 8) + infop->load_addr; toc = ldq_raw(infop->entry + 8) + infop->load_addr;
_regs->gpr[2] = toc; _regs->gpr[2] = toc;

View File

@ -1008,7 +1008,7 @@ void cpu_loop(CPUPPCState *env)
"Aborting\n"); "Aborting\n");
break; break;
#endif /* defined(TARGET_PPCEMB) */ #endif /* defined(TARGET_PPCEMB) */
#if defined(TARGET_PPC64) /* PowerPC 64 */ #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) /* PowerPC 64 */
case POWERPC_EXCP_DSEG: /* Data segment exception */ case POWERPC_EXCP_DSEG: /* Data segment exception */
cpu_abort(env, "Data segment exception while in user mode. " cpu_abort(env, "Data segment exception while in user mode. "
"Aborting\n"); "Aborting\n");
@ -1017,19 +1017,21 @@ void cpu_loop(CPUPPCState *env)
cpu_abort(env, "Instruction segment exception " cpu_abort(env, "Instruction segment exception "
"while in user mode. Aborting\n"); "while in user mode. Aborting\n");
break; break;
#endif /* defined(TARGET_PPC64) */ #endif /* defined(TARGET_PPC64) && !defined(TARGET_ABI32) */
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ #if defined(TARGET_PPC64H) && !defined(TARGET_ABI32)
/* PowerPC 64 with hypervisor mode support */
case POWERPC_EXCP_HDECR: /* Hypervisor decrementer exception */ case POWERPC_EXCP_HDECR: /* Hypervisor decrementer exception */
cpu_abort(env, "Hypervisor decrementer interrupt " cpu_abort(env, "Hypervisor decrementer interrupt "
"while in user mode. Aborting\n"); "while in user mode. Aborting\n");
break; break;
#endif /* defined(TARGET_PPC64H) */ #endif /* defined(TARGET_PPC64H) && !defined(TARGET_ABI32) */
case POWERPC_EXCP_TRACE: /* Trace exception */ case POWERPC_EXCP_TRACE: /* Trace exception */
/* Nothing to do: /* Nothing to do:
* we use this exception to emulate step-by-step execution mode. * we use this exception to emulate step-by-step execution mode.
*/ */
break; break;
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ #if defined(TARGET_PPC64H) && !defined(TARGET_ABI32)
/* PowerPC 64 with hypervisor mode support */
case POWERPC_EXCP_HDSI: /* Hypervisor data storage exception */ case POWERPC_EXCP_HDSI: /* Hypervisor data storage exception */
cpu_abort(env, "Hypervisor data storage exception " cpu_abort(env, "Hypervisor data storage exception "
"while in user mode. Aborting\n"); "while in user mode. Aborting\n");
@ -1046,7 +1048,7 @@ void cpu_loop(CPUPPCState *env)
cpu_abort(env, "Hypervisor instruction segment exception " cpu_abort(env, "Hypervisor instruction segment exception "
"while in user mode. Aborting\n"); "while in user mode. Aborting\n");
break; break;
#endif /* defined(TARGET_PPC64H) */ #endif /* defined(TARGET_PPC64H) && !defined(TARGET_ABI32) */
case POWERPC_EXCP_VPU: /* Vector unavailable exception */ case POWERPC_EXCP_VPU: /* Vector unavailable exception */
EXCP_DUMP(env, "No Altivec instructions allowed\n"); EXCP_DUMP(env, "No Altivec instructions allowed\n");
info.si_signo = TARGET_SIGILL; info.si_signo = TARGET_SIGILL;
@ -2170,8 +2172,10 @@ int main(int argc, char **argv)
if (i != 12 && i != 6 && i != 13) if (i != 12 && i != 6 && i != 13)
env->msr[i] = (regs->msr >> i) & 1; env->msr[i] = (regs->msr >> i) & 1;
} }
#if defined(TARGET_PPC64) #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
msr_sf = 1; msr_sf = 1;
#else
msr_sf = 0;
#endif #endif
env->nip = regs->nip; env->nip = regs->nip;
for(i = 0; i < 32; i++) { for(i = 0; i < 32; i++) {