On Wed Jan 31 02:12:33 2024 +0000, Paul Gofman wrote:
VirtualFree supports splitting placeholders in Wine, including in the middle of the view like in your test. The actual problem in your patch is that ```map_start = (void*)(((ULONG_PTR)allocation + system_info.dwPageSize) & ~(system_info.dwPageSize-1));``` truncates the address wtih & part, should be ```map_start = (void*)(((ULONG_PTR)allocation + system_info.dwPageSize) & ~((ULONG_PTR)system_info.dwPageSize-1));``` or you can actually drop that alignment at all, allocation + page_size is already aligned. Why it works on Windows (and with some Wine-Staging patches) is because the memory is allocated top-down and you happen to get the address below 4gb so truncation doesn't matter. I suggest to keep your test as it was with mapping in the middle of the initial view, it is probably a bit more interesting this way, fixing just the truncation part.
Thank you very much for the hint. I missed casting it to 64bit :smiley:
I changed it back with your correction and now the tests work, as i wanted them to be. Eating away a piece in the middle of the placeholded allocation.