[PATCH] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
Mark Kettenis
mark.kettenis at xs4all.nl
Wed Nov 2 02:20:14 PDT 2011
> From: Jeremy Huddleston <jeremyhu at apple.com>
> Date: Tue, 01 Nov 2011 19:07:42 -0700
>
> On Nov 1, 2011, at 5:48 PM, Daniel Stone wrote:
>
> > Hi,
> >
> > On 1 November 2011 22:05, Jeremy Huddleston <jeremyhu at apple.com> wrote:
> >> While this does fix the build failure, I'd much rather change memType to be a uintptr_t everywhere, but it was explicitly set to uint64_t for 32bit powerpc by Ian in the commit referenced below. Ian, can you explain why you set memType to 64bits even though void * is only 32bits? You referenced ppc32 code running on ppc64, but I don't see why that would be problematic.
> >
> > I'm pretty sure this was because 64-bit POWER machines were really
> > fond of mapping their PCI address space above the 32-bit range, so if
> > you truncated your addresses to 32-bit, you'd lose out.
>
> Really? Did someone not get the memo that they wanted to continue to support 32bit userland?
>
> I guess we're stuck with that ugly casting patch then...
Not really. Using memType only really makes sense for *physical*
addresses, which can be 64-bit for 32-bit systems running on 64-bit
hardware.
However, unmapVidMem() only deals with *virtual* addresses, which are
guaranteed to fit into an uintptr_t. So you can simply replace
memType with uintptr_t in this function, and avoid the casting madness.
More information about the xorg-devel
mailing list