Patchwork [3/8] linux-user: Fix undefined HOST_LONG_SIZE on PPC hosts

login
register
mail settings
Submitter Alexander Graf
Date May 1, 2012, 7:48 p.m.
Message ID <6AE2C3A0-C56C-43D9-86CB-9DB62087AD67@suse.de>
Download mbox | patch
Permalink /patch/156196/
State New
Headers show

Comments

Alexander Graf - May 1, 2012, 7:48 p.m.
On 01.05.2012, at 21:11, Peter Maydell wrote:

> On 1 May 2012 19:54, Alexander Graf <agraf@suse.de> wrote:
>> 
>> On 01.05.2012, at 20:32, Andreas Färber wrote:
>> 
>>> Am 01.05.2012 10:58, schrieb Alexander Graf:
>>>> On my PPC host, HOST_LONG_SIZE is not defined even after
>>>> running configure. Use the normal C way of determining the
>>>> long size instead.
>>>> 
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>> ---
>>>> thunk.h |    2 +-
>>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>> 
>>>> diff --git a/thunk.h b/thunk.h
>>>> index 5be8f91..87025c3 100644
>>>> --- a/thunk.h
>>>> +++ b/thunk.h
>>>> @@ -113,7 +113,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
>>>>       defined(HOST_PARISC) || defined(HOST_SPARC64)
>>>>             return 4;
>>>> #elif defined(HOST_PPC)
>>>> -            return HOST_LONG_SIZE;
>>>> +            return sizeof(void *);
>>> 
>>> malc has committed a different fix (TARGET_ABI_BITS / 8) - thanks for
>>> fixing the build - but this PULL will now conflict.
>> 
>> :(.
>> 
>> Removed from my queue.
> 
> We need to put out a patch which converts commit b754e4fc1 to
> the fix as reviewed on the mailing list, because b754e4fc1 is
> incorrect: it is returning the size of a target type when it
> should be returning the size of a host type.

Yes, you're right. Added the below patch onto the queue. Sending a new pull request now.


Alex

From ddf1ddcf65866e2dd8e5d515bc636617fb2e15ee Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 30 Apr 2012 22:58:55 +0000
Subject: [PATCH 8/8] linux-user: Fix invalid TARGET_ABI_BITS usage on ppc hosts

When trying to evaluate the size of the _host_ type size for olddev_t,
we need to expose the host's pointer size, not the guest pointer size.

This usage got introduced accidently in commit b754e4fc1.

Fix things by not using TARGET_.*, but rather use host sizeof()
information, which gives us the correct size.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 thunk.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/thunk.h b/thunk.h
index c295766..87025c3 100644
--- a/thunk.h
+++ b/thunk.h
@@ -113,7 +113,7 @@  static inline int thunk_type_size(const argtype *type_ptr, int is_host)
       defined(HOST_PARISC) || defined(HOST_SPARC64)
             return 4;
 #elif defined(HOST_PPC)
-            return TARGET_ABI_BITS / 8;
+            return sizeof(void *);
 #else
             return 2;
 #endif