From 93a38b5d12c15c2620c92dde016f046688c3a8eb Mon Sep 17 00:00:00 2001 From: chrg6 Date: Mon, 9 Nov 2026 05:57:20 -0500 Subject: [PATCH] Check the selftest's physical memory limit against the title's own pool size. Co-Authored-By: Claude Opus 5.5 --- runtime/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/main.c b/runtime/main.c index 934c0ac3..e1902cc7 100644 --- a/runtime/main.c +++ b/runtime/main.c @@ -406,7 +406,10 @@ static void check_memory(void) { CHECK(q.state == 0 && q.base == g->alias.base && q.size == g->alias.size, "QueryMemory on the free alias region"); CHECK(mem_map_physical(a, 0x1000) == 0 && LD64(a + 0x10) == 0 && mem_unmap_physical(a, 0x1000) == 0, "remapped physical memory is not zeroed"); - CHECK(mem_map_physical(a, 0x100000000ull) == 0x10801, "MapPhysicalMemory beyond the pool is not LimitReached"); + // One page more than the whole pool (GetInfo 6), so the request is over the limit whatever the title's pool is. + mem_info(6, &v); + CHECK(mem_map_physical(a, ((v + 0xFFFull) & ~0xFFFull) + 0x1000) == 0x10801, + "MapPhysicalMemory beyond the pool is not LimitReached"); mem_query(RT_HOSTFN_BASE + 0x40, &q); CHECK(q.state == 0x10 && q.base == RT_HOSTFN_BASE, "QueryMemory on the host-function window"); mem_query(g->alias.base + g->alias.size + 0x1000, &q);