Hi, I hacked wine to enable 3GB user address space just like the /3GB boot.ini option for windows. ( see patch ) This actually works like a charm playing everquest2 which crashes from time to time without this patch due to running out of memory.
To do it right, should this "3GB Option" be enabled by a wine start parameter or a registry key ? Is the registry already setup during the call of libs/wine/mmap.c ?
Bye Stefan Reimer
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c index a49df99..61dd2be 100644 --- a/dlls/kernel32/cpu.c +++ b/dlls/kernel32/cpu.c @@ -383,7 +383,7 @@ VOID WINAPI GetSystemInfo(
/* FIXME: the two entries below should be computed somehow... */ cachedsi.lpMinimumApplicationAddress = (void *)0x00010000; - cachedsi.lpMaximumApplicationAddress = (void *)0x7FFEFFFF; + cachedsi.lpMaximumApplicationAddress = (void *)0xBFFEFFFF; cachedsi.dwActiveProcessorMask = 0; cachedsi.dwNumberOfProcessors = 1; cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index 9931c09..aec818f 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -1336,7 +1336,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
/* FIXME: should do something for other systems */ GetSystemInfo(&si); - lpmemex->ullTotalVirtual = (char*)si.lpMaximumApplicationAddress-(char*)si.lpMinimumApplicationAddress; + lpmemex->ullTotalVirtual = (unsigned long)si.lpMaximumApplicationAddress-(unsigned long)si.lpMinimumApplicationAddress; /* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */ lpmemex->ullAvailVirtual = lpmemex->ullTotalVirtual-64*1024;
diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c index ff117cc..6ae6664 100644 --- a/libs/wine/mmap.c +++ b/libs/wine/mmap.c @@ -346,7 +346,7 @@ void mmap_init(void) #if defined(__i386__) && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) /* commented out until FreeBSD gets fixed */ char stack; char * const stack_ptr = &stack; - char *user_space_limit = (char *)0x7ffe0000; + char *user_space_limit = (char *)0xbffe0000;
reserve_malloc_space( 8 * 1024 * 1024 );
Stefan Reimer wrote:
Hi, I hacked wine to enable 3GB user address space just like the /3GB boot.ini option for windows. ( see patch ) This actually works like a charm playing everquest2 which crashes from time to time without this patch due to running out of memory.
Coincidentally, I saw this post on the Ubuntu forums about another application (Blockland) that appears similarly affected: http://ubuntuforums.org/showthread.php?t=948170
Thanks, Scott Ritchie
"Stefan Reimer" lists@startux.de wrote:
I hacked wine to enable 3GB user address space just like the /3GB boot.ini option for windows. ( see patch ) This actually works like a charm playing everquest2 which crashes from time to time without this patch due to running out of memory.
To do it right, should this "3GB Option" be enabled by a wine start parameter or a registry key ? Is the registry already setup during the call of libs/wine/mmap.c ?
There is no need for hacks like that, 3 Gb address space limit is already implemented in Wine, but is being activated only for applications marked as IMAGE_FILE_LARGE_ADDRESS_AWARE for obvious reasons.
The EQ2 binary is large address aware.
Windows changes it upper most user space address from 0x7FFEFFFF to 0xBFFEFFFF booting with /3GB and this is not possible in wine right now as I think.
Stefan
"Stefan Reimer" lists@startux.de wrote:
I hacked wine to enable 3GB user address space just like the /3GB boot.ini option for windows. ( see patch ) This actually works like a charm playing everquest2 which crashes from time to time without this patch due to running out of memory.
To do it right, should this "3GB Option" be enabled by a wine start parameter or a registry key ? Is the registry already setup during the call of libs/wine/mmap.c ?
There is no need for hacks like that, 3 Gb address space limit is already implemented in Wine, but is being activated only for applications marked as IMAGE_FILE_LARGE_ADDRESS_AWARE for obvious reasons.
-- Dmitry.
"Stefan Reimer" lists@startux.de wrote:
The EQ2 binary is large address aware.
Windows changes it upper most user space address from 0x7FFEFFFF to 0xBFFEFFFF booting with /3GB and this is not possible in wine right now as I think.
Did you really check that?
On Wednesday 15 October 2008 01:37:46 am Dmitry Timoshkov wrote:
There is no need for hacks like that, 3 Gb address space limit is already implemented in Wine, but is being activated only for applications marked as IMAGE_FILE_LARGE_ADDRESS_AWARE for obvious reasons.
Doesn't that only work if Windows is already booted in 3GB mode? I thought I read somewhere that the flag doesn't do anything if the system wasn't booted with /3GB..
Here: "The /3GB switch allocates 3 GB of virtual address space to an application that uses IMAGE_FILE_LARGE_ADDRESS_AWARE in the process header. This switch allows applications to address 1 GB of additional virtual address space above 2 GB. The virtual address space of processes and applications is still limited to 2 GB, unless the /3GB switch is used in the Boot.ini file." http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx