Problems with VirtualAlloc/Lock
Michael Ost
most at museresearch.com
Wed Mar 16 17:17:41 CST 2005
On Wed, 2005-03-16 at 00:32, Alexandre Julliard wrote:
> Michael Ost <most at museresearch.com> writes:
>
> > Wine reports that apps have 2GB of VM in GlobalMemoryStatus, but they
> > actually only have 1GB. Isn't that a Wine bug?
>
> Not really, you do have 2GB of VM, you just can't allocate all of it
> with VirtualAlloc(NULL) because of kernel limitations. You can still
> access it by specifying explicit addresses.
Here's a suggestion. Certainly naive, but would it work? The idea is to
trap mmap allocations which go above "user_space_limit" and retry them
in the space below 0x4000,0000. Something like this in lib/wine/mmap.c
wine_anon_map() -
replace:
return mmap(start, size, prot, flags, fdzero, 0);
with
void* addr = mmap(start, size, prot, flags, fdzero, 0);
/* disallow allocations above the windows limit */
/* OR can you to find this out without mmap()ing first? */
if addr + size > user_space_limit)
munmap(addr)
addr = 0;
/* look below linux's 0x40000000 address if a specific */
/* address wasn't requested */
if start == 0 and addr == 0
/* 0x08000000 is the start of the TEXT segment - */
/* start looking there */
addr = mmap(0x08000000, size, prot,
MAP_PRIVATE | MAP_ANON, -1, 0);
return addr;
This should start allocating memory from below 0x4000,0000 to windows
processes after the area between 0x4000,0000 to 0x8000,0000 is full,
right?
More information about the wine-devel
mailing list