[CPU] Remove unused access violation handler variables

This commit is contained in:
Triang3l 2019-08-13 00:06:29 +03:00
parent 470f9946d6
commit f1b9e1afce
1 changed files with 2 additions and 15 deletions

View File

@ -294,27 +294,14 @@ bool MMIOHandler::ExceptionCallback(Exception* ex) {
} }
} }
if (!range) { if (!range) {
auto fault_address = reinterpret_cast<uint8_t*>(ex->fault_address());
uint32_t guest_address, guest_heap_address;
if (fault_address >= virtual_membase_ &&
fault_address < physical_membase_) {
// Faulting on a virtual address.
guest_address = static_cast<uint32_t>(ex->fault_address()) & 0x1FFFFFFF;
guest_heap_address =
static_cast<uint32_t>(ex->fault_address()) & ~0x1FFFFFFF;
} else {
// Faulting on a physical address.
guest_address = static_cast<uint32_t>(ex->fault_address());
guest_heap_address = 0;
}
// Recheck if the pages are still protected (race condition - another thread // Recheck if the pages are still protected (race condition - another thread
// clears the writewatch we just hit). // clears the writewatch we just hit).
// Do this under the lock so we don't introduce another race condition. // Do this under the lock so we don't introduce another race condition.
auto lock = global_critical_region_.Acquire(); auto lock = global_critical_region_.Acquire();
memory::PageAccess cur_access; memory::PageAccess cur_access;
size_t page_length = memory::page_size(); size_t page_length = memory::page_size();
memory::QueryProtect((void*)fault_address, page_length, cur_access); memory::QueryProtect(reinterpret_cast<void*>(ex->fault_address()),
page_length, cur_access);
if (cur_access != memory::PageAccess::kReadOnly && if (cur_access != memory::PageAccess::kReadOnly &&
cur_access != memory::PageAccess::kNoAccess) { cur_access != memory::PageAccess::kNoAccess) {
// Another thread has cleared this write watch. Abort. // Another thread has cleared this write watch. Abort.