113 } |
113 } |
114 |
114 |
115 RamAllocLock::Lock(); |
115 RamAllocLock::Lock(); |
116 |
116 |
117 // Move the page to any RAM zone. |
117 // Move the page to any RAM zone. |
118 r = M::MovePage(aOld, aNew, KRamZoneInvalidId, EFalse); |
118 r = M::MovePage(aOld, aNew, KRamZoneInvalidId, 0); |
119 |
119 |
120 RamAllocLock::Unlock(); |
120 RamAllocLock::Unlock(); |
121 return r; |
121 return r; |
122 } |
122 } |
123 |
123 |
124 |
124 |
125 TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest) |
125 TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TUint aMoveDisFlags) |
126 { |
126 { |
127 // Returns this when page is not paged or managed or free but is a real RAM page. |
127 // Returns this when page is not paged or managed or free but is a real RAM page. |
128 TInt r = KErrNotSupported; |
128 TInt r = KErrNotSupported; |
129 |
129 |
130 // get memory object corresponding to the page... |
130 // get memory object corresponding to the page... |
131 DMemoryObject* memory = 0; |
131 DMemoryObject* memory = 0; |
132 MmuLock::Lock(); |
132 MmuLock::Lock(); |
133 SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aOld&~KPageMask); |
133 SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aOld & ~KPageMask); |
134 if(pi) |
134 if (pi) |
135 { |
135 { |
136 if (pi->PagedState() != SPageInfo::EUnpaged) |
136 if (pi->PagedState() != SPageInfo::EUnpaged) |
137 {// The page is paged so let the pager handle it. |
137 {// The page is paged so let the pager handle it. |
138 return ThePager.DiscardPage(pi, aBlockZoneId, aBlockRest); |
138 return ThePager.DiscardPage(pi, aBlockZoneId, aMoveDisFlags); |
139 } |
139 } |
140 switch (pi->Type()) |
140 switch (pi->Type()) |
141 { |
141 { |
142 case SPageInfo::EManaged: |
142 case SPageInfo::EManaged: |
143 memory = pi->Owner(); |
143 memory = pi->Owner(); |
147 // Also, as memory objects can't be destroyed whilst they still own pages |
147 // Also, as memory objects can't be destroyed whilst they still own pages |
148 // we can safely access this object without taking an explicit reference, |
148 // we can safely access this object without taking an explicit reference, |
149 // i.e. we don't need to Open() the memory object. |
149 // i.e. we don't need to Open() the memory object. |
150 MmuLock::Unlock(); |
150 MmuLock::Unlock(); |
151 // move page... |
151 // move page... |
152 r = memory->iManager->MovePage(memory, pi, aNew, aBlockZoneId, aBlockRest); |
152 r = memory->iManager->MovePage( memory, pi, aNew, aBlockZoneId, |
|
153 (aMoveDisFlags & M::EMoveDisBlockRest)!=0); |
153 break; |
154 break; |
154 case SPageInfo::EUnused: |
155 case SPageInfo::EUnused: |
155 r = KErrNotFound; // This page is free so nothing to do. |
156 r = KErrNotFound; // This page is free so nothing to do. |
156 // Fall through.. |
157 // Fall through.. |
157 default: |
158 default: |