mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 21:58:45 +00:00
Fixed false-positive image reuploads (#1557)
* Fixed false-positive image reuploads * Fixed userfaultfd path, removed dead code, simplified calculations * oopsie * track potentially dirty images and hash them * untrack only first page of the image in case of head access * rebase, initialize hash, fix bounds check * include image tail in the calculations
This commit is contained in:
committed by
GitHub
parent
3f1be5a4ce
commit
18a36c5daa
@@ -114,8 +114,8 @@ struct PageManager::Impl {
|
||||
|
||||
// Notify rasterizer about the fault.
|
||||
const VAddr addr = msg.arg.pagefault.address;
|
||||
const VAddr addr_page = Common::AlignDown(addr, PAGESIZE);
|
||||
rasterizer->InvalidateMemory(addr_page, PAGESIZE);
|
||||
const VAddr addr_page = GetPageAddr(addr);
|
||||
rasterizer->InvalidateMemory(addr, addr_page, PAGESIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@ struct PageManager::Impl {
|
||||
const auto addr = reinterpret_cast<VAddr>(fault_address);
|
||||
const bool is_write = Common::IsWriteError(context);
|
||||
if (is_write && owned_ranges.find(addr) != owned_ranges.end()) {
|
||||
const VAddr addr_aligned = Common::AlignDown(addr, PAGESIZE);
|
||||
rasterizer->InvalidateMemory(addr_aligned, PAGESIZE);
|
||||
const VAddr addr_aligned = GetPageAddr(addr);
|
||||
rasterizer->InvalidateMemory(addr, addr_aligned, PAGESIZE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -174,6 +174,14 @@ PageManager::PageManager(Vulkan::Rasterizer* rasterizer_)
|
||||
|
||||
PageManager::~PageManager() = default;
|
||||
|
||||
VAddr PageManager::GetPageAddr(VAddr addr) {
|
||||
return Common::AlignDown(addr, PAGESIZE);
|
||||
}
|
||||
|
||||
VAddr PageManager::GetNextPageAddr(VAddr addr) {
|
||||
return Common::AlignUp(addr + 1, PAGESIZE);
|
||||
}
|
||||
|
||||
void PageManager::OnGpuMap(VAddr address, size_t size) {
|
||||
impl->OnMap(address, size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user