Problems with VirtualAlloc/Lock
most at museresearch.com
Tue Mar 15 15:12:42 CST 2005
On Tue, 2005-03-15 at 11:12, Alexandre Julliard wrote:
> Michael Ost <most at museresearch.com> writes:
> > On Tue, 2005-03-15 at 01:09, Alexandre Julliard wrote:
> > > That's a kernel limitation. If you hack the kernel to start allocating
> > > from lower addresses (or implement the syscall we discussed to let us
> > > specify the mmap range) you can get the full 2GB.
> > Could you point me to the kernel limitation? I can mmap() 2GB on an
> > unhacked 2.4.19 kernel with this loop:
> That's because you can mmap above 0x8000000, but that's not allowed
> under Windows. You'll note that on a standard kernel you can only mmap
> 2GB even though you have a 3GB address space. If you set the large
> address flag when building your application you will get a 3GB address
> space on Wine too, which will then let you allocate 2GB; but the
> resulting high addresses may break your plugins. The real problem is
> that the kernel starts allocations at 0x40000000.
What's involved in doing such a hack/syscall? Are there any patches that
make this change lying around somewhere that I could look at?
Wine reports that apps have 2GB of VM in GlobalMemoryStatus, but they
actually only have 1GB. Isn't that a Wine bug?
To summarize and make sure I understand: the problem is that Linux and
Windows allocate VM from different address ranges. While both can alloc
2GB, the intersection of addresses is only 1GB --- between 0x40000000
On Windows (based on the MSDN docs) VM is allocated from 0x00000010 to
0x80000000. On Linux (unhacked 2.4 kernel), mmap runs from 0x40000000 to
More information about the wine-devel