Subject: Re: Increasing VM limits
To: Perry E. Metzger <>
From: Wolfgang Solfrank <>
List: port-amd64
Date: 02/02/2005 20:23:08

> What does the UseMMAP define do exactly?

Well, the Xserver has its own dynamic linker, which implements more
or less a dynamic form of ld(1).  I.e., the various modules (like e.g.
the graphic card drivers) are expected to be in standard obj format
(note: *not* pic-compiled).  The Xserver's loader determines from the
elf headers the sizes of the various sections, and depending on UseMMAP
either mallocs memory for those and reads them in, or mmaps the sections
from the file.  After that it relocates the code appropriately.

The problem on amd64 is that our mmap(2) maps beyond the data limit
(if not given an explicit address to map to), but the compiler generates
only call instructions for the "small" code model, i.e. those can span
at most (about) 2 GB.  While this isn't a problem for calls from the
Xserver into the loaded module (those are of course done via function
pointers), it doesn't work well for calls from the module to some
standard functions in the Xserver, if the module is loaded too far

Dropping UseMMAP will result in the modules to be read into malloc'ed
memory, which is part of the data area and thus in a place reachable
from the main program.

ws@TooLs.DE                            Wolfgang Solfrank, TooLs GmbH