small change to unmapping functions

This commit is contained in:
elisha464 2014-01-21 20:29:16 +02:00
parent 6504ddede4
commit 8514a14cf4
2 changed files with 12 additions and 10 deletions

View file

@ -576,32 +576,34 @@ u64 VirtualMemoryBlock::Map(u64 realaddr, u32 size, u64 addr)
} }
} }
bool VirtualMemoryBlock::UnmapRealAddress(u64 realaddr) u32 VirtualMemoryBlock::UnmapRealAddress(u64 realaddr)
{ {
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i) for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
{ {
if(m_mapped_memory[i].realAddress == realaddr && IsInMyRange(m_mapped_memory[i].addr, m_mapped_memory[i].size)) if(m_mapped_memory[i].realAddress == realaddr && IsInMyRange(m_mapped_memory[i].addr, m_mapped_memory[i].size))
{ {
u32 size = m_mapped_memory[i].size;
m_mapped_memory.RemoveAt(i); m_mapped_memory.RemoveAt(i);
return true; return size;
} }
} }
return false; return 0;
} }
bool VirtualMemoryBlock::UnmapAddress(u64 addr) u32 VirtualMemoryBlock::UnmapAddress(u64 addr)
{ {
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i) for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
{ {
if(m_mapped_memory[i].addr == addr && IsInMyRange(m_mapped_memory[i].addr, m_mapped_memory[i].size)) if(m_mapped_memory[i].addr == addr && IsInMyRange(m_mapped_memory[i].addr, m_mapped_memory[i].size))
{ {
u32 size = m_mapped_memory[i].size;
m_mapped_memory.RemoveAt(i); m_mapped_memory.RemoveAt(i);
return true; return size;
} }
} }
return false; return 0;
} }
bool VirtualMemoryBlock::Read8(const u64 addr, u8* value) bool VirtualMemoryBlock::Read8(const u64 addr, u8* value)

View file

@ -240,11 +240,11 @@ public:
// first mappable space is used) // first mappable space is used)
virtual u64 Map(u64 realaddr, u32 size, u64 addr = 0); virtual u64 Map(u64 realaddr, u32 size, u64 addr = 0);
// Unmap real address (please specify only starting point, no midway memory will be unmapped) // Unmap real address (please specify only starting point, no midway memory will be unmapped), returns the size of the unmapped area
virtual bool UnmapRealAddress(u64 realaddr); virtual u32 UnmapRealAddress(u64 realaddr);
// Unmap address (please specify only starting point, no midway memory will be unmapped) // Unmap address (please specify only starting point, no midway memory will be unmapped), returns the size of the unmapped area
virtual bool UnmapAddress(u64 addr); virtual u32 UnmapAddress(u64 addr);
// Reserve a certain amount so no one can use it, returns true on succces, false on failure // Reserve a certain amount so no one can use it, returns true on succces, false on failure
virtual bool Reserve(u32 size); virtual bool Reserve(u32 size);