Commit 9dd6a660 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Pass allocation type to map_view().

Based on a patch by Nikolay Sivov.
parent 376bd69c
......@@ -1970,8 +1970,9 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
* virtual_mutex must be held by caller.
*/
static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
int top_down, unsigned int vprot, ULONG_PTR limit, size_t align_mask )
unsigned int alloc_type, unsigned int vprot, ULONG_PTR limit, size_t align_mask )
{
int top_down = alloc_type & MEM_TOP_DOWN;
void *ptr;
NTSTATUS status;
......@@ -2244,7 +2245,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot
if (mmap_is_in_reserved_area( low_64k, dosmem_size - 0x10000 ) != 1)
{
addr = anon_mmap_tryfixed( low_64k, dosmem_size - 0x10000, unix_prot, 0 );
if (addr == MAP_FAILED) return map_view( view, NULL, dosmem_size, FALSE, vprot, 0, 0 );
if (addr == MAP_FAILED) return map_view( view, NULL, dosmem_size, 0, vprot, 0, 0 );
}
/* now try to allocate the low 64K too */
......@@ -2724,9 +2725,9 @@ static NTSTATUS virtual_map_image( HANDLE mapping, ACCESS_MASK access, void **ad
if ((ULONG_PTR)base != image_info->base) base = NULL;
if ((char *)base >= (char *)address_space_start) /* make sure the DOS area remains free */
status = map_view( &view, base, size, alloc_type & MEM_TOP_DOWN, vprot, limit, 0 );
status = map_view( &view, base, size, alloc_type, vprot, limit, 0 );
if (status) status = map_view( &view, NULL, size, alloc_type & MEM_TOP_DOWN, vprot, limit, 0 );
if (status) status = map_view( &view, NULL, size, alloc_type, vprot, limit, 0 );
if (status) goto done;
status = map_image_into_view( view, filename, unix_fd, base, image_info,
......@@ -2850,7 +2851,7 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
res = map_view( &view, base, size, alloc_type & MEM_TOP_DOWN, vprot, limit, 0 );
res = map_view( &view, base, size, alloc_type, vprot, limit, 0 );
if (res) goto done;
TRACE( "handle=%p size=%lx offset=%s\n", handle, size, wine_dbgstr_longlong(offset.QuadPart) );
......@@ -3419,7 +3420,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR limit, SIZE_T
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
status = map_view( &view, NULL, size, FALSE, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, limit, 0 );
status = map_view( &view, NULL, size, 0, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, limit, 0 );
if (status != STATUS_SUCCESS) goto done;
#ifdef VALGRIND_STACK_REGISTER
......@@ -4093,7 +4094,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
if (vprot & VPROT_WRITECOPY) status = STATUS_INVALID_PAGE_PROTECTION;
else if (is_dos_memory) status = allocate_dos_memory( &view, vprot );
else status = map_view( &view, base, size, type & MEM_TOP_DOWN, vprot, limit,
else status = map_view( &view, base, size, type, vprot, limit,
align ? align - 1 : granularity_mask );
if (status == STATUS_SUCCESS) base = view->base;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment