upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/xmem_test.cpp
diff options
context:
space:
mode:
authorGustavo Kissel <kisselgustavo@gmail.com>2026-11-23 17:40:34 -0300
committerGustavo Kissel <kisselgustavo@gmail.com>2026-11-23 17:40:34 -0300
commit4b075160b72652e7b0af0b1a6a3fde9101fa4817 (patch)
tree7a300b80a2cf9b92baf9f9ec5d5bd7a31da43512 /runtime/test/xmem_test.cpp
parent28f19186db393f4355dafc6d39535af3ea976698 (diff)
docs: note unmap_range has no rollback, move test comments to their tests
Diffstat (limited to 'runtime/test/xmem_test.cpp')
-rw-r--r--runtime/test/xmem_test.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/test/xmem_test.cpp b/runtime/test/xmem_test.cpp
index 894545f40..cdc42ff6d 100644
--- a/runtime/test/xmem_test.cpp
+++ b/runtime/test/xmem_test.cpp
@@ -459,9 +459,6 @@ void test_physical_pages(const PhysicalApi& api) {
459 // The windows were split into one placeholder per page; the process exit releases them. 459 // The windows were split into one placeholder per page; the process exit releases them.
460} 460}
461 461
462// The placeholder flags pass through: reserve a placeholder, carve windows and committed memory out of it.
463// A run longer than one host view is mapped as capped views, so unmapping one page inside it only remaps the rest of
464// that view; every other page keeps its contents.
465// Splitting a view briefly unmaps the view's other pages; a thread reading one of them meanwhile must not fault. 462// Splitting a view briefly unmaps the view's other pages; a thread reading one of them meanwhile must not fault.
466void test_split_under_reader(const PhysicalApi& api) { 463void test_split_under_reader(const PhysicalApi& api) {
467 constexpr uint64_t kPages = 2048; // two capped views 464 constexpr uint64_t kPages = 2048; // two capped views
@@ -495,6 +492,8 @@ void test_split_under_reader(const PhysicalApi& api) {
495 api.free_pages(kPages, pages.data()); 492 api.free_pages(kPages, pages.data());
496} 493}
497 494
495// A run longer than one host view is mapped as capped views, so unmapping one page inside it only remaps the rest of
496// that view; every other page keeps its contents.
498void test_long_run(const PhysicalApi& api) { 497void test_long_run(const PhysicalApi& api) {
499 constexpr uint64_t kPages = 1100; // more than the 1024-page view cap 498 constexpr uint64_t kPages = 1100; // more than the 1024-page view cap
500 auto* const window = static_cast<uint8_t*>( 499 auto* const window = static_cast<uint8_t*>(
@@ -534,6 +533,7 @@ void test_long_run(const PhysicalApi& api) {
534 check(api.map(window, 1, pages.data()) == nullptr && reserved_only(window), "a freed page does not map again"); 533 check(api.map(window, 1, pages.data()) == nullptr && reserved_only(window), "a freed page does not map again");
535} 534}
536 535
536// The placeholder flags pass through: reserve a placeholder, carve windows and committed memory out of it.
537void test_placeholders(const PhysicalApi& api) { 537void test_placeholders(const PhysicalApi& api) {
538 auto* const base = static_cast<uint8_t*>( 538 auto* const base = static_cast<uint8_t*>(
539 api.virtual_alloc(nullptr, 6 * kPage64k, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, 7, PAGE_NOACCESS)); 539 api.virtual_alloc(nullptr, 6 * kPage64k, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, 7, PAGE_NOACCESS));