kernel/eka/memmodel/epoc/flexible/mmu/mmanager.cpp
changeset 102 ef2a444a7410
parent 90 947f0dc9f7a8
child 152 657f875b013e
equal deleted inserted replaced
90:947f0dc9f7a8 102:ef2a444a7410
    64 	{
    64 	{
    65 	return KErrNotSupported;
    65 	return KErrNotSupported;
    66 	}
    66 	}
    67 
    67 
    68 
    68 
    69 TInt DMemoryManager::AddPages(DMemoryObject* /*aMemory*/, TUint /*aIndex*/, TUint /*aCount*/, TPhysAddr* /*aPages*/)
    69 TInt DMemoryManager::AddPages(DMemoryObject* /*aMemory*/, TUint /*aIndex*/, TUint /*aCount*/, const TPhysAddr* /*aPages*/)
    70 	{
    70 	{
    71 	return KErrNotSupported;
    71 	return KErrNotSupported;
    72 	}
    72 	}
    73 
    73 
    74 
    74 
  1159 class DHardwareMemoryManager : public DMemoryManager
  1159 class DHardwareMemoryManager : public DMemoryManager
  1160 	{
  1160 	{
  1161 public:
  1161 public:
  1162 	// from DMemoryManager...
  1162 	// from DMemoryManager...
  1163 	virtual void Destruct(DMemoryObject* aMemory);
  1163 	virtual void Destruct(DMemoryObject* aMemory);
  1164 	virtual TInt AddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
  1164 	virtual TInt AddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, const TPhysAddr* aPages);
  1165 	virtual TInt AddContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr aPhysAddr);
  1165 	virtual TInt AddContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr aPhysAddr);
  1166 	virtual TInt RemovePages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
  1166 	virtual TInt RemovePages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
  1167 	virtual TInt Pin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
  1167 	virtual TInt Pin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
  1168 	virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
  1168 	virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
  1169 
  1169 
  1224 	MemoryObjectLock::Unlock(aMemory);
  1224 	MemoryObjectLock::Unlock(aMemory);
  1225 	aMemory->Close();
  1225 	aMemory->Close();
  1226 	}
  1226 	}
  1227 
  1227 
  1228 
  1228 
  1229 TInt DHardwareMemoryManager::AddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages)
  1229 TInt DHardwareMemoryManager::AddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, const TPhysAddr* aPages)
  1230 	{
  1230 	{
  1231 	TRACE2(("DHardwareMemoryManager::AddPages(0x%08x,0x%x,0x%x,?)",aMemory, aIndex, aCount));
  1231 	TRACE2(("DHardwareMemoryManager::AddPages(0x%08x,0x%x,0x%x,?)",aMemory, aIndex, aCount));
  1232 	__NK_ASSERT_DEBUG(MemoryObjectLock::IsHeld(aMemory));
  1232 	__NK_ASSERT_DEBUG(MemoryObjectLock::IsHeld(aMemory));
  1233 
  1233 
  1234 	// validate arguments...
  1234 	// validate arguments...
  1235 	TPhysAddr* pages = aPages;
  1235 	const TPhysAddr* pages = aPages;
  1236 	TPhysAddr* pagesEnd = aPages+aCount;
  1236 	const TPhysAddr* pagesEnd = aPages+aCount;
  1237 	TPhysAddr checkMask = 0;
  1237 	TPhysAddr checkMask = 0;
  1238 	do checkMask |= *pages++;
  1238 	do checkMask |= *pages++;
  1239 	while(pages<pagesEnd);
  1239 	while(pages<pagesEnd);
  1240 	if(checkMask&KPageMask)
  1240 	if(checkMask&KPageMask)
  1241 		return KErrArgument;
  1241 		return KErrArgument;