mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 10:48:36 +12:00
Added Virtual Memory Block for the IO Address Space
Started implementing some the memory mapping functions of libgcm
This commit is contained in:
parent
40f2e679ec
commit
509d46a544
4 changed files with 406 additions and 57 deletions
|
@ -40,6 +40,23 @@ struct MemBlockInfo : public MemInfo
|
|||
}
|
||||
};
|
||||
|
||||
struct VirtualMemInfo : public MemInfo
|
||||
{
|
||||
u64 realAddress;
|
||||
|
||||
VirtualMemInfo(u64 _addr, u64 _realaddr, u32 _size)
|
||||
: MemInfo(_addr, _size)
|
||||
, realAddress(_realaddr)
|
||||
{
|
||||
}
|
||||
|
||||
VirtualMemInfo()
|
||||
: MemInfo(0, 0)
|
||||
, realAddress(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class MemoryBlock
|
||||
{
|
||||
protected:
|
||||
|
@ -206,6 +223,44 @@ private:
|
|||
void AppendLockedMem(u64 addr, u32 size);
|
||||
};
|
||||
|
||||
class VirtualMemoryBlock : public MemoryBlock
|
||||
{
|
||||
Array<VirtualMemInfo> m_mapped_memory;
|
||||
|
||||
public:
|
||||
VirtualMemoryBlock();
|
||||
|
||||
virtual bool IsInMyRange(const u64 addr);
|
||||
virtual bool IsInMyRange(const u64 addr, const u32 size);
|
||||
virtual bool IsMyAddress(const u64 addr);
|
||||
virtual void Delete();
|
||||
|
||||
// maps real address to virtual address space, returns the mapped address or 0 on failure (if no address is specified the
|
||||
// first mappable space is used)
|
||||
virtual u64 Map(u64 realaddr, u32 size, u64 addr = 0);
|
||||
|
||||
// Unmap real address (please specify only starting point, no midway memory will be unmapped)
|
||||
virtual bool UnmapRealAddress(u64 realaddr);
|
||||
|
||||
// Unmap address (please specify only starting point, no midway memory will be unmapped)
|
||||
virtual bool UnmapAddress(u64 addr);
|
||||
|
||||
virtual bool Read8(const u64 addr, u8* value);
|
||||
virtual bool Read16(const u64 addr, u16* value);
|
||||
virtual bool Read32(const u64 addr, u32* value);
|
||||
virtual bool Read64(const u64 addr, u64* value);
|
||||
virtual bool Read128(const u64 addr, u128* value);
|
||||
|
||||
virtual bool Write8(const u64 addr, const u8 value);
|
||||
virtual bool Write16(const u64 addr, const u16 value);
|
||||
virtual bool Write32(const u64 addr, const u32 value);
|
||||
virtual bool Write64(const u64 addr, const u64 value);
|
||||
virtual bool Write128(const u64 addr, const u128 value);
|
||||
|
||||
// return the real address given a mapped address, if not mapped return 0
|
||||
u64 getRealAddr(u64 addr);
|
||||
};
|
||||
|
||||
#include "DynamicMemoryBlockBase.inl"
|
||||
|
||||
typedef DynamicMemoryBlockBase<MemoryBlock> DynamicMemoryBlock;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue