mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-20 10:24:58 +00:00
memory: Cleanups and refactors (#324)
* memory: Various fixes * Added (Partial) sceKernelBatchMap/sceKernelBatchMap2 * memory: Rename and implement batch unmap * memory: Remove uneeded assert * memory: Commonize free search routine * memory: Contains check is inclusive * memory: Address some alignment issues * clang format --------- Co-authored-by: raziel1000 <ckraziel@gmail.com>
This commit is contained in:
parent
bc28ed66e8
commit
a2cd1669b6
10 changed files with 198 additions and 90 deletions
|
@ -89,7 +89,15 @@ struct VirtualMemoryArea {
|
|||
uintptr_t fd = 0;
|
||||
|
||||
bool Contains(VAddr addr, size_t size) const {
|
||||
return addr >= base && (addr + size) < (base + this->size);
|
||||
return addr >= base && (addr + size) <= (base + this->size);
|
||||
}
|
||||
|
||||
bool IsFree() const noexcept {
|
||||
return type == VMAType::Free;
|
||||
}
|
||||
|
||||
bool IsMapped() const noexcept {
|
||||
return type != VMAType::Free && type != VMAType::Reserved;
|
||||
}
|
||||
|
||||
bool CanMergeWith(const VirtualMemoryArea& next) const {
|
||||
|
@ -198,9 +206,11 @@ private:
|
|||
return iter;
|
||||
}
|
||||
|
||||
VirtualMemoryArea& AddMapping(VAddr virtual_addr, size_t size);
|
||||
VAddr SearchFree(VAddr virtual_addr, size_t size, u32 alignment = 0);
|
||||
|
||||
DirectMemoryArea& AddDmemAllocation(PAddr addr, size_t size);
|
||||
VMAHandle CarveVMA(VAddr virtual_addr, size_t size);
|
||||
|
||||
DirectMemoryArea& CarveDmemArea(PAddr addr, size_t size);
|
||||
|
||||
VMAHandle Split(VMAHandle vma_handle, size_t offset_in_vma);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue