[Memory] Fix memory watch addresses

This commit is contained in:
Triang3l 2019-08-16 08:49:48 +03:00
parent 834ced0d63
commit 126978d960
1 changed files with 2 additions and 2 deletions

View File

@ -1513,7 +1513,7 @@ void PhysicalHeap::WatchPhysicalWrite(uint32_t physical_address,
// Protect the pages and mark them as watched. Don't mark non-writable pages // Protect the pages and mark them as watched. Don't mark non-writable pages
// as watched, so true access violations can still occur there. // as watched, so true access violations can still occur there.
uint8_t* protect_base = TranslateRelative(0); uint8_t* protect_base = membase_ + heap_base_;
uint32_t protect_system_page_first = UINT32_MAX; uint32_t protect_system_page_first = UINT32_MAX;
for (uint32_t i = system_page_first; i <= system_page_last; ++i) { for (uint32_t i = system_page_first; i <= system_page_last; ++i) {
uint64_t page_bit = uint64_t(1) << (i & 63); uint64_t page_bit = uint64_t(1) << (i & 63);
@ -1671,7 +1671,7 @@ bool PhysicalHeap::TriggerWatches(uint32_t virtual_address, uint32_t length,
// Unprotect ranges that need unprotection. // Unprotect ranges that need unprotection.
if (unprotect) { if (unprotect) {
uint8_t* protect_base = TranslateRelative(0); uint8_t* protect_base = membase_ + heap_base_;
uint32_t unprotect_system_page_first = UINT32_MAX; uint32_t unprotect_system_page_first = UINT32_MAX;
for (uint32_t i = system_page_first; i <= system_page_last; ++i) { for (uint32_t i = system_page_first; i <= system_page_last; ++i) {
// Check if need to allow writing to this page. // Check if need to allow writing to this page.