[2/2] kernel32: force 4096 byte page alignment.

Tijl Coosemans tijl at FreeBSD.org
Mon Feb 16 04:47:38 CST 2015

On Tue, 3 Feb 2015 10:16:33 +0100 Tijl Coosemans <tijl at FreeBSD.org> wrote:
> On Mon, 02 Feb 2015 22:20:57 +0200 David Naylor <dbn at freebsd.org> wrote:
>> FreeBSD prefers to use a 0x200000 (super) page alignment however this
>> causes the image base to be displaced from the requested 0x7b800000.
>> Forcing a smaller page size ensures FreeBSD can place the image starting
>> at 0x7b800000.
> Just to clarify, the output of "readelf -l kernel32.dll.so" gives this:

Can somebody run this command on Linux with kernel32.dll.so from a
wine64 build and post the output?  FreeBSD also uses GNU binutils so I
would expect the problem to exist on Linux as well.

>   Type Offset   VirtAddr   PhysAddr   FileSiz  MemSiz   Flg Align
>   LOAD 0x000000 0x7b800000 0x7b800000 0x0c9e74 0x0c9e74 R E 0x200000
>   LOAD 0x0ca000 0x7baca000 0x7baca000 0x1a7eb0 0x1a8550 RW  0x200000
> The segments have an alignment of 0x200000 bytes.  This places the first
> segment at 0x7b800000 and the second at 0x7ba00000+Offset.  With a
> MemSiz of 0x1a8550 this pushes the second segment over 0x7bc00000 where
> ntdll has been mapped already so loading kernel32 at 0x7b800000 fails.
> The patch forces a smaller alignment so the second segment fits below
> 0x7bc00000.

More information about the wine-devel mailing list