qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] PPC: Fix linker scripts on ppc hosts


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH] PPC: Fix linker scripts on ppc hosts
Date: Wed, 14 Dec 2011 02:43:24 +0100

On 14.12.2011, at 01:30, Paul Brook wrote:

>>>>>>> When compiling qemu statically with multilib on PPC, we hit the
>>>>>>> same issue that commit 845f2c2812d9ed24b36c02a3d06ee83aeafe8b49
>>>>>>> is fixing. Do the same here.
>>>>>> 
>>>>>> How many of these ld files can we get rid of if we use -Ttext-segment
>>>>>> instead? Generally all we're really caring about is moving the program
>>>>>> base around so that it doesn't conflict with the address space we want
>>>>>> to use for the client.
>>>>> 
>>>>> Now that we have the automatic GUEST_BASE stuff you shouldn't need to
>>>>> do either.
>>>> 
>>>> If it was working, yes :)
>>> 
>>> What doesn't work?  I put a fair amout of effort into making it
>>> automatically pick a sensible value.  If there's some reason that won't
>>> work then you probably want to be using -R.
>> 
>> IIRC mmap'ing files would break with 32-on-64, but I'd have to check up on
>> the details. I ended up passing MAP_32BIT to all linux-user mmap calla for
>> 32-on-x86_64, but that doesn't work with -R.
> 
> Hmm, I thought we'd fixed that.  It's the reason h2g_valid exists.
> 
> Either way it should definitely work with -R.  I specifically added that to 
> avoid problems with the host mmap picking inconvenient addresse.
> 
> MAP_32BIT is an unconsionable hack, and doesn't exist on other 64-bit hosts.

Yes, I agree. I just sat down once more and checked if I could get it working 
with -R and everything seems fine so far.

Is there any particular reason we're not reserving all of the possible 32 bit 
address space for 32-on-64 guests? The way it's today with the default being 
completely broken and -R fixing everything if you give it a large enough value 
is ... suboptimal.

I put this patch onto my tree to make sure we always actually use the -R 
feature:


Alex

commit ac233b323ad7e498c665e8c74df7e44de4a542c0
Author: Alexander Graf <address@hidden>
Date:   Wed Dec 14 00:33:28 2011 +0100

    linux-user: reserve 4GB of vmem for 32-on-64
    
    When running 32-on-64 bit guests, we should always reserve as much
    virtual memory as we possibly can for the guest process, so it can
    never overlap with QEMU address space.
    
    Fortunately we already have the infrastructure for that. All that's
    missing is some sane default value to also make use of it!
    
    Signed-off-by: Alexander Graf <address@hidden>

diff --git a/linux-user/main.c b/linux-user/main.c
index 788ff98..3ffee40 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -48,8 +48,19 @@ unsigned long mmap_min_addr;
 #if defined(CONFIG_USE_GUEST_BASE)
 unsigned long guest_base;
 int have_guest_base;
+#if (TARGET_LONG_BITS == 32) && (HOST_LONG_BITS == 64)
+/*
+ * When running 32-on-64 we should make sure we can fit all of the possible
+ * guest address space into a contiguous chunk of virtual host memory.
+ *
+ * This way we will never overlap with our own libraries or binaries or stack
+ * or anything else that QEMU maps.
+ */
+unsigned long reserved_va = 0xf7000000;
+#else
 unsigned long reserved_va;
 #endif
+#endif
 
 static void usage(void);
 extern int use_stopflag;


reply via email to

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