Trying to do MMIO protects on allocation granularity.

This commit is contained in:
Ben Vanik
2015-05-18 20:47:26 -07:00
parent 92f5fe3b88
commit 8bfc43bb0d
2 changed files with 18 additions and 10 deletions

View File

@@ -804,12 +804,17 @@ bool BaseHeap::Release(uint32_t base_address, uint32_t* out_region_size) {
PLOGE("BaseHeap::Release failed due to host VirtualFree failure");
return false;
}*/
// Instead, we just protect it.
DWORD old_protect;
if (!VirtualProtect(membase_ + heap_base_ + base_page_number * page_size_,
base_page_entry.region_page_count * page_size_,
PAGE_NOACCESS, &old_protect)) {
XELOGW("BaseHeap::Release failed due to host VirtualProtect failure");
// Instead, we just protect it, if we can.
if (page_size_ == xe::page_size() ||
((base_page_entry.region_page_count * page_size_) % xe::page_size() ==
0) &&
((base_page_number * page_size_) % xe::page_size() == 0)) {
DWORD old_protect;
if (!VirtualProtect(membase_ + heap_base_ + base_page_number * page_size_,
base_page_entry.region_page_count * page_size_,
PAGE_NOACCESS, &old_protect)) {
XELOGW("BaseHeap::Release failed due to host VirtualProtect failure");
}
}
// Perform table change.