Subject: Re: warning: src/x11 broken
To: None <>
From: Matthias Scheler <>
List: port-amd64
Date: 04/11/2004 08:37:17
In article <>,
	Frank van der Linden <> writes:
> The XFree86 loader is broken, and only works on Linux because they
> added a hack to mmap to specify memory below the 32bit boundary.

So IIUC the loader doesn't work if the address returned by mmap() is
above 4GB. Correct?

> I've looked at it a while ago, and I don't think this can be fixed,
> unless they switch to a normal dlopen() scheme.

A possible fix would be a change like this to

#if defined(__NetBSD__) && (__AMD64__)
	static char *mm_addr = (char *)(1L << 30);
	char *mm_addr = NULL;

    ret = (unsigned long)mmap(mm_addr, new_size, MMAP_PROT, MAP_PRIVATE
#  if !defined(_NetBSD__) && defined(__AMD64__)
                              | MAP_32BIT
#  endif
                              , fd, new_off);
    if (ret == -1)
        FatalError("mmap() failed: %s\n", strerror(errno));
#if defined(__NetBSD__) && (__AMD64__)
    mm_addr += new_size;

    return (void *)(ret + new_off_bias);

That's not pretty but should work.

	Kind regards

Matthias Scheler