author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:50:07 +0300 | |
changeset 201 | 43365a9b78a3 |
parent 152 | 657f875b013e |
child 259 | 57b9594f5772 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2005-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 |
// |
|
15 |
||
16 |
/** |
|
17 |
@file |
|
18 |
@internalComponent |
|
19 |
*/ |
|
20 |
||
21 |
#ifndef MPAGER_H |
|
22 |
#define MPAGER_H |
|
23 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
24 |
#include "mmu.h" |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#include <kern_priv.h> |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
Maximum number of pages to attempt to clean in one go. |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
29 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
30 |
If a paging device sets a preferred write size greater than this then it will fail to install with |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
31 |
KErrArgument. |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
32 |
*/ |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
33 |
const TUint KMaxPagesToClean = 16; |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
|
0 | 35 |
struct SVMCacheInfo; |
36 |
class DMemModelThread; |
|
37 |
class DMemoryMappingBase; |
|
38 |
||
39 |
class DPager |
|
40 |
{ |
|
41 |
public: |
|
42 |
DPager(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
void InitCache(); |
0 | 44 |
void Init3(); |
45 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
FORCE_INLINE TBool CacheInitialised() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
47 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
return iYoungOldRatio && iMinimumPageLimit; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
49 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
50 |
|
0 | 51 |
FORCE_INLINE TUint NumberOfFreePages() |
52 |
{ |
|
53 |
return iNumberOfFreePages; |
|
54 |
} |
|
55 |
||
56 |
FORCE_INLINE TUint NumberOfDirtyPages() |
|
57 |
{ |
|
58 |
TUint ret; |
|
59 |
MmuLock::Lock(); |
|
60 |
ret = iNumberOfDirtyPages; |
|
61 |
MmuLock::Unlock(); |
|
62 |
return ret; |
|
63 |
} |
|
102
ef2a444a7410
Revision: 201018
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
64 |
|
ef2a444a7410
Revision: 201018
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
65 |
FORCE_INLINE TUint MinimumPageCount() |
ef2a444a7410
Revision: 201018
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
66 |
{ |
ef2a444a7410
Revision: 201018
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
67 |
return iMinimumPageCount; |
ef2a444a7410
Revision: 201018
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
68 |
} |
0 | 69 |
|
70 |
FORCE_INLINE void SetWritable(SPageInfo& aPageInfo) |
|
71 |
{ |
|
72 |
if (!aPageInfo.IsDirty()) |
|
73 |
{// This is the first mapping to write to the page so increase the |
|
74 |
// dirty page count. |
|
75 |
iNumberOfDirtyPages++; |
|
76 |
} |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
aPageInfo.SetWritable(); |
0 | 78 |
} |
79 |
||
80 |
FORCE_INLINE void SetClean(SPageInfo& aPageInfo) |
|
81 |
{ |
|
82 |
__NK_ASSERT_DEBUG(iNumberOfDirtyPages); |
|
83 |
__NK_ASSERT_DEBUG(aPageInfo.IsDirty()); |
|
84 |
aPageInfo.SetClean(); |
|
85 |
iNumberOfDirtyPages--; |
|
86 |
} |
|
87 |
||
88 |
/** |
|
89 |
Remove RAM pages from the cache and return them to the system's free pool. |
|
90 |
(Free them.) |
|
91 |
||
92 |
This is called by class Mmu when it requires more free RAM to meet an |
|
93 |
allocation request. |
|
94 |
||
95 |
@param aNumPages The number of pages to free up. |
|
96 |
@return True if all pages could be freed, false otherwise |
|
97 |
@pre RamAlloc mutex held. |
|
98 |
*/ |
|
99 |
TBool GetFreePages(TInt aNumPages); |
|
100 |
||
101 |
||
102 |
/** |
|
103 |
Attempts to rejuvenate or page in the page to the mapping that took the page fault. |
|
104 |
||
105 |
@param aPc Address of instruction causing the fault. |
|
106 |
@param aFaultAddress Address of memory access which faulted. |
|
107 |
@param aFaultAsid The asid of the faulting thread's process. |
|
108 |
@param aAccessPermissions Bitmask of values from enum TAccessPermissions, which |
|
109 |
indicates the permissions required by faulting memory access. |
|
110 |
@param aMapInstanceCount The instance count of the mapping when it took the page fault. |
|
111 |
@param aThread The thread that took the page fault. |
|
112 |
@param aExceptionInfo The processor specific exception info. |
|
113 |
||
114 |
@return KErrNone if the page is now accessable, otherwise one of the system wide error codes. |
|
115 |
*/ |
|
116 |
TInt HandlePageFault( TLinAddr aPc, TLinAddr aFaultAddress, TUint aFaultAsid, TUint aFaultIndex, |
|
117 |
TUint aAccessPermissions, DMemoryObject* aMemory, DMemoryMapping* aMapping, |
|
118 |
TUint aMapInstanceCount, DThread* aThread, TAny* aExceptionInfo); |
|
119 |
||
120 |
||
121 |
/** |
|
122 |
Fault enumeration |
|
123 |
*/ |
|
124 |
enum TFault |
|
125 |
{ |
|
126 |
}; |
|
127 |
||
128 |
/** |
|
129 |
Fault the system. |
|
130 |
*/ |
|
131 |
static void Fault(TFault aFault); |
|
132 |
||
133 |
/** |
|
134 |
Get state of live page list. |
|
135 |
*/ |
|
136 |
void GetLiveListInfo(SVMCacheInfo& aInfo); |
|
137 |
||
138 |
/** |
|
139 |
Resize the live page list. |
|
140 |
*/ |
|
141 |
TInt ResizeLiveList(TUint aMinimumPageCount, TUint aMaximumPageCount); |
|
142 |
||
143 |
/** |
|
144 |
Recalculate live list size. |
|
145 |
*/ |
|
146 |
TInt ResizeLiveList(); |
|
147 |
||
148 |
/** |
|
149 |
Flush (unmap) all memory which is demand paged. |
|
150 |
This reduces the live page list to a minimum. |
|
151 |
*/ |
|
152 |
void FlushAll(); |
|
153 |
||
154 |
/** |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
155 |
Flush demand paged pages in a specified region. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
156 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
157 |
The memory must reside in a single memory object. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
158 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
159 |
@param aProcess The process containing the pages to flush. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
160 |
@param aStart The start address of the region. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
161 |
@param aSize The size of the region in bytes. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
162 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
163 |
@return KErrBadDescriptor If the memory region is invalid or spans more than one memory object, |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
164 |
otherwise KErrNone. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
165 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
166 |
TInt FlushRegion(DMemModelProcess* aProcess, TLinAddr aStartAddress, TUint aSize); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
167 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
102
diff
changeset
|
168 |
/** |
0 | 169 |
Give pages to paging system for managing. |
170 |
*/ |
|
171 |
void DonatePages(TUint aCount, TPhysAddr* aPages); |
|
172 |
||
173 |
/** |
|
174 |
Reclaim pages from paging system which were previously donated with DonatePages. |
|
175 |
||
176 |
@param aCount Number of pages. |
|
177 |
@param aPages Array of pages (as stored in an RPageArray). |
|
178 |
||
179 |
@return KErrNone if successful. |
|
180 |
KErrNoMemory if paging system doesn't have enough spare pages. This will leave some or all of the pages still managed by the pager. |
|
181 |
KErrNotFound if some of the pages were not actually being managed by the pager. |
|
182 |
*/ |
|
183 |
TInt ReclaimPages(TUint aCount, TPhysAddr* aPages); |
|
184 |
||
185 |
/** |
|
186 |
Called by class Mmu whenever a page of RAM is freed. The page state will be EUnused. |
|
187 |
If the page was being used by the pager then this gives it the opportunity to update |
|
188 |
any internal state. If the pager wishes to retain ownership of the page the it must |
|
189 |
return the result KErrNone, any other value will cause the page to be returned to the |
|
190 |
systems free pool. |
|
191 |
*/ |
|
192 |
TInt PageFreed(SPageInfo* aPageInfo); |
|
193 |
||
194 |
// |
|
195 |
// following public members for use by memory managers... |
|
196 |
// |
|
197 |
||
198 |
/** |
|
199 |
Allocate a number of RAM pages to store demand paged content. |
|
200 |
These pages are obtained from... |
|
201 |
||
202 |
1. An unused page in the live page list. |
|
203 |
2. The systems free pool. |
|
204 |
3. The oldest page from the live page list. |
|
205 |
*/ |
|
206 |
TInt PageInAllocPages(TPhysAddr* aPages, TUint aCount, Mmu::TRamAllocFlags aAllocFlags); |
|
207 |
||
208 |
/** |
|
209 |
Free a number of RAM pages allocated by PageInAllocPages. |
|
210 |
*/ |
|
211 |
void PageInFreePages(TPhysAddr* aPages, TUint aCount); |
|
212 |
||
213 |
/** |
|
214 |
Called to add a new page to the live list after a fault has occurred. |
|
215 |
||
216 |
@param aPageInfo The page. |
|
217 |
||
218 |
@pre MmuLock held |
|
219 |
@post MmuLock held (but may have been released by this function) |
|
220 |
*/ |
|
221 |
void PagedIn(SPageInfo* aPageInfo); |
|
222 |
||
223 |
/** |
|
224 |
@param aPageInfo The page. |
|
225 |
@param aPinArgs Owner of a replacement page which will be used to substitute for the pinned page. |
|
226 |
||
227 |
@pre MmuLock held |
|
228 |
@post MmuLock held (but may have been released by this function) |
|
229 |
*/ |
|
230 |
void PagedInPinned(SPageInfo* aPageInfo, TPinArgs& aPinArgs); |
|
231 |
||
232 |
/** |
|
233 |
@pre MmuLock held |
|
234 |
@post MmuLock left unchanged. |
|
235 |
*/ |
|
236 |
void PagedInUnneeded(SPageInfo* aPageInfo); |
|
237 |
||
238 |
/** |
|
239 |
@param aPageInfo The page to unpin. |
|
240 |
@param aPinArgs The resources used for pinning. The replacement pages allocated |
|
241 |
to this will be increased for each page which was became completely |
|
242 |
unpinned. |
|
243 |
||
244 |
@pre MmuLock held |
|
245 |
@post MmuLock held (but may have been released by this function) |
|
246 |
*/ |
|
247 |
void Unpin(SPageInfo* aPageInfo, TPinArgs& aPinArgs); |
|
248 |
||
249 |
/** |
|
250 |
@param aPageInfo The page to pin. Must be page being demand paged. |
|
251 |
@param aPinArgs Owner of a replacement page which will be used to substitute for the pinned page. |
|
252 |
||
253 |
@pre MmuLock held |
|
254 |
@post MmuLock held (but may have been released by this function) |
|
255 |
*/ |
|
256 |
void Pin(SPageInfo* aPageInfo, TPinArgs& aPinArgs); |
|
257 |
||
258 |
||
259 |
/** |
|
260 |
@pre MmuLock held |
|
261 |
@post MmuLock held (but may have been released by this function) |
|
262 |
*/ |
|
263 |
void RejuvenatePageTable(TPte* aPt); |
|
264 |
||
265 |
/** |
|
266 |
*/ |
|
267 |
TBool ReservePages(TUint aRequiredCount, TUint& aCount); |
|
268 |
||
269 |
/** |
|
270 |
*/ |
|
271 |
void UnreservePages(TUint& aCount); |
|
272 |
||
273 |
/** |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
274 |
Indicates whether there are any dirty pages available to be cleaned by #CleanSomePages. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
275 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
276 |
This is called by the page cleaner to work out whether it has any work to do. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
277 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
278 |
@return Whether there are any dirty pages in the oldest section of the live list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
279 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
280 |
TBool HasPagesToClean(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
281 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
282 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
283 |
Attempt to clean one or more dirty pages in one go. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
284 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
285 |
Called by the page cleaner to clean pages and by PageInAllocPage when needs to steal a page from |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
286 |
the live list, but the oldest clean list is empty. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
287 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
288 |
May or may not succeed in acually cleaning any pages. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
289 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
290 |
@param aBackground Whether the activity should be ignored when determining whether the paging |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
291 |
device is busy. This is used by the page cleaner. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
292 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
293 |
@return The number of pages this method attempted to clean. If it returns zero, there were no |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
294 |
pages eligible to be cleaned. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
295 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
296 |
TInt CleanSomePages(TBool aBackground); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
297 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
298 |
/** |
0 | 299 |
Enumeration of instrumented paging events which only require the |
300 |
SPageInfo object as an argument. |
|
301 |
*/ |
|
302 |
enum TEventSimple |
|
303 |
{ |
|
304 |
EEventPageInNew, |
|
305 |
EEventPageInAgain, |
|
306 |
EEventPageInUnneeded, |
|
307 |
EEventPageInFree, |
|
308 |
EEventPageOut, |
|
309 |
EEventPageAged, |
|
310 |
EEventPagePin, |
|
311 |
EEventPageUnpin, |
|
312 |
EEventPageDonate, |
|
313 |
EEventPageReclaim, |
|
314 |
EEventPageAgedClean, |
|
315 |
EEventPageAgedDirty, |
|
316 |
EEventPagePageTableAlloc |
|
317 |
}; |
|
318 |
||
319 |
/** |
|
320 |
Signal the occurrence of an event of type TEventSimple. |
|
321 |
*/ |
|
322 |
void Event(TEventSimple aEvent, SPageInfo* aPageInfo); |
|
323 |
||
324 |
/** |
|
325 |
Enumeration of instrumented paging events which require the faulting address |
|
326 |
and program counter as arguments. |
|
327 |
*/ |
|
328 |
enum TEventWithAddresses |
|
329 |
{ |
|
330 |
EEventPageInStart, |
|
331 |
EEventPageRejuvenate |
|
332 |
}; |
|
333 |
||
334 |
/** |
|
335 |
Signal the occurrence of an event of type TEventWithAddresses. |
|
336 |
*/ |
|
337 |
void Event(TEventWithAddresses aEvent, SPageInfo* aPageInfo, TLinAddr aPc, TLinAddr aFaultAddress, TUint aAccessPermissions); |
|
338 |
||
339 |
/** |
|
340 |
Get the pager's event info data. |
|
341 |
*/ |
|
342 |
void GetEventInfo(SVMEventInfo& aInfoOut); |
|
343 |
||
344 |
/** |
|
345 |
Reset the pager's event info data. |
|
346 |
*/ |
|
347 |
void ResetEventInfo(); |
|
348 |
||
349 |
/** |
|
350 |
Attempt to discard the specified page. |
|
351 |
||
352 |
@param aOldPageInfo The page info of the page to discard. |
|
353 |
@param aBlockZoneId The ID of the RAM zone not to allocate any required new page into. |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
354 |
@param aMoveDisFlags Flags that control the discarding of the page, should be a mask of |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
355 |
values from M::TMoveDiscardFlags |
0 | 356 |
*/ |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
357 |
TInt DiscardPage(SPageInfo* aOldPageInfo, TUint aBlockZoneId, TUint aMoveDisFlags); |
0 | 358 |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
359 |
/** |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
360 |
Attempt to discard the specified page and then allocate a page of type aPageType |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
361 |
in its place. |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
362 |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
363 |
Note - This will always attempt to move dirty pages rather than write them to swap. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
364 |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
365 |
@param aPageInfo The page info of the page to discard. |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
366 |
@param aPageType The new page type to allocate into aPageInfo's physical address. |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
367 |
*/ |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
368 |
TInt DiscardAndAllocPage(SPageInfo* aPageInfo, TZonePageType aPageType); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
369 |
|
0 | 370 |
|
371 |
/** |
|
372 |
Update any live list links to replace the old page with the new page. |
|
373 |
This is to be used when a page has been moved. |
|
374 |
||
375 |
@param aOldPageInfo The page info of the page to replace. |
|
376 |
@param aNewPageInfo The page info of the page to be used instead of the old page. |
|
377 |
*/ |
|
378 |
void ReplacePage(SPageInfo& aOldPageInfo, SPageInfo& aNewPageInfo); |
|
379 |
||
380 |
||
381 |
// |
|
382 |
// following public members for use by TPinArgs... |
|
383 |
// |
|
384 |
||
385 |
/** |
|
386 |
*/ |
|
387 |
TBool AllocPinReplacementPages(TUint aNumPages); |
|
388 |
||
389 |
/** |
|
390 |
*/ |
|
391 |
void FreePinReplacementPages(TUint aNumPages); |
|
392 |
||
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
393 |
// |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
394 |
// following public members for use by DDataPagedMemoryManager... |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
395 |
// |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
396 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
397 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
398 |
Called by the data paged memory manager to set the number of pages the pager should attempt to |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
399 |
clean at once. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
400 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
401 |
This also adjusts the maximum size of the oldest list if it is too small to contain the |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
402 |
specified number of pages. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
403 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
404 |
@param aPagesToClean Number of pages the pager should attempt to clean in one go |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
405 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
406 |
void SetPagesToClean(TUint aPagesToClean); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
407 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
408 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
409 |
Get the number of pages the pager attempts to clean at once. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
410 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
411 |
TUint PagesToClean(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
412 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
413 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
414 |
Called by the data paged memory manager to set whether pages cleaned must have sequential page |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
415 |
colour. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
416 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
417 |
@param aCleanInSequence Whether pages must have sequential page colour |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
418 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
419 |
void SetCleanInSequence(TBool aCleanInSequence); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
420 |
|
0 | 421 |
private: |
422 |
/** |
|
423 |
Add a page to the head of the live page list. I.e. make it the 'youngest' page. |
|
424 |
||
425 |
@pre MmuLock held |
|
426 |
@post MmuLock left unchanged. |
|
427 |
*/ |
|
428 |
void AddAsYoungestPage(SPageInfo* aPageInfo); |
|
429 |
||
430 |
/** |
|
431 |
Mark a page as type EUnused and add it to the end of the live page list. |
|
432 |
I.e. make it the 'oldest' page, so that it is the first page to be reused. |
|
433 |
||
434 |
@pre MmuLock held |
|
435 |
@post MmuLock left unchanged. |
|
436 |
*/ |
|
437 |
void AddAsFreePage(SPageInfo* aPageInfo); |
|
438 |
||
439 |
/** |
|
440 |
Remove a page from live page list. |
|
441 |
It paged state is set to EUnpaged. |
|
442 |
||
443 |
@pre MmuLock held |
|
444 |
@post MmuLock left unchanged. |
|
445 |
*/ |
|
446 |
void RemovePage(SPageInfo* aPageInfo); |
|
447 |
||
448 |
/** |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
449 |
Get a page, either by stealing one from the live list or allocating one from the system. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
450 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
451 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
452 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
453 |
If the oldest page is an oldest dirty page, this may attempt to clean multiple pages by calling |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
454 |
#CleanSomePages. |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
456 |
If the oldest page is on any other list (i.e. is an old or young page) this will steal it, |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
457 |
aquiring the page cleaning mutex first if it is dirty. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
458 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
459 |
Called from #PageInAllocPage, #TryReturnOldestPageToSystem, #AllowAddFreePage and |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
460 |
#AllowAddFreePages. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
461 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
462 |
@param aAllowAlloc Indicates whether the method should try to allocate a page from the system |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
464 |
@return KErrNone on success, KErrInUse if stealing failed or 1 to indicate the the oldest page |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
was dirty and the PageCleaning mutex was not held. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
@pre MmuLock held |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
@post MmuLock left unchanged. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
*/ |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
470 |
SPageInfo* StealOrAllocPage(TBool aAllowAlloc, Mmu::TRamAllocFlags aAllocFlags); |
0 | 471 |
|
472 |
/** |
|
473 |
Steal a page from the memory object (if any) which is using the page. |
|
474 |
If successful the returned page will be in the EUnknown state and the |
|
475 |
cache state for the page is indeterminate. This is the same state as |
|
476 |
if the page had been allocated by Mmu::AllocRam. |
|
477 |
||
478 |
@pre RamAlloc mutex held |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
@pre If the page is dirty the PageCleaning lock must be held. |
0 | 480 |
@pre MmuLock held |
481 |
@post MmuLock held (but may have been released by this function) |
|
482 |
*/ |
|
483 |
TInt StealPage(SPageInfo* aPageInfo); |
|
484 |
||
485 |
/** |
|
486 |
Restrict the access permissions for a page. |
|
487 |
||
488 |
@param aPageInfo The page. |
|
489 |
@param aRestriction The restriction type to apply. |
|
490 |
*/ |
|
491 |
TInt RestrictPage(SPageInfo* aPageInfo, TRestrictPagesType aRestriction); |
|
492 |
||
493 |
/** |
|
494 |
Get a RAM page from the system's free pool and add it to the live list as a free page. |
|
495 |
||
496 |
@return False if out of memory; |
|
497 |
true otherwise, though new free page may still have already been used. |
|
498 |
||
499 |
@pre MmuLock held |
|
500 |
@post MmuLock held (but may have been released by this function) |
|
501 |
*/ |
|
502 |
TBool TryGrowLiveList(); |
|
503 |
||
504 |
/** |
|
505 |
Get a RAM page from the system's free pool. |
|
506 |
||
507 |
@pre RamAllocLock held. |
|
508 |
||
509 |
@return The page or NULL if no page is available. |
|
510 |
*/ |
|
511 |
SPageInfo* GetPageFromSystem(Mmu::TRamAllocFlags aAllocFlags, TUint aBlockZoneId=KRamZoneInvalidId, TBool aBlockRest=EFalse); |
|
512 |
||
513 |
/** |
|
514 |
Put a page back on the system's free pool. |
|
515 |
||
516 |
@pre RamAllocLock held. |
|
517 |
*/ |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
518 |
TBool TryReturnOldestPageToSystem(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
519 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
520 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
521 |
Ensure adding a page to the paging cache will be within the maximum size. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
522 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
523 |
@param aPageInfo On return this is set to the SPageInfo of a page that must be returned |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
524 |
to the system before a page can be added to the paging cache, or |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
525 |
NULL if no page must be returned to the system. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
526 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
527 |
void AllowAddFreePage(SPageInfo*& aPageInfo); |
0 | 528 |
|
529 |
/** |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
530 |
Ensure adding aNumPages pages to the paging cache will be within the maximum size. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
531 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
532 |
@param aPageInfo On return this is set to the SPageInfo of a page that must be returned |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
533 |
to the system before any more pages can be added to the paging cache, or |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
534 |
NULL if no page must be returned to the system. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
535 |
@param aNumPages The number of pages the caller wishes to add to the paging cache. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
536 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
537 |
@return If aPageInfo == NULL on return, this is the number of pages it is possible to |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
538 |
add to the paging cache or 1 if aPageInfo != NULL, i.e. a page will need |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
539 |
to be returned to the system. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
540 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
541 |
TUint AllowAddFreePages(SPageInfo*& aPageInfo, TUint aNumPages); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
542 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
543 |
/** |
0 | 544 |
Put a specific page back on the system's free pool. |
545 |
||
546 |
@pre RamAllocLock held. |
|
547 |
*/ |
|
548 |
void ReturnPageToSystem(SPageInfo& aPageInfo); |
|
549 |
||
550 |
/** |
|
551 |
Allocate a RAM page to store demand paged content. |
|
552 |
This tries to obtain a RAM from the following places: |
|
553 |
1. An unused page in the live page list. |
|
554 |
2. The systems free pool. |
|
555 |
3. The oldest page from the live page list. |
|
556 |
*/ |
|
557 |
SPageInfo* PageInAllocPage(Mmu::TRamAllocFlags aAllocFlags); |
|
558 |
||
559 |
/** |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
560 |
Called by CleanSomePages() to select the pages be cleaned. |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
562 |
This function finds a set of pages that can be mapped sequentially in memory when page colouring |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
563 |
restrictions are in effect. It is only called on systems with page colouring restrictions where |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
564 |
the paging media driver does not support writing by phyiscal address. |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
565 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
566 |
@pre MmuLock held |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
567 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
@param aPageInfosOut Pointer to an array of SPageInfo pointers, which must be at least |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
569 |
KMaxPagesToClean long. This will be filled in to indicate the pages to clean. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
@return The numnber of pages to clean. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
572 |
*/ |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
573 |
TInt SelectSequentialPagesToClean(SPageInfo** aPageInfosOut); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
574 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
575 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
576 |
Called by CleanSomePages() to select the pages be cleaned. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
577 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
578 |
This funciton selects the oldest dirty pages. It is called on systems without page colouring |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
579 |
restrictions or where the paging media driver supports writing by phyiscal address. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
580 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
581 |
@pre MmuLock held |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
582 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
583 |
@param aPageInfosOut Pointer to an array of SPageInfo pointers, which must be at least |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
584 |
KMaxPagesToClean long. This will be filled in to indicate the pages to clean. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
585 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
586 |
@return The numnber of pages to clean. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
587 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
588 |
TInt SelectOldestPagesToClean(SPageInfo** aPageInfosOut); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
589 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
/** |
0 | 591 |
If the number of young pages exceeds that specified by iYoungOldRatio then a |
592 |
single page is made 'old'. Call this after adding a new 'young' page. |
|
593 |
||
594 |
@pre MmuLock held |
|
595 |
@post MmuLock held (but may have been released by this function) |
|
596 |
*/ |
|
597 |
void BalanceAges(); |
|
598 |
||
599 |
/** |
|
600 |
If HaveTooManyPages() then return them to the system. |
|
601 |
*/ |
|
602 |
void RemoveExcessPages(); |
|
603 |
||
604 |
/** |
|
605 |
@return True if pager has too many pages, false otherwise. |
|
606 |
*/ |
|
607 |
TBool HaveTooManyPages(); |
|
608 |
||
609 |
/** |
|
610 |
@return True if pager has its maximum number of pages, false otherwise. |
|
611 |
*/ |
|
612 |
TBool HaveMaximumPages(); |
|
613 |
||
614 |
/** |
|
615 |
Attempt to rejuvenate a page in which a page fault occurred. |
|
616 |
||
617 |
@param aOsAsid Address space ID in which fault occurred. |
|
618 |
@param aAddress Address of memory access which faulted. |
|
619 |
@param aAccessPermissions Bitmask of values from enum TAccessPermissions, which |
|
620 |
indicates the permissions required by faulting memory access. |
|
621 |
@param aPc Address of instruction causing the fault. (Used for tracing.) |
|
622 |
@param aMapping The mapping that maps the page that took the fault. |
|
623 |
@param aMapInstanceCount The instance count of the mappig when the page fault occurred. |
|
624 |
@param aThread The thread that took the page fault. |
|
625 |
@param aExceptionInfo The processor specific exception info. |
|
626 |
||
627 |
@return KErrNone if the page was remapped, KErrAbort if the mapping has be reused or detached, |
|
628 |
KErrNotFound if it may be possible to page in the page. |
|
629 |
*/ |
|
630 |
TInt TryRejuvenate( TInt aOsAsid, TLinAddr aAddress, TUint aAccessPermissions, TLinAddr aPc, |
|
631 |
DMemoryMappingBase* aMapping, TUint aMapInstanceCount, DThread* aThread, |
|
632 |
TAny* aExceptionInfo); |
|
633 |
||
634 |
/** |
|
635 |
Reserve one page for guaranteed locking use. |
|
636 |
Increments iReservePageCount if successful. |
|
637 |
||
638 |
@return True if operation was successful. |
|
639 |
*/ |
|
640 |
TBool ReservePage(); |
|
641 |
||
642 |
/** |
|
643 |
Called when a realtime thread takes a paging fault. |
|
644 |
Checks whether it's OK for the thread to take to fault. |
|
645 |
@return KErrNone if the paging fault should be further processed |
|
646 |
*/ |
|
647 |
TInt CheckRealtimeThreadFault(DThread* aThread, TAny* aExceptionInfo); |
|
648 |
||
649 |
/** |
|
650 |
Attempt to find the page table entry and page info for a page in the specified mapping. |
|
651 |
||
652 |
@param aOsAsid The OsAsid of the process that owns the mapping. |
|
653 |
@param aAddress The linear address of the page. |
|
654 |
@param aMapping The mapping that maps the linear address. |
|
655 |
@param aMapInstanceCount The instance count of the mapping. |
|
656 |
@param[out] aPte Will return a pointer to the page table entry for the page. |
|
657 |
@param[out] aPageInfo Will return a pointer to the page info for the page. |
|
658 |
||
659 |
@return KErrNone on success, KErrAbort when the mapping is now invalid, KErrNotFound when |
|
660 |
the page table or page info can't be found. |
|
661 |
*/ |
|
662 |
TInt PteAndInfoFromLinAddr( TInt aOsAsid, TLinAddr aAddress, DMemoryMappingBase* aMapping, |
|
663 |
TUint aMapInstanceCount, TPte*& aPte, SPageInfo*& aPageInfo); |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
664 |
|
0 | 665 |
#ifdef _DEBUG |
666 |
/** |
|
667 |
Check consistency of live list. |
|
668 |
*/ |
|
669 |
TBool CheckLists(); |
|
670 |
||
671 |
void TraceCounts(); |
|
672 |
#endif |
|
673 |
||
674 |
private: |
|
675 |
TUint iMinYoungPages; ///< Minimum number of young pages in live list required for correct functioning. |
|
676 |
TUint iAbsoluteMinPageCount;///< Absolute minimum number of pages in live to meet algorithm constraints |
|
677 |
private: |
|
678 |
TUint iMinimumPageCount; /**< Minimum size for the live page list, including locked pages */ |
|
679 |
TUint iMaximumPageCount; /**< Maximum size for the live page list, including locked pages */ |
|
680 |
TUint16 iYoungOldRatio; /**< Ratio of young to old pages in the live page list */ |
|
681 |
SDblQue iYoungList; /**< Head of 'young' page list. */ |
|
682 |
TUint iYoungCount; /**< Number of young pages */ |
|
683 |
SDblQue iOldList; /**< Head of 'old' page list. */ |
|
684 |
TUint iOldCount; /**< Number of old pages */ |
|
685 |
SDblQue iOldestCleanList; /**< Head of 'oldestClean' page list. */ |
|
686 |
TUint iOldestCleanCount; /**< Number of 'oldestClean' pages */ |
|
687 |
SDblQue iOldestDirtyList; /**< Head of 'oldestDirty' page list. */ |
|
688 |
TUint iOldestDirtyCount; /**< Number of 'oldestDirty' pages */ |
|
689 |
TUint16 iOldOldestRatio; /**< Ratio of old pages to oldest to clean and dirty in the live page list*/ |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
690 |
TUint iMaxOldestPages; /**< Maximum number of oldest pages. */ |
0 | 691 |
TUint iNumberOfFreePages; |
692 |
TUint iNumberOfDirtyPages; /**< The total number of dirty pages in the paging cache. Protected by MmuLock */ |
|
693 |
TUint iInitMinimumPageCount;/**< Initial value for iMinimumPageCount */ |
|
694 |
TUint iInitMaximumPageCount;/**< Initial value for iMaximumPageCount */ |
|
695 |
TUint iReservePageCount; /**< Number of pages reserved for locking */ |
|
696 |
TUint iMinimumPageLimit; /**< Minimum size for iMinimumPageCount, not including locked pages. |
|
697 |
iMinimumPageCount >= iMinimumPageLimit + iReservePageCount */ |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
698 |
TUint iPagesToClean; /**< Preferred number of pages to attempt to clean in one go. */ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
699 |
TBool iCleanInSequence; /**< Pages to be cleaned must have sequential page colour. */ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
700 |
|
0 | 701 |
SVMEventInfo iEventInfo; |
702 |
||
703 |
#ifdef __DEMAND_PAGING_BENCHMARKS__ |
|
704 |
public: |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
void RecordBenchmarkData(TPagingBenchmark aBm, TUint32 aStartTime, TUint32 aEndTime, TUint aCount); |
0 | 706 |
void ResetBenchmarkData(TPagingBenchmark aBm); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
707 |
void ReadBenchmarkData(TPagingBenchmark aBm, SPagingBenchmarkInfo& aDataOut); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
708 |
TSpinLock iBenchmarkLock; |
0 | 709 |
SPagingBenchmarkInfo iBenchmarkInfo[EMaxPagingBm]; |
710 |
#endif //__DEMAND_PAGING_BENCHMARKS__ |
|
711 |
}; |
|
712 |
||
713 |
extern DPager ThePager; |
|
714 |
||
715 |
||
716 |
#ifdef __DEMAND_PAGING_BENCHMARKS__ |
|
717 |
||
718 |
#define START_PAGING_BENCHMARK TUint32 _bmStart = NKern::FastCounter() |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
719 |
#define END_PAGING_BENCHMARK(bm) ThePager.RecordBenchmarkData(bm, _bmStart, NKern::FastCounter(), 1) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
720 |
#define END_PAGING_BENCHMARK_N(bm, n) ThePager.RecordBenchmarkData(bm, _bmStart, NKern::FastCounter(), (n)) |
0 | 721 |
|
722 |
#else |
|
723 |
||
724 |
#define START_PAGING_BENCHMARK |
|
725 |
#define END_PAGING_BENCHMARK(bm) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
726 |
#define END_PAGING_BENCHMARK_N(bm, n) |
0 | 727 |
#endif // __DEMAND_PAGING_BENCHMARKS__ |
728 |
||
729 |
||
730 |
FORCE_INLINE void DPager::Event(TEventSimple aEvent, SPageInfo* aPageInfo) |
|
731 |
{ |
|
732 |
switch(aEvent) |
|
733 |
{ |
|
734 |
case EEventPageInNew: |
|
735 |
TRACEP(("DP: %O PageIn 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
736 |
#ifdef BTRACE_PAGING |
|
737 |
BTraceContext12(BTrace::EPaging,BTrace::EPagingPageIn,aPageInfo->PhysAddr(),aPageInfo->Owner(),aPageInfo->Index()); |
|
738 |
#endif |
|
739 |
++iEventInfo.iPageInReadCount; |
|
740 |
break; |
|
741 |
||
742 |
case EEventPageInAgain: |
|
743 |
TRACEP(("DP: %O PageIn (again) 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
744 |
#ifdef BTRACE_PAGING |
|
745 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingMapPage,aPageInfo->PhysAddr()); |
|
746 |
#endif |
|
747 |
break; |
|
748 |
||
749 |
case EEventPageInUnneeded: |
|
750 |
TRACEP(("DP: %O PageIn (unneeded) 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
751 |
#ifdef BTRACE_PAGING |
|
752 |
BTraceContext0(BTrace::EPaging,BTrace::EPagingPageInUnneeded); |
|
753 |
#endif |
|
754 |
break; |
|
755 |
||
756 |
case EEventPageInFree: |
|
757 |
TRACEP(("DP: %O PageInFree 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
758 |
#ifdef BTRACE_PAGING |
|
759 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingPageInFree,aPageInfo->PhysAddr()); |
|
760 |
#endif |
|
761 |
break; |
|
762 |
||
763 |
case EEventPageOut: |
|
764 |
TRACEP(("DP: %O PageOut 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
765 |
#ifdef BTRACE_PAGING |
|
766 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingPageOut,aPageInfo->PhysAddr()); |
|
767 |
#endif |
|
768 |
break; |
|
769 |
||
770 |
case EEventPageAged: |
|
771 |
TRACEP(("DP: %O Aged 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
772 |
#ifdef BTRACE_PAGING_VERBOSE |
|
773 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingAged,aPageInfo->PhysAddr()); |
|
774 |
#endif |
|
775 |
break; |
|
776 |
||
777 |
case EEventPagePin: |
|
778 |
TRACEP(("DP: %O Pin 0x%08x count=%d",TheCurrentThread,aPageInfo->PhysAddr(),aPageInfo->PinCount())); |
|
779 |
#ifdef BTRACE_PAGING |
|
780 |
BTraceContext8(BTrace::EPaging,BTrace::EPagingPageLock,aPageInfo->PhysAddr(),aPageInfo->PinCount()); |
|
781 |
#endif |
|
782 |
break; |
|
783 |
||
784 |
case EEventPageUnpin: |
|
785 |
TRACEP(("DP: %O Unpin 0x%08x count=%d",TheCurrentThread,aPageInfo->PhysAddr(),aPageInfo->PinCount())); |
|
786 |
#ifdef BTRACE_PAGING |
|
787 |
BTraceContext8(BTrace::EPaging,BTrace::EPagingPageUnlock,aPageInfo->PhysAddr(),aPageInfo->PinCount()); |
|
788 |
#endif |
|
789 |
break; |
|
790 |
||
791 |
case EEventPageDonate: |
|
792 |
TRACEP(("DP: %O Donate 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
793 |
#ifdef BTRACE_PAGING |
|
794 |
BTraceContext12(BTrace::EPaging,BTrace::EPagingDonatePage,aPageInfo->PhysAddr(),aPageInfo->Owner(),aPageInfo->Index()); |
|
795 |
#endif |
|
796 |
break; |
|
797 |
||
798 |
case EEventPageReclaim: |
|
799 |
TRACEP(("DP: %O Reclaim 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
800 |
#ifdef BTRACE_PAGING |
|
801 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingReclaimPage,aPageInfo->PhysAddr()); |
|
802 |
#endif |
|
803 |
break; |
|
804 |
||
805 |
case EEventPageAgedClean: |
|
806 |
TRACEP(("DP: %O AgedClean 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
807 |
#ifdef BTRACE_PAGING_VERBOSE |
|
808 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingAgedClean,aPageInfo->PhysAddr()); |
|
809 |
#endif |
|
810 |
break; |
|
811 |
||
812 |
case EEventPageAgedDirty: |
|
813 |
TRACEP(("DP: %O AgedDirty 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
814 |
#ifdef BTRACE_PAGING_VERBOSE |
|
815 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingAgedDirty,aPageInfo->PhysAddr()); |
|
816 |
#endif |
|
817 |
break; |
|
818 |
||
819 |
case EEventPagePageTableAlloc: |
|
820 |
TRACEP(("DP: %O PageTableAlloc 0x%08x",TheCurrentThread,aPageInfo->PhysAddr())); |
|
821 |
#ifdef BTRACE_PAGING |
|
822 |
BTraceContext4(BTrace::EPaging,BTrace::EPagingPageTableAlloc,aPageInfo->PhysAddr()); |
|
823 |
#endif |
|
824 |
break; |
|
825 |
||
826 |
default: |
|
827 |
__NK_ASSERT_DEBUG(0); |
|
828 |
break; |
|
829 |
} |
|
830 |
} |
|
831 |
||
832 |
||
833 |
||
834 |
FORCE_INLINE void DPager::Event(TEventWithAddresses aEvent, SPageInfo* aPageInfo, TLinAddr aPc, TLinAddr aFaultAddress, TUint aAccessPermissions) |
|
835 |
{ |
|
836 |
switch(aEvent) |
|
837 |
{ |
|
838 |
case EEventPageInStart: |
|
839 |
TRACEP(("DP: %O HandlePageFault 0x%08x 0x%08x %d",TheCurrentThread,aFaultAddress,aPc,aAccessPermissions)); |
|
840 |
#ifdef BTRACE_PAGING |
|
841 |
BTraceContext12(BTrace::EPaging,BTrace::EPagingPageInBegin,aFaultAddress,aPc,aAccessPermissions); |
|
842 |
#endif |
|
843 |
++iEventInfo.iPageFaultCount; |
|
844 |
break; |
|
845 |
||
846 |
case EEventPageRejuvenate: |
|
847 |
TRACEP(("DP: %O Rejuvenate 0x%08x 0x%08x 0x%08x %d",TheCurrentThread,aPageInfo->PhysAddr(),aFaultAddress,aPc,aAccessPermissions)); |
|
848 |
#ifdef BTRACE_PAGING |
|
849 |
BTraceContext12(BTrace::EPaging,BTrace::EPagingRejuvenate,aPageInfo->PhysAddr(),aFaultAddress,aPc); |
|
850 |
#endif |
|
851 |
++iEventInfo.iPageFaultCount; |
|
852 |
break; |
|
853 |
||
854 |
default: |
|
855 |
__NK_ASSERT_DEBUG(0); |
|
856 |
break; |
|
857 |
} |
|
858 |
} |
|
859 |
||
860 |
||
861 |
||
862 |
/** |
|
863 |
Multiplier for number of request objects in pool per drive that supports paging. |
|
864 |
*/ |
|
865 |
const TInt KPagingRequestsPerDevice = 2; |
|
866 |
||
867 |
||
868 |
class DPageReadRequest; |
|
869 |
class DPageWriteRequest; |
|
870 |
||
871 |
/** |
|
872 |
A pool of paging requests for use by a single paging device. |
|
873 |
*/ |
|
874 |
class DPagingRequestPool : public DBase |
|
875 |
{ |
|
876 |
public: |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
877 |
DPagingRequestPool(TUint aNumPageReadRequest, TBool aWriteRequest); |
0 | 878 |
DPageReadRequest* AcquirePageReadRequest(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
879 |
DPageWriteRequest* AcquirePageWriteRequest(DMemoryObject** aMemory, TUint* aIndex, TUint aCount); |
0 | 880 |
private: |
881 |
~DPagingRequestPool(); |
|
882 |
private: |
|
883 |
class TGroup |
|
884 |
{ |
|
885 |
public: |
|
886 |
TGroup(TUint aNumRequests); |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
887 |
DPageReadRequest* FindCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
888 |
DPageReadRequest* GetRequest(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
0 | 889 |
public: |
890 |
TUint iNumRequests; |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
891 |
DPageReadRequest** iRequests; |
0 | 892 |
SDblQue iFreeList; |
893 |
}; |
|
894 |
TGroup iPageReadRequests; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
895 |
DPageWriteRequest* iPageWriteRequest; |
0 | 896 |
|
897 |
friend class DPageReadRequest; |
|
898 |
}; |
|
899 |
||
900 |
||
901 |
/** |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
902 |
Common resources needed to service a paging request. |
0 | 903 |
*/ |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
904 |
class DPagingRequestBase : public DBase |
0 | 905 |
{ |
906 |
public: |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
907 |
TLinAddr MapPages(TUint aColour, TUint aCount, TPhysAddr* aPages); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
908 |
void UnmapPages(TBool aIMBRequired); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
909 |
public: // for DPagingRequestPool |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
910 |
DMutex* iMutex; /**< A mutex for synchronisation and priority inheritance. */ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
911 |
protected: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
912 |
Mmu::TTempMapping iTempMapping; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
913 |
}; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
914 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
915 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
916 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
917 |
Resources needed to service a page in request. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
918 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
919 |
class DPageReadRequest : public DPagingRequestBase |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
920 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
921 |
public: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
922 |
static TUint ReservedPagesRequired(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
923 |
private: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
924 |
static TInt iAllocNext; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
925 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
926 |
public: |
0 | 927 |
enum |
928 |
{ |
|
929 |
EMaxPages = 4 |
|
930 |
}; |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
931 |
DPageReadRequest(DPagingRequestPool::TGroup& aPoolGroup); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
932 |
TInt Construct(); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
933 |
void Release(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
934 |
void Wait(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
935 |
void Signal(); |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
936 |
void SetUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
937 |
void ResetUse(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
938 |
TBool CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
939 |
TBool IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
940 |
TLinAddr Buffer() { return iBuffer; } |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
941 |
TUint ThreadsWaiting() { return iUsageCount; } |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
942 |
private: |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
943 |
~DPageReadRequest() { } // can't delete |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
944 |
public: // for DPagingRequestPool |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
945 |
SDblQueLink iLink; /**< Link into list of free requests. */ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
946 |
private: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
947 |
TInt iUsageCount; /**< How many threads are using or waiting for this object. */ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
948 |
TLinAddr iBuffer; /**< A buffer of size EMaxPages+1 pages to read compressed data into. */ |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
949 |
DPagingRequestPool::TGroup& iPoolGroup; |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
950 |
DMemoryObject* iMemory; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
951 |
TUint iIndex; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
952 |
TUint iCount; |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
953 |
}; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
954 |
|
0 | 955 |
|
956 |
/** |
|
957 |
Resources needed to service a page out request. |
|
958 |
*/ |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
959 |
class DPageWriteRequest : public DPagingRequestBase |
0 | 960 |
{ |
961 |
public: |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
962 |
enum |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
963 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
964 |
EMaxPages = KMaxPagesToClean |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
965 |
}; |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
966 |
DPageWriteRequest(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
967 |
void Release(); |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
968 |
void SetUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
969 |
void ResetUse(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
970 |
TBool CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
971 |
TBool IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount); |
0 | 972 |
private: |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
973 |
~DPageWriteRequest() { } // can't delete |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
974 |
private: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
975 |
// used to identify the memory the request is used for... |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
976 |
TUint iUseRegionCount; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
977 |
DMemoryObject* iUseRegionMemory[EMaxPages]; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
152
diff
changeset
|
978 |
TUint iUseRegionIndex[EMaxPages]; |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
979 |
}; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
980 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
981 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
982 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
983 |
Class providing access to the mutex used to protect page cleaning operations; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
984 |
this is the mutex DPager::iPageCleaningLock. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
985 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
986 |
class PageCleaningLock |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
987 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
988 |
public: |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
989 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
990 |
Acquire the lock. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
991 |
The lock may be acquired multiple times by a thread, and will remain locked |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
992 |
until #Unlock has been used enough times to balance this. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
993 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
994 |
static void Lock(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
995 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
996 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
997 |
Release the lock. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
998 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
999 |
@pre The current thread has previously acquired the lock. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1000 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1001 |
static void Unlock(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1002 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1003 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1004 |
Return true if the current thread holds the lock. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1005 |
This is used for debug checks. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1006 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1007 |
static TBool IsHeld(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1008 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1009 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1010 |
Create the lock. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1011 |
Called by DPager::Init3(). |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1012 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1013 |
static void Init(); |
0 | 1014 |
}; |
1015 |
||
1016 |
||
1017 |
#endif |