diff options
| author | bunnei <bunneidev@gmail.com> | 2018-11-24 23:45:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-24 23:45:00 -0500 |
| commit | 7d544c1b9dd96a487daecc9b86ce957494bb9e7c (patch) | |
| tree | 4feee594c2ca6145a88509c9912ef700b3e9e2da /src/video_core/memory_manager.cpp | |
| parent | f7a1827aaa384863c1a2bdff13a322aa9d89dfd2 (diff) | |
| parent | 0b1842294f5f43ea2ee42bb8afd26e57c9250f4b (diff) | |
Merge pull request #1787 from bunnei/fix-gpu-mm
memory_manager: Do not allow 0 to be a valid GPUVAddr.
Diffstat (limited to 'src/video_core/memory_manager.cpp')
| -rw-r--r-- | src/video_core/memory_manager.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 77a20bb84..47247f097 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -9,6 +9,13 @@ namespace Tegra { +MemoryManager::MemoryManager() { + // Mark the first page as reserved, so that 0 is not a valid GPUVAddr. Otherwise, games might + // try to use 0 as a valid address, which is also used to mean nullptr. This fixes a bug with + // Undertale using 0 for a render target. + PageSlot(0) = static_cast<u64>(PageStatus::Reserved); +} + GPUVAddr MemoryManager::AllocateSpace(u64 size, u64 align) { const std::optional<GPUVAddr> gpu_addr{FindFreeBlock(0, size, align, PageStatus::Unmapped)}; |
