qemu-devel
[Top][All Lists]
Advanced

[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: Blue Swirl
Subject: Re: [Qemu-devel] RFC: fix run of 32 bits Linux executables on 64 bits targets
Date: Fri, 12 Oct 2007 22:37:03 +0300

On 10/12/07, Thiemo Seufer <address@hidden> wrote:
> 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).

If target_ulong is 64 bits, then abi_ulong is 64 bits too and
therefore correct. Unless you want to enable the ABI32 feature? It is
only enabled for the new Sparc32plus and PPC targets for now.

But I put the original target_ulongs back.

> It would be less clutter to let TARGET_ABI_DIR default to TARGET_ARCH
> and override it when needed.

Maybe. I changed the patch to do that.

I found out why Sparc32plus can't execute Sparc32 binaries. Addresses
need to be truncated to 32 bits, otherwise things like

ld  [ %l7 + %o0 ], %o0

don't work when the other register is set to a 32 bit negative value
in such a way that it is not negative in 64 bits. Now all my Sparc32
test cases run equally fine with both qemu-sparc and qemu-sparc32plus,
so Sparc64 emulator should be OK for the part shared with Sparc32.

Attachment: linux32.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]