[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits ta
From: |
Thiemo Seufer |
Subject: |
Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets |
Date: |
Fri, 12 Oct 2007 19:42:29 +0100 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
Blue Swirl wrote:
[snip]
> Index: qemu/linux-user/mipsn32/syscall.h
> ===================================================================
> --- qemu.orig/linux-user/mipsn32/syscall.h 2007-10-11 19:17:14.000000000
> +0000
> +++ qemu/linux-user/mipsn32/syscall.h 2007-10-11 19:17:46.000000000 +0000
> @@ -4,15 +4,15 @@
>
> struct target_pt_regs {
> /* Saved main processor registers. */
> - target_ulong regs[32];
> + abi_ulong regs[32];
>
> /* Saved special registers. */
> - target_ulong cp0_status;
> - target_ulong lo;
> - target_ulong hi;
> - target_ulong cp0_badvaddr;
> - target_ulong cp0_cause;
> - target_ulong cp0_epc;
> + abi_ulong cp0_status;
> + abi_ulong lo;
> + abi_ulong hi;
> + abi_ulong cp0_badvaddr;
> + abi_ulong cp0_cause;
> + abi_ulong cp0_epc;
> };
This is broken. n32 has 64bit wide registers (and uses them for long long).
> /* Target errno definitions taken from asm-mips/errno.h */
> Index: qemu/linux-user/mipsn32/target_signal.h
> ===================================================================
> --- qemu.orig/linux-user/mipsn32/target_signal.h 2007-10-11
> 19:17:14.000000000 +0000
> +++ qemu/linux-user/mipsn32/target_signal.h 2007-10-11 19:17:46.000000000
> +0000
> @@ -21,7 +21,7 @@
> #define TARGET_MINSIGSTKSZ 2048
> #define TARGET_SIGSTKSZ 8192
>
> -static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state)
> +static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
> {
> return state->gpr[29][state->current_tc];
> }
Same problem.
[snip]
> Index: qemu/linux-user/signal.c
> ===================================================================
> --- qemu.orig/linux-user/signal.c 2007-10-11 19:17:13.000000000 +0000
> +++ qemu/linux-user/signal.c 2007-10-12 15:58:08.000000000 +0000
[snip]
> @@ -2013,12 +2013,12 @@
> uint32_t sc_dsp; /* dsp status, was sc_ssflags */
> uint64_t sc_mdhi;
> uint64_t sc_mdlo;
> - target_ulong sc_hi1; /* Was sc_cause */
> - target_ulong sc_lo1; /* Was sc_badvaddr */
> - target_ulong sc_hi2; /* Was sc_sigset[4] */
> - target_ulong sc_lo2;
> - target_ulong sc_hi3;
> - target_ulong sc_lo3;
> + abi_ulong sc_hi1; /* Was sc_cause */
> + abi_ulong sc_lo1; /* Was sc_badvaddr */
> + abi_ulong sc_hi2; /* Was sc_sigset[4] */
> + abi_ulong sc_lo2;
> + abi_ulong sc_hi3;
> + abi_ulong sc_lo3;
> };
Likewise. When comparing with Linux kernel headers keep in mind that
a 64bit MIPS kernel is always n64, so the data types used on the kernel
side don't match the n32 userland ones.
I'm probably just too used to it to find it confusing, taking the
glibc headers as a guideline might be easier for you. :-)
[snip]
> Index: qemu/linux-user/syscall_defs.h
> ===================================================================
> --- qemu.orig/linux-user/syscall_defs.h 2007-10-11 19:17:13.000000000
> +0000
> +++ qemu/linux-user/syscall_defs.h 2007-10-12 16:08:10.000000000 +0000
[snip]
> @@ -1272,7 +1272,7 @@
> unsigned int st_dev;
> unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
>
> - target_ulong st_ino;
> + abi_ulong st_ino;
>
> unsigned int st_mode;
> unsigned int st_nlink;
Another one. I leave out a few more instances which also break n32.
[snip]
> Index: qemu/configure
> ===================================================================
> --- qemu.orig/configure 2007-10-11 19:17:14.000000000 +0000
> +++ qemu/configure 2007-10-12 15:38:15.000000000 +0000
> @@ -504,7 +504,7 @@
> fi
> # the following are Linux specific
> if [ "$linux_user" = "yes" ] ; then
> - target_list="i386-linux-user arm-linux-user armeb-linux-user
> sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user
> m68k-linux-user alpha-linux-user ppc64-linux-user sh4-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 ppc-linux-user
> mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user
> ppc64-linux-user sh4-linux-user cris-linux-user $target_list"
> fi
> # the following are Darwin specific
> if [ "$darwin_user" = "yes" ] ; then
> @@ -933,6 +933,7 @@
> [ "$target_cpu" = "armeb" ] && target_bigendian=yes
> [ "$target_cpu" = "sparc" ] && target_bigendian=yes
> [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
> +[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
> [ "$target_cpu" = "ppc" ] && target_bigendian=yes
> [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
> [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
> @@ -1005,6 +1006,7 @@
>
> if test "$target_cpu" = "i386" ; then
> echo "TARGET_ARCH=i386" >> $config_mak
> + echo "TARGET_ABI_DIR=i386" >> $config_mak
> echo "#define TARGET_ARCH \"i386\"" >> $config_h
> echo "#define TARGET_I386 1" >> $config_h
> if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
It would be less clutter to let TARGET_ABI_DIR default to TARGET_ARCH
and override it when needed.
Thiemo
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, (continued)
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, Blue Swirl, 2007/10/11
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, J. Mayer, 2007/10/11
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, Blue Swirl, 2007/10/12
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets,
Thiemo Seufer <=
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, Blue Swirl, 2007/10/12
- Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, Thiemo Seufer, 2007/10/12
Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets, Blue Swirl, 2007/10/10