mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-16 07:47:57 -05:00
physmem: add helpers, cleanup logic.
This commit is contained in:
@ -303,6 +303,15 @@ struct VirtualMemoryArea {
|
||||
PAddr paddr = 0;
|
||||
Common::MemoryHookPointer mmio_handler = nullptr;
|
||||
|
||||
/// If the address lies within this VMA, returns the size left before the
|
||||
/// end of this VMA. If the given address doesn't lie within the VMA, then
|
||||
/// an empty optional value is returned.
|
||||
///
|
||||
/// For example, given a VMA 100 bytes long. If '10' was given as the
|
||||
/// start address, then this would return 90.
|
||||
///
|
||||
std::optional<u64> SizeRemainingFromAddress(VAddr address) const;
|
||||
|
||||
/// Tests if this area can be merged to the right with `next`.
|
||||
bool CanBeMergedWith(const VirtualMemoryArea& next) const;
|
||||
};
|
||||
@ -735,6 +744,13 @@ private:
|
||||
MemoryAttribute attribute_mask, MemoryAttribute attribute,
|
||||
MemoryAttribute ignore_mask) const;
|
||||
|
||||
/// Gets the amount of memory currently mapped (state != Unmapped) in a range.
|
||||
ResultVal<std::size_t> SizeOfAllocatedVMAsInRange(VAddr address, std::size_t size) const;
|
||||
|
||||
/// Gets the amount of memory unmappable by UnmapPhysicalMemory in a range.
|
||||
ResultVal<std::size_t> SizeOfUnmappablePhysicalMemoryInRange(VAddr address,
|
||||
std::size_t size) const;
|
||||
|
||||
/**
|
||||
* A map covering the entirety of the managed address space, keyed by the `base` field of each
|
||||
* VMA. It must always be modified by splitting or merging VMAs, so that the invariant
|
||||
|
Reference in New Issue
Block a user