tech-kern archive

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

Re: equivalent of MAP_32BIT

Justin Cormack wrote:
> I have been informed that there might be an undocumented ability to
> get mmap to return addresses in the lower 4G of address space on a 64
> bit machine by passing ~(unsigned)0 as the first parameter (or
> (1<<31)-1 for 2GB). Is this correct? Or is it possibley to use
> netbsd32_mmap()? Linux and some other OSs support a MAP_32BIT flag to
> achieve this, looking for a way to port some code to NetBSD that
> requires this.

I will not ask which code do you want to port because it's very obvious

It was on my todo list to look into testing LuaJIT on amd64 this weekend
but I spend my spare time cycling with kids instead.

Adding __NetBSD__ to this list:

#elif LJ_TARGET_OSX || defined(__FreeBSD__) ||
defined(__FreeBSD_kernel__) || defined(__OpenBSD__)

/* OSX and FreeBSD mmap() use a naive first-fit linear search.
** That's perfect for us. Except that -pagezero_size must be set for
** otherwise the lower 4GB are blocked. And the 32GB RLIMIT_DATA needs
** to be reduced to 250MB on FreeBSD.

in src/lj_alloc.c seems to work but I neither extensively tested it nor
checked with NetBSD kernel sourses whether it uses a linear search.


Home | Main Index | Thread Index | Old Index