Core: Fix module load addresses - #2879
Conversation
Most modules are mapped starting at 0x800000000, with no gaps between mappings.
Looking at our address space, all platforms will have this base address mapped, so there shouldn't be any problem in using it.
Since real hardware has no gap between module mappings, the Fixed flag is just an annoyance to work around, and has no impact on the actual mappings. Swapping the module mappings to use flags NoFlags instead simplifies our code slightly.
On real hardware, the file extension is part of the mapping name. Easiest way to manage this is to swap the name to be `file.filename().string()` instead of `file.stem().string()`
|
No regressions on my end. |
|
Battlefield 4 same error, but unfortunately still not affected |
Completely missed this, whoops.
|
As a note for future reference, this PR still isn't fully accurate. Due to our current address space implementation, handling these accurately isn't possible on Windows. Both of these addresses can be before the |
Wouldn't it be better to add a comment explaining this here or nah? |
|
@rafael-57 |
* Fix module map addresses Most modules are mapped starting at 0x800000000, with no gaps between mappings. * Hardcode hardware accurate base address Looking at our address space, all platforms will have this base address mapped, so there shouldn't be any problem in using it. * Clang * Swap module mapping to NoFlags, remove offset code Since real hardware has no gap between module mappings, the Fixed flag is just an annoyance to work around, and has no impact on the actual mappings. Swapping the module mappings to use flags NoFlags instead simplifies our code slightly. * Fix module mapping names On real hardware, the file extension is part of the mapping name. Easiest way to manage this is to swap the name to be `file.filename().string()` instead of `file.stem().string()` * Fix patches Completely missed this, whoops.
* Fix module map addresses Most modules are mapped starting at 0x800000000, with no gaps between mappings. * Hardcode hardware accurate base address Looking at our address space, all platforms will have this base address mapped, so there shouldn't be any problem in using it. * Clang * Swap module mapping to NoFlags, remove offset code Since real hardware has no gap between module mappings, the Fixed flag is just an annoyance to work around, and has no impact on the actual mappings. Swapping the module mappings to use flags NoFlags instead simplifies our code slightly. * Fix module mapping names On real hardware, the file extension is part of the mapping name. Easiest way to manage this is to swap the name to be `file.filename().string()` instead of `file.stem().string()` * Fix patches Completely missed this, whoops.
* Fix module map addresses Most modules are mapped starting at 0x800000000, with no gaps between mappings. * Hardcode hardware accurate base address Looking at our address space, all platforms will have this base address mapped, so there shouldn't be any problem in using it. * Clang * Swap module mapping to NoFlags, remove offset code Since real hardware has no gap between module mappings, the Fixed flag is just an annoyance to work around, and has no impact on the actual mappings. Swapping the module mappings to use flags NoFlags instead simplifies our code slightly. * Fix module mapping names On real hardware, the file extension is part of the mapping name. Easiest way to manage this is to swap the name to be `file.filename().string()` instead of `file.stem().string()` * Fix patches Completely missed this, whoops.

On a PS4, all modules are mapped starting at address
0x800000000, and with no gaps in-between. Since all platforms are able to map to these addresses, we can hard code this address as a constant and use that as the "base" address we map to.The information this PR is based on comes from observations visible in this klog:
Memory Map Query klog.txt
These changes fix
[Debug] <Critical> memory.cpp:331 operator(): Assertion Failed!when booting some Call of Duty games.Specifically from my testing, this fixes updated versions of Call of Duty®: Advanced Warfare (CUSA00803) crashing on startup (note that these titles still need to be loaded from
default.elfto bypasssceSystemServiceLoadExec)CoD AW main log.txt
CoD AW PR log.txt
This doesn't appear to regress any games on my end, wouldn't hurt to have testers though.