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

Closed
opened 2026-11-27 22:31:14 +00:00 by Sheffy007 · 2 comments
Sheffy007 commented 2026-11-27 22:31:14 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T22:31:14Z.


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

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6655482961 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/506). Originally posted by [Sheffy007](https://github.com/Sheffy007) on 2026-11-27T22:31:14Z. --- ## 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 commented 2026-11-27 22:31:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T22:31:15Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7229396051 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/506#issuecomment-7229396051). Originally posted by [Sheffy007](https://github.com/Sheffy007) on 2026-11-27T22:31:15Z. --- /claim
github-actions[bot] commented 2026-11-27 22:31:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T22:31:26Z.


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

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7229398586 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/506#issuecomment-7229398586). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T22:31:26Z. --- Claimed by @Sheffy007. Open a draft pull request with `Refs #506` in its description within 24 hours, or the claim expires.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#506
No description provided.