hle(xmem): pool-back MEM_COMMIT calls inside reserved XMemVirtualAlloc ranges on macOS #510

Closed
opened 2026-11-27 22:34:56 +00:00 by github-bot · 2 comments
Owner

@⁠Sheffy007 on GitHub · 2026-11-27 22:31 UTC · original

Summary

On macOS, one-step XMemVirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT, ...) backs the allocation with a Pool via xmem_physical::back_with_pool so the native GPU backend can resolve title addresses through PoolTable (a017f770).

However, when the title reserves virtual address space first (XMemVirtualAlloc(NULL, size, MEM_RESERVE, ...) or a PAGES_64K placeholder) and commits granules or sub-ranges later via XMemVirtualAlloc(at, size, MEM_COMMIT, ...) or VirtualAlloc(at, size, MEM_COMMIT, ...) (as in a_placeholder_reservation_commits_in_parts), xmem_posix.rs:161-172 and host_posix.rs:267-278 call plain mem::commit (mach_vm_protect) on anonymous VM pages without creating pool backing.

As a result, any GPU resource, descriptor heap buffer view, constant buffer, vertex/index buffer, or command placed in two-step committed XMemVirtualAlloc memory is invisible to PoolTable, failing with title address ... is not in a mapped pool or leaving multi-page buffer views as the null view (a buffer view over title memory with a gap stays the null view).

Refs #15, #258

**@⁠Sheffy007** on GitHub · 2026-11-27 22:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/506) ## Summary On macOS, one-step `XMemVirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT, ...)` backs the allocation with a `Pool` via `xmem_physical::back_with_pool` so the native GPU backend can resolve title addresses through `PoolTable` (`a017f770`). However, when the title reserves virtual address space first (`XMemVirtualAlloc(NULL, size, MEM_RESERVE, ...)` or a `PAGES_64K` placeholder) and commits granules or sub-ranges later via `XMemVirtualAlloc(at, size, MEM_COMMIT, ...)` or `VirtualAlloc(at, size, MEM_COMMIT, ...)` (as in `a_placeholder_reservation_commits_in_parts`), `xmem_posix.rs:161-172` and `host_posix.rs:267-278` call plain `mem::commit` (`mach_vm_protect`) on anonymous VM pages without creating pool backing. As a result, any GPU resource, descriptor heap buffer view, constant buffer, vertex/index buffer, or command placed in two-step committed `XMemVirtualAlloc` memory is invisible to `PoolTable`, failing with `title address ... is not in a mapped pool` or leaving multi-page buffer views as the null view (`a buffer view over title memory with a gap stays the null view`). Refs #15, #258
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 22:34:56 +00:00
Author
Owner

@⁠Sheffy007 on GitHub · 2026-11-27 22:31 UTC · original

/claim

**@⁠Sheffy007** on GitHub · 2026-11-27 22:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/506#issuecomment-7229396051) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-27 22:31 UTC · original

Claimed by @⁠Sheffy007. Open a draft pull request with Refs #506 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-27 22:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/506#issuecomment-7229398586) Claimed by @⁠Sheffy007. Open a draft pull request with `Refs #506` in its description within 24 hours, or the claim expires.
This discussion has been locked. Commenting is limited to contributors.
No description provided.