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)
{
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);
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)
{
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);
return true;
return size;
}
}
return false;
return 0;
}
bool VirtualMemoryBlock::Read8(const u64 addr, u8* value)

View File

@ -240,11 +240,11 @@ public:
// 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 real address (please specify only starting point, no midway memory will be unmapped), returns the size of the unmapped area
virtual u32 UnmapRealAddress(u64 realaddr);
// Unmap address (please specify only starting point, no midway memory will be unmapped)
virtual bool UnmapAddress(u64 addr);
// Unmap address (please specify only starting point, no midway memory will be unmapped), returns the size of the unmapped area
virtual u32 UnmapAddress(u64 addr);
// Reserve a certain amount so no one can use it, returns true on succces, false on failure
virtual bool Reserve(u32 size);