mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 18:45:36 +00:00
Properly handle GPU access rights
Since my first commit restricts GPU mappings to memory areas with GPU access permissions, we also need to be updating the GPU mappings appropriately during Protect calls too.
This commit is contained in:
parent
f0852650cc
commit
55099c0aac
@ -578,6 +578,18 @@ s64 MemoryManager::ProtectBytes(VAddr addr, VirtualMemoryArea vma_base, size_t s
|
|||||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vma_base.prot < MemoryProt::GpuRead && prot >= MemoryProt::GpuRead) {
|
||||||
|
// New protection will give the GPU access to this VMA, perform a rasterizer map
|
||||||
|
ASSERT_MSG(IsValidGpuMapping(addr, size), "Invalid address for GPU mapping");
|
||||||
|
rasterizer->MapMemory(addr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vma_base.prot >= MemoryProt::GpuRead && prot < MemoryProt::GpuRead) {
|
||||||
|
// New protection will remove the GPU's access to this VMA, perform a rasterizer unmap
|
||||||
|
ASSERT_MSG(IsValidGpuMapping(addr, size), "Invalid address for GPU unmap");
|
||||||
|
rasterizer->UnmapMemory(addr, size);
|
||||||
|
}
|
||||||
|
|
||||||
// Change protection
|
// Change protection
|
||||||
vma_base.prot = prot;
|
vma_base.prot = prot;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user