Match XMem allocation hysteresis query width on build 19041 #217

Closed
github-bot wants to merge 1 commit from gh-pr/217/head into gh-pr/217/base
Owner

@⁠bambermf on GitHub · 2026-11-23 05:31 UTC · original
bambermf:fix/xmem-19041-hysteresis-width → main · +18 −1 · 1 files · 1 commits · closed without merging

Library / area: XMem pool allocation hysteresis on console OS build 19041.

Exports changed (exports.txt rows): none. The affected export is XMemGetAllocationHysteresis.

Source of the behaviour: headless IDA analysis of the XMem DLL version 10.0.19041.3948 from Fortnite 2.0.1461.7919. I also ran the original getter instructions in Unicorn with a populated pool record and a stand-in for SetLastError. This measures the getter's arithmetic in isolation.

What was wrong

The getter returned a 64-bit byte count. The 19041 getter shifts the page count in a 32-bit register and zero-extends the result. This becomes observable when the threshold rounds up to 4 GiB.

Measurements

4 MiB pages Original getter in Unicorn Upstream a7a98e0 This change
1,023 0xffc00000 0xffc00000 0xffc00000
1,024 0 0x100000000 0
1,025 0x400000 0x100400000 0x400000

The emulator probes called the exported setter and getter. The third probe requested 4 GiB + 1 byte, which the setter rounds up to the next page.

The change

Use the 32-bit shift when reporting the 19041 pool threshold. Other pool formats retain their existing width. The stored page count and trimming behavior are unchanged.

Tests

The regression covers both sides of the 4 GiB boundary and the two newer granule sizes. The release XMem suite on base f6ae886 with this change passed 56 unit tests and 3 integration tests. The upstream PR gate checked one file and found zero problems.

**@⁠bambermf** on GitHub · 2026-11-23 05:31 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/217) `bambermf:fix/xmem-19041-hysteresis-width` → `main` · +18 −1 · 1 files · 1 commits · closed without merging **Library / area:** XMem pool allocation hysteresis on console OS build 19041. **Exports changed (exports.txt rows):** none. The affected export is `XMemGetAllocationHysteresis`. **Source of the behaviour:** headless IDA analysis of the XMem DLL version 10.0.19041.3948 from Fortnite 2.0.1461.7919. I also ran the original getter instructions in Unicorn with a populated pool record and a stand-in for SetLastError. This measures the getter's arithmetic in isolation. ### What was wrong The getter returned a 64-bit byte count. The 19041 getter shifts the page count in a 32-bit register and zero-extends the result. This becomes observable when the threshold rounds up to 4 GiB. ### Measurements | 4 MiB pages | Original getter in Unicorn | Upstream a7a98e0 | This change | |---:|---:|---:|---:| | 1,023 | 0xffc00000 | 0xffc00000 | 0xffc00000 | | 1,024 | 0 | 0x100000000 | 0 | | 1,025 | 0x400000 | 0x100400000 | 0x400000 | The emulator probes called the exported setter and getter. The third probe requested 4 GiB + 1 byte, which the setter rounds up to the next page. ### The change Use the 32-bit shift when reporting the 19041 pool threshold. Other pool formats retain their existing width. The stored page count and trimming behavior are unchanged. ### Tests The regression covers both sides of the 4 GiB boundary and the two newer granule sizes. The release XMem suite on base `f6ae886` with this change passed 56 unit tests and 3 integration tests. The upstream PR gate checked one file and found zero problems.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:14:23 +00:00
github-bot closed this pull request 2026-11-26 06:14:24 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 05:44 UTC · original

Applied in 3eac085 (merged in 1dc9fff) with your authorship kept, thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 05:44 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/217#issuecomment-7092677006) Applied in 3eac085 (merged in 1dc9fff) with your authorship kept, thanks.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.