libwine: Make addresses above 0x82000000 available on FreeBSD.

Tijl Coosemans tijl at coosemans.org
Sun Sep 19 15:35:56 CDT 2010


Because FreeBSD's mmap only looks for available memory ranges after
the location of the program and its malloc heap (unless given an
address hint), and because the wine loader is located at 0x7bf00000
and reserves everything beyond 0x7ffe0000, there's only about 32MiB
of address space available for mmap calls outside Wine (loading of
shared libraries plus their mmap calls).

This is often insufficient depending for instance on how many shared
libraries have to be loaded, whether they were compiled with
optimisations or debugging symbols or how much extra memory the
graphics driver needs.

This patch makes addresses above 0x82000000 available again on
FreeBSD. That address has been chosen such that there is still enough
reserved memory for the shared heap and virtual heap.

With this patch it is possible that a .dll.so is loaded beyond the
2GiB limit, but this does not seem to be a problem in practice. All
mmap calls from within Wine and thus all .dll stay below 2GiB and core
.dll.so such as ntdll, kernel32, user32,... are also loaded below 2GiB
because they are loaded early and are placed in the 32MiB mentioned
above. Also note that a .dll.so is only loaded above 2GiB when needed,
i.e. the program wouldn't have worked at all without this patch. It is
preferred that Wine at least makes an attempt at running the program
and therefore loosens the restriction on the use of addresses above
2GiB, especially since it seems to work so far.

The FreeBSD package has been built with this patch since March 2009.
---
 libs/wine/mmap.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libwine-Make-addresses-above-0x82000000-available-on.patch
Type: text/x-patch
Size: 485 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100919/4537876f/attachment.bin>


More information about the wine-patches mailing list