kernel/eka/memmodel/epoc/flexible/mmu/mrom.cpp
changeset 123 fc55edbf3919
parent 90 947f0dc9f7a8
child 176 af6ec97d9189
equal deleted inserted replaced
122:70ba09fd07a5 123:fc55edbf3919
   500 		TRACEB(("ROM is not paged"));
   500 		TRACEB(("ROM is not paged"));
   501 		return KErrNone;
   501 		return KErrNone;
   502 		}
   502 		}
   503 
   503 
   504 	TAny* null = 0;
   504 	TAny* null = 0;
       
   505 	if(aDevice->iType & DPagingDevice::EMediaExtension)
       
   506 		__e32_atomic_store_ord_ptr(&iDevice, null);
   505 	if(!__e32_atomic_cas_ord_ptr(&iDevice, &null, aDevice)) // set iDevice=aDevice if it was originally 0
   507 	if(!__e32_atomic_cas_ord_ptr(&iDevice, &null, aDevice)) // set iDevice=aDevice if it was originally 0
   506 		{
   508 		{
   507 		// ROM paging device already registered...
   509 		// ROM paging device already registered...
   508 		TRACEB(("DRomMemoryManager::InstallPagingDevice returns ALREADY EXISTS!"));
   510 		TRACEB(("DRomMemoryManager::InstallPagingDevice returns ALREADY EXISTS!"));
   509 		return KErrAlreadyExists;
   511 		return KErrAlreadyExists;
   967 		m.UnmapTemp(0);
   969 		m.UnmapTemp(0);
   968 		m.UnmapTemp(1);
   970 		m.UnmapTemp(1);
   969 		MmuLock::Lock();
   971 		MmuLock::Lock();
   970 		SPageInfo::FromPhysAddr(iNewPage)->SetShadow(aIndex,aMemory->PageInfoFlags());
   972 		SPageInfo::FromPhysAddr(iNewPage)->SetShadow(aIndex,aMemory->PageInfoFlags());
   971 		MmuLock::Unlock();
   973 		MmuLock::Unlock();
       
   974 
       
   975 #ifdef BTRACE_KERNEL_MEMORY
       
   976 		BTrace4(BTrace::EKernelMemory, BTrace::EKernelMemoryMiscAlloc, KPageSize);
       
   977 		++Epoc::KernelMiscPages;
       
   978 #endif
   972 		}
   979 		}
   973 
   980 
   974 	RamAllocLock::Unlock();
   981 	RamAllocLock::Unlock();
   975 
   982 
   976 	if(r!=KErrNone)
   983 	if(r!=KErrNone)
   990 	TRACE2(("DShadowPage[%x]::Destroy()",this));
   997 	TRACE2(("DShadowPage[%x]::Destroy()",this));
   991 	if(iNewPage!=KPhysAddrInvalid)
   998 	if(iNewPage!=KPhysAddrInvalid)
   992 		{
   999 		{
   993 		RamAllocLock::Lock();
  1000 		RamAllocLock::Lock();
   994 		TheMmu.FreeRam(&iNewPage, 1, EPageFixed);
  1001 		TheMmu.FreeRam(&iNewPage, 1, EPageFixed);
       
  1002 
       
  1003 #ifdef BTRACE_KERNEL_MEMORY
       
  1004 		BTrace4(BTrace::EKernelMemory, BTrace::EKernelMemoryMiscFree, KPageSize);
       
  1005 		--Epoc::KernelMiscPages;
       
  1006 #endif
   995 		RamAllocLock::Unlock();
  1007 		RamAllocLock::Unlock();
   996 		}
  1008 		}
   997 	if(IsAttached())
  1009 	if(IsAttached())
   998 		Unpin();
  1010 		Unpin();
   999 	Close();
  1011 	Close();