Commit Graph

13 Commits

Author SHA1 Message Date
Rémi Bernon 8a765533d6 ntdll: Implement zero_bits parameter in virtual alloc functions.
Use alloc_area.limit field to limit the search in reserved areas to the
desired memory range, or call find_free_area to get a pointer to a free
memory region which matches the zero_bits constraint, then mmap it with
MAP_FIXED flag.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:29:45 +02:00
Rémi Bernon f172dd03ff ntdll/tests: Update zero_bits > 31 test case to validate bitmask behavior.
Only the leading zeroes are taken into account, so 0x1aaaaaaa zero_bits
behaves as 0x1fffffff

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:11:46 +02:00
Rémi Bernon 54ba6b0ce5 ntdll/tests: Use MEM_TOP_DOWN parameter to consistently fail zero_bits tests.
The todo_wine_if made the tests not really test anything, and one test
was succeeding when it shouldn't. Now we can actually remove the todo
when 1 zero_bits handling is implemented.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:11:33 +02:00
Rémi Bernon 3cdb5072e8 ntdll/tests: Factor WoW64 checks and add is_win64 constant.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:11:27 +02:00
Rémi Bernon d1a7b681ea ntdll: Change zero_bits parameter type to ULONG_PTR for NtMapViewOfSection and NtAllocateVirtualMemory.
It can be a pointer mask, eventually 64bit, and ULONG_PTR is what can be
found in several documentation of these functions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:11:15 +02:00
Rémi Bernon be48a56e70 ntdll: Clarify NtMapViewOfSection zero_bits parameter semantics.
See 00451d5edf.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 22:32:42 +02:00
Rémi Bernon bec9a63f7a ntdll/tests: Add more NtMapViewOfSection tests with zero_bits.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 22:32:42 +02:00
Rémi Bernon d1b7e01e5e ntdll/tests: Move NtMapViewOfSection tests from kernel32/tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 22:32:40 +02:00
Rémi Bernon 3acc123ed3 ntdll/tests: Cleanup NtAllocateVirtualMemory related tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 22:23:03 +02:00
Zebediah Figura 16eb17bb0a ntdll/tests: Add tests for RtlCreateUserStack().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-17 20:52:34 +02:00
Rémi Bernon 00451d5edf ntdll: Clarify NtAllocateVirtualMemory zero_bits parameter semantics.
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.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-13 20:55:35 +02:00
Rémi Bernon 8878492d3b ntdll/tests: Add NtAllocateVirtualMemory tests for zero_bits behavior.
The zero_bits parameter doesn't behave as expected, and some 64bit code
use it to allocate memory in the lower 32bit address space.

The expected full behaviour is:

* zero_bits == 0: no constraint on address range
* 0 < zero_bits <= 15: returned address should have as many upper bits
                       set to 0, starting at bit 31. In 64bit mode,
                       upper 32bits should all be 0 as well.
* 15 < zero_bits <= 31: unsure, but probably same as zero_bits == 15.
* zero_bits > 31: (64bit/WoW64 only) zero_bits behaves as a bitmask, as
                  if it was set to the number of leading 0 in the
                  bitmask, works in the whole 64bit range.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-11 18:18:49 +02:00
Rémi Bernon f39c1eee49 ntdll/tests: Move NtAllocateVirtualMemory tests that were in kernel32.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-11 18:18:39 +02:00