kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.cpp
branchRCL_3
changeset 22 2f92ad2dc5db
parent 6 0173bcd7697c
child 26 c734af59ce98
equal deleted inserted replaced
21:e7d2d738d3c2 22:2f92ad2dc5db
   175 		__NK_ASSERT_DEBUG(r!=KErrNoMemory);
   175 		__NK_ASSERT_DEBUG(r!=KErrNoMemory);
   176 		}
   176 		}
   177 	else
   177 	else
   178 		{// Allocate fixed paged as page tables aren't movable.
   178 		{// Allocate fixed paged as page tables aren't movable.
   179 		r = TheMmu.AllocRam(&pagePhys, 1, aMemory->RamAllocFlags(), EPageFixed);
   179 		r = TheMmu.AllocRam(&pagePhys, 1, aMemory->RamAllocFlags(), EPageFixed);
       
   180 
       
   181 #ifdef BTRACE_KERNEL_MEMORY
       
   182 		if (r == KErrNone)
       
   183 			{
       
   184 			BTrace4(BTrace::EKernelMemory, BTrace::EKernelMemoryMiscAlloc, KPageSize);
       
   185 			++Epoc::KernelMiscPages;
       
   186 			}
       
   187 #endif
   180 		}
   188 		}
   181 	RamAllocLock::Unlock();
   189 	RamAllocLock::Unlock();
   182 
   190 
   183 	TUint usedNew = 0;
   191 	TUint usedNew = 0;
   184 	if(r==KErrNone)
   192 	if(r==KErrNone)
   239 		{
   247 		{
   240 		// free the removed page...
   248 		// free the removed page...
   241 		if(aDemandPaged)
   249 		if(aDemandPaged)
   242 			ThePager.PageInFreePages(&pagePhys,1);
   250 			ThePager.PageInFreePages(&pagePhys,1);
   243 		else
   251 		else
       
   252 			{
   244 			TheMmu.FreeRam(&pagePhys, 1, EPageFixed);
   253 			TheMmu.FreeRam(&pagePhys, 1, EPageFixed);
       
   254 
       
   255 #ifdef BTRACE_KERNEL_MEMORY
       
   256 			BTrace4(BTrace::EKernelMemory, BTrace::EKernelMemoryMiscFree, KPageSize);
       
   257 			--Epoc::KernelMiscPages;
       
   258 #endif
       
   259 			}
   245 		r = 1;
   260 		r = 1;
   246 		}
   261 		}
   247 
   262 
   248 	RamAllocLock::Unlock();
   263 	RamAllocLock::Unlock();
   249 
   264 
   360 
   375 
   361 void PageTableAllocator::TSubAllocator::Init2(PageTableAllocator* aAllocator, TUint aReserveCount, TBool aDemandPaged)
   376 void PageTableAllocator::TSubAllocator::Init2(PageTableAllocator* aAllocator, TUint aReserveCount, TBool aDemandPaged)
   362 	{
   377 	{
   363 	iReserveCount = aReserveCount;
   378 	iReserveCount = aReserveCount;
   364 	iDemandPaged = aDemandPaged;
   379 	iDemandPaged = aDemandPaged;
   365 	while(iFreeCount<aReserveCount)
   380 	while(iFreeCount < aReserveCount)
   366 		if(!aAllocator->AllocReserve(*this))
   381 		__NK_ASSERT_ALWAYS(aAllocator->AllocReserve(*this));
   367 			{
       
   368 			__NK_ASSERT_ALWAYS(0);
       
   369 			}
       
   370 	}
   382 	}
   371 
   383 
   372 
   384 
   373 void PageTableAllocator::TPtPageAllocator::Init2(TUint aNumInitPages)
   385 void PageTableAllocator::TPtPageAllocator::Init2(TUint aNumInitPages)
   374 	{
   386 	{