ntdll: Allocate TEBs and stacks in the low 2G.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-04-27 13:00:40 +02:00
parent 6a9e19344d
commit 789c1db18a

View file

@ -2907,7 +2907,7 @@ TEB *virtual_alloc_first_teb(void)
exit(1);
}
NtAllocateVirtualMemory( NtCurrentProcess(), &teb_block, 0, &total,
NtAllocateVirtualMemory( NtCurrentProcess(), &teb_block, is_win64 ? 0x7fffffff : 0, &total,
MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE );
teb_block_pos = 30;
ptr = (char *)teb_block + 30 * block_size;
@ -2944,8 +2944,8 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
{
SIZE_T total = 32 * block_size;
if ((status = NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, 0, &total,
MEM_RESERVE, PAGE_READWRITE )))
if ((status = NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, is_win64 ? 0x7fffffff : 0,
&total, MEM_RESERVE, PAGE_READWRITE )))
{
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
return status;
@ -3060,7 +3060,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SI
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
if ((status = map_view( &view, NULL, size + extra_size, FALSE,
VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, 0 )) != STATUS_SUCCESS)
VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, 33 )) != STATUS_SUCCESS)
goto done;
#ifdef VALGRIND_STACK_REGISTER