|
ReXGlue SDK
|
#include <rex/kernel/heap.h>
Classes | |
| struct | SystemPageFlagsBlock |
Public Member Functions | |
| void | Initialize (kernel::GuestAddressSpace *memory, u8 *membase, HeapType heap_type, u32 heap_base, u32 heap_size, u32 page_size, VirtualHeap *parent_heap) |
| bool | Alloc (u32 size, u32 alignment, u32 allocation_type, u32 protect, bool top_down, u32 *out_address) override |
| bool | AllocFixed (u32 base_address, u32 size, u32 alignment, u32 allocation_type, u32 protect) override |
| bool | AllocRange (u32 low_address, u32 high_address, u32 size, u32 alignment, u32 allocation_type, u32 protect, bool top_down, u32 *out_address) override |
| bool | AllocSystemHeap (u32 size, u32 alignment, u32 allocation_type, u32 protect, bool top_down, u32 *out_address) override |
| bool | Decommit (u32 address, u32 size) override |
| bool | Release (u32 base_address, u32 *out_region_size=nullptr) override |
| bool | Protect (u32 address, u32 size, u32 protect, u32 *old_protect=nullptr) override |
| void | EnableAccessCallbacks (u32 physical_address, u32 length, bool enable_invalidation_notifications, bool enable_data_providers) |
| bool | TriggerCallbacks (u32 virtual_address, u32 length, bool is_write, bool unwatch_exact_range, bool unprotect=true) |
| bool | TriggerCallbacksLocked (u32 virtual_address, u32 length, bool is_write, bool unwatch_exact_range, bool unprotect=true) |
| u32 | GetPhysicalAddress (u32 address) const |
| Public Member Functions inherited from rex::kernel::BaseHeap | |
| virtual | ~BaseHeap () |
| u32 | GetHeapBase () const |
| u32 | GetHeapSize () const |
| u32 | GetPageSize () const |
| HeapType | GetHeapType () const |
| u32 | GetHostAddressOffset () const |
| template<typename T = u8*> | |
| T | TranslateRelative (size_t relative_address) const |
| virtual void | Dispose () |
| u32 | GetTotalPageCount () const |
| u32 | GetUnreservedPageCount () const |
| u32 | GetReservedPageCount () const |
| u32 | GetCommittedPages () const |
| void | PlotProfile () const |
| bool | ReleaseRange (u32 address, u32 size, u32 *out_address, u32 *out_size) |
| bool | QueryRegionInfo (u32 base_address, HeapAllocation *out_info) |
| bool | QuerySize (u32 address, u32 *out_size) |
| bool | QueryProtect (u32 address, u32 *out_protect) |
| rex::memory::PageAccess | QueryRangeAccess (u32 low_address, u32 high_address) |
| rex::memory::PageAccess | GetHostPageAccess (u32 host_page_number) const |
| bool | ReapplyHostPageAccess (void *host_address, bool is_write) |
Protected Member Functions | |
| bool | IsHostPageWriteWatched (u32 host_page_number) const override |
| std::unique_lock< rex::platform::RankedMutex > | AcquireHostPageReconcileLock () const override |
| Protected Member Functions inherited from rex::kernel::BaseHeap | |
| rex::memory::PageAccess | GetHostPageGuestAccess (u32 host_page_number) const |
| bool | SyncHostPageAccess (u32 start_page_number, u32 end_page_number) |
| u32 | GetSystemRangeBase () const |
| bool | AllocFixedLocked (u32 base_address, u32 size, u32 alignment, u32 allocation_type, u32 protect) |
| bool | AllocRangeLocked (u32 low_address, u32 high_address, u32 size, u32 alignment, u32 allocation_type, u32 protect, bool top_down, u32 *out_address) |
| bool | DecommitLocked (u32 address, u32 size) |
| bool | ReleaseLocked (u32 address, u32 *out_region_size) |
| bool | ReleaseRangeLocked (u32 address, u32 size, u32 *out_address, u32 *out_size) |
| bool | ProtectLocked (u32 address, u32 size, u32 protect, u32 *old_protect) |
| bool | CheckProtectRangeLocked (u32 address, u32 size, u32 *out_start_page, u32 *out_end_page) |
| void | OnPageCommitted (u32 page_number) |
| void | OnPageDecommitted (u32 page_number) |
| void | Initialize (kernel::GuestAddressSpace *memory, u8 *membase, HeapType heap_type, u32 heap_base, u32 heap_size, u32 page_size, u32 host_address_offset=0) |
Protected Attributes | |
| VirtualHeap * | parent_heap_ |
| u32 | system_page_size_ |
| u32 | system_page_count_ |
| std::vector< SystemPageFlagsBlock > | system_page_flags_ |
| Protected Attributes inherited from rex::kernel::BaseHeap | |
| kernel::GuestAddressSpace * | memory_ |
| u8 * | membase_ |
| HeapType | heap_type_ |
| u32 | heap_base_ |
| u32 | heap_size_ |
| u32 | page_size_ |
| u32 | page_size_shift_ = 0 |
| u32 | host_address_offset_ |
| u32 | unreserved_page_count_ = 0 |
| std::atomic< u32 > | committed_pages_ {0} |
| const char * | profile_pool_ = nullptr |
| const char * | profile_plot_ = nullptr |
| std::recursive_mutex | heap_mutex_ |
| std::vector< PageEntry > | page_table_ |
A heap for memory mapped to physical ranges, used by hardware wired to memory. It allocates through a parent heap in the guest virtual address space, 1:1 with the physical address space.
|
overrideprotectedvirtual |
Takes the memory watch lock when this heap or its parent has guest pages smaller than host pages.
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Allocates pages in the parent heap and maps them at the matching address of this heap.
| allocation_type | MemoryAllocationFlag bits. |
| protect | MemoryProtectFlag bits. |
| top_down | Ignored, allocation always runs from the top of the heap. |
| out_address | Receives the allocated guest address. |
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Allocates pages at the given address in the parent heap and in this heap.
| base_address | Guest address to allocate at. |
| allocation_type | MemoryAllocationFlag bits. |
| protect | MemoryProtectFlag bits. |
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Allocates pages within an address range in the parent heap and in this heap.
| allocation_type | MemoryAllocationFlag bits. |
| protect | MemoryProtectFlag bits. |
| top_down | True to allocate from the top of the range. |
| out_address | Receives the allocated guest address. |
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Allocates with Alloc, as physical heaps have no system portion.
| allocation_type | MemoryAllocationFlag bits. |
| protect | MemoryProtectFlag bits. |
| top_down | Ignored, allocation always runs from the top of the heap. |
| out_address | Receives the allocated guest address. |
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Decommits pages in the parent heap and in this heap, invalidating watched pages.
Reimplemented from rex::kernel::BaseHeap.
| void rex::kernel::PhysicalHeap::EnableAccessCallbacks | ( | u32 | physical_address, |
| u32 | length, | ||
| bool | enable_invalidation_notifications, | ||
| bool | enable_data_providers ) |
Enables write invalidation notifications for the system pages of a physical range.
| enable_invalidation_notifications | True to notify when the title writes the range. |
| enable_data_providers | True to enable data providers, which are unsupported. |
| u32 rex::kernel::PhysicalHeap::GetPhysicalAddress | ( | u32 | address | ) | const |
Translates a guest address in this heap to its physical address.
| void rex::kernel::PhysicalHeap::Initialize | ( | kernel::GuestAddressSpace * | memory, |
| u8 * | membase, | ||
| HeapType | heap_type, | ||
| u32 | heap_base, | ||
| u32 | heap_size, | ||
| u32 | page_size, | ||
| VirtualHeap * | parent_heap ) |
Initializes the heap properties and allocates the page table.
| heap_base | The heap offset relative to membase. |
| parent_heap | The heap that performs allocation in the guest virtual address space. |
|
overrideprotectedvirtual |
Reports whether a host page is write watched, so SyncHostPageAccess must not restore write access to it. Only PhysicalHeap tracks this.
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Changes protection in the parent heap and in this heap, invalidating watched pages when the range becomes writable.
| protect | MemoryProtectFlag bits. |
| old_protect | Receives the previous protection. |
Reimplemented from rex::kernel::BaseHeap.
|
overridevirtual |
Releases the region in the parent heap and in this heap, invalidating watched pages.
| out_region_size | Receives the size of the released region. |
Reimplemented from rex::kernel::BaseHeap.
| bool rex::kernel::PhysicalHeap::TriggerCallbacks | ( | u32 | virtual_address, |
| u32 | length, | ||
| bool | is_write, | ||
| bool | unwatch_exact_range, | ||
| bool | unprotect = true ) |
Triggers the physical memory access callbacks of the watched pages in a range.
| unwatch_exact_range | True to unwatch only the requested range. |
| unprotect | True to restore host write access. |
|
protected |
Virtual heap whose pages back this physical heap.
|
protected |
Number of host pages that cover the heap including host_address_offset_.
|
protected |
Guarded by GuestAddressSpace::LockWatches().