diff options
| author | Gliniak <Gliniak93@gmail.com> | 2020-09-16 20:31:53 +0200 |
|---|---|---|
| committer | Rick Gibbed <rick@gibbed.us> | 2020-11-22 15:43:53 -0600 |
| commit | a6868d1f8a2e59adf1b88cb89aa389a20c0efe89 (patch) | |
| tree | 4cf4d944a4e57231c37b2daa8c0d3f2d064db95c | |
| parent | 26b0aa0cc44ddaa7335a07f3bc4107e31cc522b7 (diff) | |
[Memory] Removed redundant BaseHeap::IsGuestPhysicalHeap
| -rw-r--r-- | src/xenia/kernel/xfile.cc | 8 | ||||
| -rw-r--r-- | src/xenia/memory.cc | 6 | ||||
| -rw-r--r-- | src/xenia/memory.h | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/src/xenia/kernel/xfile.cc b/src/xenia/kernel/xfile.cc index 15529fc6d..c60a6615c 100644 --- a/src/xenia/kernel/xfile.cc +++ b/src/xenia/kernel/xfile.cc @@ -122,14 +122,14 @@ X_STATUS XFile::Read(uint32_t buffer_guest_address, uint32_t buffer_length, const xe::BaseHeap* buffer_end_heap = memory()->LookupHeap(buffer_guest_high_address); if (!buffer_start_heap || !buffer_end_heap || - buffer_start_heap->IsGuestPhysicalHeap() != - buffer_end_heap->IsGuestPhysicalHeap() || - (buffer_start_heap->IsGuestPhysicalHeap() && + (buffer_start_heap->heap_type() == HeapType::kGuestPhysical) != + (buffer_end_heap->heap_type() == HeapType::kGuestPhysical) || + (buffer_start_heap->heap_type() == HeapType::kGuestPhysical && buffer_start_heap != buffer_end_heap)) { result = X_STATUS_ACCESS_VIOLATION; } else { xe::PhysicalHeap* buffer_physical_heap = - buffer_start_heap->IsGuestPhysicalHeap() + buffer_start_heap->heap_type() == HeapType::kGuestPhysical ? static_cast<xe::PhysicalHeap*>(buffer_start_heap) : nullptr; if (buffer_physical_heap && diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index b6ceb54b4..c6e55c98b 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -375,7 +375,7 @@ uint32_t Memory::HostToGuestVirtualThunk(const void* context, uint32_t Memory::GetPhysicalAddress(uint32_t address) const { const BaseHeap* heap = LookupHeap(address); - if (!heap || !heap->IsGuestPhysicalHeap()) { + if (!heap || heap->heap_type() != HeapType::kGuestPhysical) { return UINT32_MAX; } return static_cast<const PhysicalHeap*>(heap)->GetPhysicalAddress(address); @@ -451,7 +451,7 @@ bool Memory::AccessViolationCallback( } uint32_t virtual_address = HostToGuestVirtual(host_address); BaseHeap* heap = LookupHeap(virtual_address); - if (!heap->IsGuestPhysicalHeap()) { + if (heap->heap_type() != HeapType::kGuestPhysical) { return false; } @@ -477,7 +477,7 @@ bool Memory::TriggerPhysicalMemoryCallbacks( uint32_t virtual_address, uint32_t length, bool is_write, bool unwatch_exact_range, bool unprotect) { BaseHeap* heap = LookupHeap(virtual_address); - if (heap->IsGuestPhysicalHeap()) { + if (heap->heap_type() == HeapType::kGuestPhysical) { auto physical_heap = static_cast<PhysicalHeap*>(heap); return physical_heap->TriggerCallbacks(std::move(global_lock_locked_once), virtual_address, length, is_write, diff --git a/src/xenia/memory.h b/src/xenia/memory.h index d5e7ea4da..5a0f6084d 100644 --- a/src/xenia/memory.h +++ b/src/xenia/memory.h @@ -187,9 +187,6 @@ class BaseHeap { xe::memory::PageAccess QueryRangeAccess(uint32_t low_address, uint32_t high_address); - // Whether the heap is a guest virtual memory mapping of the physical memory. - virtual bool IsGuestPhysicalHeap() const { return false; } - bool Save(ByteStream* stream); bool Restore(ByteStream* stream); @@ -264,7 +261,6 @@ class PhysicalHeap : public BaseHeap { uint32_t virtual_address, uint32_t length, bool is_write, bool unwatch_exact_range, bool unprotect = true); - bool IsGuestPhysicalHeap() const override { return true; } uint32_t GetPhysicalAddress(uint32_t address) const; protected: |
