Signed-off-by: Fan WenJie fanwj@mail.ustc.edu.cn
-- v4: ntdll:setting limit with checking server:setting range64 with checking
From: Fan WenJie fanwj@mail.ustc.edu.cn
Signed-off-by: Fan WenJie fanwj@mail.ustc.edu.cn --- server/mapping.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/server/mapping.c b/server/mapping.c index a795dc4b38b..3af5a0be5e4 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -229,9 +229,27 @@ static struct addr_range ranges64;
void init_memory(void) { +#ifdef __LP64__ + size_t page_size = sysconf( _SC_PAGESIZE ); + size_t limit = 1LLU << 48U; + page_mask = page_size - 1; + while(limit > 0x100000000LLU) + { + void* addr = (void*)(limit - page_size); + void* ret = mmap(addr, page_size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); + size_t next = limit >> 1U; + if (ret == (void*)-1) ret = NULL; + if (ret) munmap(ret, page_size); + if (ret >= (void*)next) break; + limit = next; + } + free_map_addr( 0x60000000, 0x1c000000 ); + free_map_addr( limit - (limit >> 4U), limit >> 4U ); +#else page_mask = sysconf( _SC_PAGESIZE ) - 1; free_map_addr( 0x60000000, 0x1c000000 ); free_map_addr( 0x600000000000, 0x100000000000 ); +#endif }
static void ranges_dump( struct object *obj, int verbose )
From: Fan WenJie fanwj@mail.ustc.edu.cn
Signed-off-by: Fan WenJie fanwj@mail.ustc.edu.cn --- dlls/ntdll/unix/virtual.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 75e6319c007..1defce8e312 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -557,7 +557,7 @@ static void mmap_init( const struct preload_info *preload_info ) /* if we don't have a preloader, try to reserve the space now */ reserve_area( (void *)0x000000010000, (void *)0x000068000000 ); reserve_area( (void *)0x00007f000000, (void *)0x00007fff0000 ); - reserve_area( (void *)0x7ffffe000000, (void *)0x7fffffff0000 ); + reserve_area( ((char *)user_space_limit) - 0x1ff0000, user_space_limit );
#endif } @@ -3245,6 +3245,24 @@ static void *alloc_virtual_heap( SIZE_T size ) return anon_mmap_alloc( size, PROT_READ | PROT_WRITE ); }
+#ifdef _WIN64 +static void set_space_limit(void) +{ + size_t limit = 1LLU << 48U; + while(limit > 0x100000000LLU) + { + void* addr = (void*)(limit - page_size); + void* ret = mmap(addr, page_size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); + size_t next = limit >> 1U; + if (ret == (void*)-1) ret = NULL; + if (ret) munmap(ret, page_size); + if (ret >= (void*)next) break; + limit = next; + } + address_space_limit = user_space_limit = working_set_limit = (void*)(limit - 0x10000LLU); +} +#endif + /*********************************************************************** * virtual_init */ @@ -3261,6 +3279,10 @@ void virtual_init(void) pthread_mutex_init( &virtual_mutex, &attr ); pthread_mutexattr_destroy( &attr );
+#ifdef _WIN64 + set_space_limit(); +#endif + if (preload_info && *preload_info) for (i = 0; (*preload_info)[i].size; i++) mmap_add_reserved_area( (*preload_info)[i].addr, (*preload_info)[i].size );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=140293
Your paranoid android.
=== debian11b (64 bit WoW report) ===
kernel32: loader.c:2383: Test failed: 4: NtMapViewOfSection failed 40000003 loader.c:2397: Test failed: 4: not at base 00007FFFFF460000 / 00007FFFFF210000 loader.c:2399: Test failed: 4: tls not relocated 00007FFFFF4610B8 / 00007FFFFF2110B8
address space range of 64-bit OS depends on the number of page table levels