diff options
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 | ||