[PR #3697] [MERGED] Core: Increase address space limits and rework Windows address space initialization. #3664

Closed
opened 2026-02-27 22:04:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3697
Author: @StevenMiller123
Created: 10/3/2025
Status: Merged
Merged: 10/4/2025
Merged by: @squidbus

Base: mainHead: large-addresses


📝 Commits (10+)

📊 Changes

8 files changed (+255 additions, -138 deletions)

View changed files

📝 CMakeLists.txt (+8 -1)
📝 src/core/address_space.cpp (+141 -65)
📝 src/core/address_space.h (+4 -16)
📝 src/core/libraries/gnmdriver/gnmdriver.cpp (+11 -1)
📝 src/core/libraries/kernel/threads/pthread.cpp (+1 -1)
📝 src/core/libraries/kernel/threads/thread_state.cpp (+2 -1)
📝 src/core/memory.cpp (+55 -49)
📝 src/core/memory.h (+33 -4)

📄 Description

Current Windows builds of shadPS4 are prone to asserting in address_space on emulator initialization due to Windows' address space randomization. This also prevents expanding the address space to higher addresses (which is needed for a handful of EA titles).

This PR introduces logic to detect and map around system mappings on Windows devices, pass information about these gaps to our memory code, and more robust address validation logic to ensure gaps are accounted for when detecting if requested memory areas are within the vma map.

For Mac users: this PR should make asserts trigger more consistently when games try mapping to addresses that we can't reserve.

For Windows users: this PR should fix those random-ish cases of

[Debug] <Critical> address_space.cpp:105 operator(): Assertion Failed!
Unable to reserve virtual address space: Not enough memory resources are available to process this command.

For all users: this PR should address cases of the following assert triggering on addresses greater than 0x11000000000 (mainly seen in earlier titles published by EA).

[Debug] memory.cpp:902 operator(): Assertion Failed!
Input address .... is out of bounds

I'm opening this as a draft for now since I need to test edge cases further, and ideally make sure our own HLE mappings aren't going to hit asserts in the more extreme cases.

I would also appreciate some tests from the aforementioned EA games, the only thing I have hitting that out of bounds assert is an app, and it dies from a Windows-specific issue with code patches.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3697 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 10/3/2025 **Status:** ✅ Merged **Merged:** 10/4/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `large-addresses` --- ### 📝 Commits (10+) - [`5b0b14d`](https://github.com/shadps4-emu/shadPS4/commit/5b0b14ddf90e4b0d9b3d1e8ce322134f9f87b8c4) SearchFree adjustments - [`0bd3538`](https://github.com/shadps4-emu/shadPS4/commit/0bd353866816a66e913ae05a230672e6af0dbe52) Robust address validation - [`6d59f4c`](https://github.com/shadps4-emu/shadPS4/commit/6d59f4c68e6db5fc7ecdf3c65612a95d4cafcdfa) Map around gaps - [`7f4d7aa`](https://github.com/shadps4-emu/shadPS4/commit/7f4d7aad7f7b9e8ee4c23a6183676adb544c044c) Initialize vma_map using gaps - [`7d0fbc4`](https://github.com/shadps4-emu/shadPS4/commit/7d0fbc41877cf072a517bfa36d15a3f1499de101) Clang - [`92a7908`](https://github.com/shadps4-emu/shadPS4/commit/92a79082928d93db9a02e2d4e56fb6256d7c62d6) Fix compile - [`130a21b`](https://github.com/shadps4-emu/shadPS4/commit/130a21b0c6efcef99bb684c76fdcec0fc79fa1e5) Clang - [`50fb49f`](https://github.com/shadps4-emu/shadPS4/commit/50fb49fd688e7ed5c18c8b04e9ee1a5a84146398) Fix compile again - [`4b58d61`](https://github.com/shadps4-emu/shadPS4/commit/4b58d61a0ee946ce32865fa5df3f88ee71d37e72) Set system_managed_base and system_managed_size based on - [`154db18`](https://github.com/shadps4-emu/shadPS4/commit/154db181aadc8a3374d800d5ae6ef699efb81702) Reduce address validation in SearchFree ### 📊 Changes **8 files changed** (+255 additions, -138 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+8 -1) 📝 `src/core/address_space.cpp` (+141 -65) 📝 `src/core/address_space.h` (+4 -16) 📝 `src/core/libraries/gnmdriver/gnmdriver.cpp` (+11 -1) 📝 `src/core/libraries/kernel/threads/pthread.cpp` (+1 -1) 📝 `src/core/libraries/kernel/threads/thread_state.cpp` (+2 -1) 📝 `src/core/memory.cpp` (+55 -49) 📝 `src/core/memory.h` (+33 -4) </details> ### 📄 Description Current Windows builds of shadPS4 are prone to asserting in address_space on emulator initialization due to Windows' address space randomization. This also prevents expanding the address space to higher addresses (which is needed for a handful of EA titles). This PR introduces logic to detect and map around system mappings on Windows devices, pass information about these gaps to our memory code, and more robust address validation logic to ensure gaps are accounted for when detecting if requested memory areas are within the vma map. For Mac users: this PR should make asserts trigger more consistently when games try mapping to addresses that we can't reserve. For Windows users: this PR should fix those random-ish cases of ``` [Debug] <Critical> address_space.cpp:105 operator(): Assertion Failed! Unable to reserve virtual address space: Not enough memory resources are available to process this command. ``` For all users: this PR should address cases of the following assert triggering on addresses greater than 0x11000000000 (mainly seen in earlier titles published by EA). ``` [Debug] memory.cpp:902 operator(): Assertion Failed! Input address .... is out of bounds ``` I'm opening this as a draft for now since I need to test edge cases further, and ideally make sure our own HLE mappings aren't going to hit asserts in the more extreme cases. I would also appreciate some tests from the aforementioned EA games, the only thing I have hitting that out of bounds assert is an app, and it dies from a Windows-specific issue with code patches. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:04:32 +03:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3664
No description provided.