kernel/eka/include/memmodel/epoc/mmubase/mmubase.inl
changeset 0 a41df078684a
child 117 5b5d147c7838
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\memmodel\epoc\mmubase\mmubase.inl
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __MMUBASE_INL__
       
    19 #define __MMUBASE_INL__
       
    20 
       
    21 #include <mmboot.h>
       
    22 
       
    23 const TInt KPageInfosPerPageShift = KPageShift-KPageInfoShift;
       
    24 const TInt KPageInfosPerPage = 1<<KPageInfosPerPageShift;
       
    25 const TInt KNumPageInfoPagesShift = 32-KPageShift-KPageInfosPerPageShift;
       
    26 const TInt KNumPageInfoPages = 1<<KNumPageInfoPagesShift;
       
    27 
       
    28 inline SPageInfo* SPageInfo::FromPhysAddr(TPhysAddr aAddress)
       
    29 	{
       
    30 	return ((SPageInfo*)KPageInfoLinearBase)+(aAddress>>KPageShift);
       
    31 	}
       
    32 
       
    33 inline TPhysAddr SPageInfo::PhysAddr()
       
    34 	{
       
    35 	return ((TPhysAddr)this)<<KPageInfosPerPageShift;
       
    36 	}
       
    37 
       
    38 
       
    39 //
       
    40 // M class implementations of ram allocator and defrag methods
       
    41 // Make these inline as they are just memory model independent interface
       
    42 // for the ram allocator and defrag classes.
       
    43 //
       
    44 
       
    45 inline TInt M::PageShift()
       
    46 	{
       
    47 	return KPageShift;
       
    48 	}
       
    49 
       
    50 
       
    51 inline void M::RamAllocLock()
       
    52 	{
       
    53 	MmuBase::Wait();
       
    54 	}
       
    55 
       
    56 
       
    57 inline void M::RamAllocUnlock()
       
    58 	{
       
    59 	MmuBase::Signal();
       
    60 	}
       
    61 
       
    62 
       
    63 inline void M::RamAllocIsLocked()
       
    64 	{
       
    65 #ifdef _DEBUG
       
    66 	if (!K::Initialising) 
       
    67 		__ASSERT_MUTEX(MmuBase::RamAllocatorMutex);
       
    68 #endif
       
    69 	}
       
    70 
       
    71 
       
    72 inline TUint M::NumberOfFreeDpPages()
       
    73 	{
       
    74 	return Mmu::Get().NumberOfFreeDpPages();
       
    75 	}
       
    76 
       
    77 
       
    78 inline TUint M::NumberOfDirtyDpPages()
       
    79 	{// This memory model doesn't support data paging so can't get dirty paged pages.
       
    80 	return 0;
       
    81 	}
       
    82 
       
    83 
       
    84 inline TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest)
       
    85 	{
       
    86 	return Mmu::Get().MovePage(aOld, aNew, aBlockZoneId, aBlockRest);
       
    87 	}
       
    88 
       
    89 
       
    90 inline TInt M::DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TBool aBlockRest)
       
    91 	{
       
    92 	return Mmu::Get().DiscardPage(aAddr, aBlockZoneId, aBlockRest);
       
    93 	}
       
    94 #endif
       
    95 
       
    96