|
1 // Copyright (c) 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: mdefrag.inl |
|
14 // In line utility functions used by the defragbase.cpp and ramalloc.cpp |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #include "mm.h" |
|
22 #include "mmu.h" |
|
23 #include "mpager.h" |
|
24 |
|
25 |
|
26 inline TInt M::PageShift() |
|
27 { |
|
28 return KPageShift; |
|
29 } |
|
30 |
|
31 |
|
32 inline void M::RamAllocLock() |
|
33 { |
|
34 RamAllocLock::Lock(); |
|
35 } |
|
36 |
|
37 |
|
38 inline void M::RamAllocUnlock() |
|
39 { |
|
40 RamAllocLock::Unlock(); |
|
41 } |
|
42 |
|
43 |
|
44 inline void M::RamAllocIsLocked() |
|
45 { |
|
46 #ifdef _DEBUG |
|
47 if (!K::Initialising) |
|
48 __NK_ASSERT_DEBUG(RamAllocLock::IsHeld()); |
|
49 #endif |
|
50 } |
|
51 |
|
52 |
|
53 inline TInt M::DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TBool aBlockRest) |
|
54 { |
|
55 TPhysAddr newAddr; |
|
56 return MovePage(aAddr, newAddr, aBlockZoneId, aBlockRest); |
|
57 } |
|
58 |
|
59 |
|
60 inline TUint M::NumberOfFreeDpPages() |
|
61 { |
|
62 return ThePager.NumberOfFreePages(); |
|
63 } |
|
64 |
|
65 |
|
66 inline TUint M::NumberOfDirtyDpPages() |
|
67 { |
|
68 return ThePager.NumberOfDirtyPages(); |
|
69 } |
|
70 |
|
71 |
|
72 inline void M::RamZoneClaimed(SZone* aZone) |
|
73 { |
|
74 TheMmu.AllocatedPhysicalRam(aZone->iPhysBase, |
|
75 aZone->iPhysPages, |
|
76 (Mmu::TRamAllocFlags)EMemAttStronglyOrdered); |
|
77 } |