[PATCH v12 1/2] ntdll: Clarify NtAllocateVirtualMemory zero_bits parameter semantics

Huw Davies huw at codeweavers.com
Thu Jun 13 05:53:39 CDT 2019


On Wed, Jun 12, 2019 at 04:02:33PM +0200, Rémi Bernon wrote:
> This parameter was misinterpreted as an alignment parameter for the
> lower bits of the allocated memory region, although it is a constraint
> on the higher bits.
> 
> Add a new internal ntdll virtual_alloc_aligned function that has a
> separate alignment parameter which is now used instead of the zero_bits
> parameter.
> 
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>  dlls/ntdll/directory.c      |  4 +--
>  dlls/ntdll/heap.c           |  5 ++--
>  dlls/ntdll/ntdll_misc.h     |  2 ++
>  dlls/ntdll/signal_arm.c     | 12 ++++-----
>  dlls/ntdll/signal_arm64.c   | 16 ++++++------
>  dlls/ntdll/signal_i386.c    | 16 ++++++------
>  dlls/ntdll/signal_powerpc.c | 12 ++++-----
>  dlls/ntdll/signal_x86_64.c  | 16 ++++++------
>  dlls/ntdll/tests/virtual.c  |  4 +--
>  dlls/ntdll/thread.c         |  3 +--
>  dlls/ntdll/virtual.c        | 49 ++++++++++++++++++++++++++-----------
>  11 files changed, 79 insertions(+), 60 deletions(-)
> 
> diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
> index 78973a8cda4..7a6e461ffaf 100644
> --- a/dlls/ntdll/virtual.c
> +++ b/dlls/ntdll/virtual.c
> @@ -1713,7 +1716,7 @@ NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, S
>      get_vprot_flags( protect, &vprot, sec_flags & SEC_IMAGE );
>      vprot |= sec_flags;
>      if (!(sec_flags & SEC_RESERVE)) vprot |= VPROT_COMMITTED;
> -    res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot );
> +    res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot, zero_bits );

I think we should pass 0 here until we change the behaviour the rest of this
function.  I've sent in a new version that does that.

Could you now send in a patch that adds a zero_bits parameter to map_image()
and removes mask?  At some point we'll want to fix the parameter name
in get_mask() too.

Huw.



More information about the wine-devel mailing list