diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 16:55:46 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 16:55:46 -0500 |
| commit | 4c52ce27a6cf4af2bbf07a343ede39c5f1572b8d (patch) | |
| tree | 434bb716af27e048d3279b48dacff23ed82e071d /runtime/test/xmem_test.cpp | |
| parent | dac28e6b19c3f70ccd157d60d2e44f4f3f52995a (diff) | |
Seven fixes from an outside contributor (sent as patches, applied without the author's name)
- rdna2spirv: declare each packed vertex input register once; a register whose elements disagree on the component
type is refused (SHADER-644).
- runtime: a title's VirtualAlloc drops the console's MEM_GRAPHICS / MEM_TITLE type bits the host rejects (RT-217).
- runtime: XPersistentLocalStorageImpl is served from <overlay>\persistent with the package's 2048 MB quota
(RT-219; layout from the public docs, not measured in a caller).
- runtime: G:\ names the package and T:\ a scratch folder in the overlay; paths under the configured folders and
every path with no folders configured stay host paths (RT-218).
- winhttp_offline: header blocks and timeouts the host WinHTTP rejects are rejected the same way.
- cfg_structure.run: a limit of zero or less runs no blocks.
- shader_meta: an s_movk_i32 with a register operand and a float immediate beyond float32 are left unknown instead
of raising.
Each comes with a test that fails on the old code. Conflicts with main resolved here (internal_dir() hides T:'s
folder; both file_system_test blocks kept).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/xmem_test.cpp')
| -rw-r--r-- | runtime/test/xmem_test.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/test/xmem_test.cpp b/runtime/test/xmem_test.cpp index 7e4948f1f..1ad4080f7 100644 --- a/runtime/test/xmem_test.cpp +++ b/runtime/test/xmem_test.cpp | |||
| @@ -204,6 +204,34 @@ void test_virtual_alloc(XMemVirtualAllocFn virtual_alloc, XMemGetWriteWatchFn ge | |||
| 204 | "nonzero XMem allocation attributes are rejected before host allocation"); | 204 | "nonzero XMem allocation attributes are rejected before host allocation"); |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | using HostVirtualAllocFn = void*(WINAPI*)(void*, SIZE_T, DWORD, DWORD); | ||
| 208 | |||
| 209 | // RT-217: a title's kernel32!VirtualAlloc carries the console's MEM_GRAPHICS / MEM_TITLE type bits, which the host | ||
| 210 | // rejects. The registered shim has to drop them and still allocate. | ||
| 211 | void test_title_virtual_alloc() { | ||
| 212 | constexpr DWORD kMemGraphics = 0x10000000; | ||
| 213 | constexpr DWORD kMemTitle = 0x40000000; | ||
| 214 | const char* const dlls[] = {"kernel32.dll", "kernelbase.dll", "api-ms-win-core-memory-l1-1-0.dll"}; | ||
| 215 | for (const char* dll : dlls) { | ||
| 216 | const auto alloc = reinterpret_cast<HostVirtualAllocFn>(rt::shims::find(dll, "VirtualAlloc")); | ||
| 217 | char what[160]; | ||
| 218 | std::snprintf(what, sizeof what, "registry exposes %s!VirtualAlloc", dll); | ||
| 219 | check(alloc != nullptr, what); | ||
| 220 | if (!alloc) continue; | ||
| 221 | |||
| 222 | for (const DWORD bits : {kMemGraphics, kMemTitle, kMemGraphics | kMemTitle, DWORD{0}}) { | ||
| 223 | void* const p = alloc(nullptr, 0x10000, MEM_RESERVE | MEM_COMMIT | bits, PAGE_READWRITE); | ||
| 224 | std::snprintf(what, sizeof what, "%s!VirtualAlloc with type bits %#lx returns memory", dll, | ||
| 225 | static_cast<unsigned long>(bits)); | ||
| 226 | check(p != nullptr, what); | ||
| 227 | if (!p) continue; | ||
| 228 | static_cast<volatile uint8_t*>(p)[0] = 0x5a; | ||
| 229 | check(static_cast<volatile uint8_t*>(p)[0] == 0x5a, "the allocation is committed and writable"); | ||
| 230 | check(VirtualFree(p, 0, MEM_RELEASE), "release the allocation"); | ||
| 231 | } | ||
| 232 | } | ||
| 233 | } | ||
| 234 | |||
| 207 | void print_result() { | 235 | void print_result() { |
| 208 | if (g_failures == 0) { | 236 | if (g_failures == 0) { |
| 209 | std::printf("xmem_test: OK (%d checks)\n", g_checks); | 237 | std::printf("xmem_test: OK (%d checks)\n", g_checks); |
| @@ -250,6 +278,8 @@ int main() { | |||
| 250 | test_virtual_alloc(virtual_alloc, get_write_watch, reset_write_watch); | 278 | test_virtual_alloc(virtual_alloc, get_write_watch, reset_write_watch); |
| 251 | } | 279 | } |
| 252 | 280 | ||
| 281 | test_title_virtual_alloc(); | ||
| 282 | |||
| 253 | print_result(); | 283 | print_result(); |
| 254 | return g_failures ? 1 : 0; | 284 | return g_failures ? 1 : 0; |
| 255 | } | 285 | } |