[PATCH xserver 1/1] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
Mark Kettenis
mark.kettenis at xs4all.nl
Thu Nov 3 02:02:29 PDT 2011
> From: Jeremy Huddleston <jeremyhu at apple.com>
> Date: Wed, 02 Nov 2011 09:52:24 -0700
>
> memType is a uint64_t on powerpc. 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.
>
> Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Mark Kettenis <kettenis at openbsd.org>
If you guys trust such a thing for a Linux-only diff from me ;).
> ---
> hw/xfree86/os-support/linux/lnx_video.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
> index 3d45511..d71d634 100644
> --- a/hw/xfree86/os-support/linux/lnx_video.c
> +++ b/hw/xfree86/os-support/linux/lnx_video.c
> @@ -469,11 +469,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
> static void
> unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
> {
> - memType alignOff = (memType)Base
> - - ((memType)Base & ~(getpagesize() - 1));
> + uintptr_t alignOff = (uintptr_t)Base
> + - ((uintptr_t)Base & ~(getpagesize() - 1));
>
> - DebugF("alignment offset: %lx\n",alignOff);
> - munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
> + DebugF("alignment offset: %lx\n", (unsigned long)alignOff);
> + munmap((void *)((uintptr_t)Base - alignOff), (Size + alignOff));
> }
More information about the xorg-devel
mailing list