diff options
| author | Gustavo Kissel <kisselgustavo@gmail.com> | 2026-11-23 14:06:59 -0300 |
|---|---|---|
| committer | Gustavo Kissel <kisselgustavo@gmail.com> | 2026-11-23 14:06:59 -0300 |
| commit | 5ba2a7f95fbd6db34a2a3efcbb9602f02b20c917 (patch) | |
| tree | bb9a7cf76cdae3a92668071e3d0c05db546f8eb3 /runtime/test/xmem_test.cpp | |
| parent | 203a348cf03d844623284316410de9b5a580140f (diff) | |
xmem: map consecutive physical pages as one view, so a 100,000-page XMemMapPhysicalPages fits the title's hang watchdog under Wine
One view per page cost a placeholder split and a MapViewOfFile3 per 64 KiB page. Under Wine that took
0.36 ms a page and more as views accumulate; the retail boot's 99,776-page call ran past the title's
30-second hang watchdog. Consecutive pages of one allocation now map as one view. A page remapped or
unmapped later splits its view and the neighbours are mapped again from the same section.
Diffstat (limited to 'runtime/test/xmem_test.cpp')
| -rw-r--r-- | runtime/test/xmem_test.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/test/xmem_test.cpp b/runtime/test/xmem_test.cpp index eed030c12..b5df76766 100644 --- a/runtime/test/xmem_test.cpp +++ b/runtime/test/xmem_test.cpp | |||
| @@ -369,8 +369,20 @@ void test_physical_pages(const PhysicalApi& api) { | |||
| 369 | VirtualQuery(window, &info, sizeof(info)); | 369 | VirtualQuery(window, &info, sizeof(info)); |
| 370 | check(info.State == MEM_COMMIT && info.Type == MEM_MAPPED && info.Protect == PAGE_READWRITE, | 370 | check(info.State == MEM_COMMIT && info.Type == MEM_MAPPED && info.Protect == PAGE_READWRITE, |
| 371 | "a mapped page is a read-write view with the window's protection"); | 371 | "a mapped page is a read-write view with the window's protection"); |
| 372 | check(info.AllocationBase == window && info.RegionSize == kPages * kPage64k, | ||
| 373 | "consecutive pages of one allocation are mapped as one view"); | ||
| 372 | } | 374 | } |
| 373 | 375 | ||
| 376 | // A page unmapped or remapped inside that view splits it; its neighbours keep their pages. | ||
| 377 | void* const middle = window + kPage64k; | ||
| 378 | check(api.scatter(&middle, 1, nullptr) == TRUE && reserved_only(window + kPage64k), | ||
| 379 | "a page inside a view unmaps on its own"); | ||
| 380 | check(page_holds(window, 0x1000u) && page_holds(window + 2 * kPage64k, 0x3000u) && | ||
| 381 | page_holds(window + 3 * kPage64k, 0x4000u), | ||
| 382 | "the pages around it stay mapped with their contents"); | ||
| 383 | check(api.map(middle, 1, &pages[1]) == middle && page_holds(window + kPage64k, 0x2000u), | ||
| 384 | "a page maps again into the gap"); | ||
| 385 | |||
| 374 | check(api.map(window, kPages, nullptr) == window, "XMemMapPhysicalPages with no page array unmaps"); | 386 | check(api.map(window, kPages, nullptr) == window, "XMemMapPhysicalPages with no page array unmaps"); |
| 375 | check(reserved_only(window) && reserved_only(window + 3 * kPage64k), "unmapped pages are reserved again"); | 387 | check(reserved_only(window) && reserved_only(window + 3 * kPage64k), "unmapped pages are reserved again"); |
| 376 | 388 | ||