equal
deleted
inserted
replaced
106 { |
106 { |
107 return KErrNotSupported; |
107 return KErrNotSupported; |
108 } |
108 } |
109 |
109 |
110 |
110 |
111 TInt DMemoryManager::CleanPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TPhysAddr*& /*aPageArrayEntry*/) |
111 void DMemoryManager::CleanPages(TUint aPageCount, SPageInfo** aPageInfos, TBool /*aBackground*/) |
112 { |
112 { |
113 if(aPageInfo->IsDirty()==false) |
113 for (TUint i = 0 ; i < aPageCount ; ++i) |
114 return KErrNone; |
114 __NK_ASSERT_DEBUG(!aPageInfos[i]->IsDirty()); |
115 __NK_ASSERT_DEBUG(0); |
|
116 return KErrNotSupported; |
|
117 } |
115 } |
118 |
116 |
119 |
117 |
120 TInt DMemoryManager::HandleFault( DMemoryObject* aMemory, TUint aIndex, DMemoryMapping* aMapping, |
118 TInt DMemoryManager::HandleFault( DMemoryObject* aMemory, TUint aIndex, DMemoryMapping* aMapping, |
121 TUint aMapInstanceCount, TUint aAccessPermissions) |
119 TUint aMapInstanceCount, TUint aAccessPermissions) |
1037 TRACE2(("DDiscardableMemoryManager::StealPage(0x%08x,0x%08x)",aMemory,aPageInfo)); |
1035 TRACE2(("DDiscardableMemoryManager::StealPage(0x%08x,0x%08x)",aMemory,aPageInfo)); |
1038 __NK_ASSERT_DEBUG(RamAllocLock::IsHeld()); |
1036 __NK_ASSERT_DEBUG(RamAllocLock::IsHeld()); |
1039 __NK_ASSERT_DEBUG(MmuLock::IsHeld()); |
1037 __NK_ASSERT_DEBUG(MmuLock::IsHeld()); |
1040 __UNLOCK_GUARD_START(MmuLock); |
1038 __UNLOCK_GUARD_START(MmuLock); |
1041 |
1039 |
|
1040 // must always hold the PageCleaningLock if the page needs to be cleaned |
|
1041 __NK_ASSERT_DEBUG(!aPageInfo->IsDirty() || PageCleaningLock::IsHeld()); |
|
1042 |
1042 TUint index = aPageInfo->Index(); |
1043 TUint index = aPageInfo->Index(); |
1043 TInt r; |
1044 TInt r; |
1044 |
1045 |
1045 RPageArray::TIter pageList; |
1046 RPageArray::TIter pageList; |
1046 TPhysAddr* p = aMemory->iPages.StealPageStart(index,pageList); |
1047 TPhysAddr* p = aMemory->iPages.StealPageStart(index,pageList); |
1094 else |
1095 else |
1095 { |
1096 { |
1096 // page successfully unmapped... |
1097 // page successfully unmapped... |
1097 aPageInfo->SetReadOnly(); // page not mapped, so must be read-only |
1098 aPageInfo->SetReadOnly(); // page not mapped, so must be read-only |
1098 |
1099 |
1099 // if the page can be made clean... |
1100 // attempt to clean the page if it is dirty... |
1100 r = aMemory->iManager->CleanPage(aMemory,aPageInfo,p); |
1101 if (aPageInfo->IsDirty()) |
1101 |
1102 aMemory->iManager->CleanPages(1, &aPageInfo, EFalse); |
1102 if(r==KErrNone) |
1103 |
|
1104 if(aPageInfo) |
1103 { |
1105 { |
1104 // page successfully stolen... |
1106 // page successfully stolen... |
1105 __NK_ASSERT_DEBUG((*p^page)<(TUint)KPageSize); // sanity check, page should still be allocated to us |
1107 __NK_ASSERT_DEBUG((*p^page)<(TUint)KPageSize); // sanity check, page should still be allocated to us |
1106 __NK_ASSERT_DEBUG(aPageInfo->IsDirty()==false); |
1108 __NK_ASSERT_DEBUG(aPageInfo->IsDirty()==false); |
1107 __NK_ASSERT_DEBUG(aPageInfo->IsWritable()==false); |
1109 __NK_ASSERT_DEBUG(aPageInfo->IsWritable()==false); |
1109 TPhysAddr pagerInfo = aPageInfo->PagingManagerData(); |
1111 TPhysAddr pagerInfo = aPageInfo->PagingManagerData(); |
1110 *p = pagerInfo; |
1112 *p = pagerInfo; |
1111 __NK_ASSERT_ALWAYS((pagerInfo&(RPageArray::EFlagsMask|RPageArray::EStateMask)) == RPageArray::ENotPresent); |
1113 __NK_ASSERT_ALWAYS((pagerInfo&(RPageArray::EFlagsMask|RPageArray::EStateMask)) == RPageArray::ENotPresent); |
1112 |
1114 |
1113 TheMmu.PageFreed(aPageInfo); |
1115 TheMmu.PageFreed(aPageInfo); |
|
1116 r = KErrNone; |
1114 } |
1117 } |
1115 else |
1118 else |
1116 { |
1119 r = KErrInUse; |
1117 // only legitimate reason for failing the clean is if the page state was changed |
|
1118 // by a page fault or by pinning, this should return KErrInUse... |
|
1119 __NK_ASSERT_DEBUG(r==KErrInUse); |
|
1120 } |
|
1121 } |
1120 } |
1122 } |
1121 } |
1123 |
1122 |
1124 aMemory->iPages.StealPageEnd(index,r==KErrNone ? 1 : 0); |
1123 aMemory->iPages.StealPageEnd(index,r==KErrNone ? 1 : 0); |
1125 |
1124 |
2028 TInt DPagedMemoryManager::AcquirePageWriteRequest(DPageWriteRequest*& aRequest, DMemoryObject* aMemory, TUint aIndex, TUint aCount) |
2027 TInt DPagedMemoryManager::AcquirePageWriteRequest(DPageWriteRequest*& aRequest, DMemoryObject* aMemory, TUint aIndex, TUint aCount) |
2029 { |
2028 { |
2030 __NK_ASSERT_ALWAYS(0); |
2029 __NK_ASSERT_ALWAYS(0); |
2031 return KErrNotSupported; |
2030 return KErrNotSupported; |
2032 } |
2031 } |
2033 |
|
2034 |
|
2035 TInt DPagedMemoryManager::WritePages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages, DPageWriteRequest* aRequest) |
|
2036 { |
|
2037 __NK_ASSERT_ALWAYS(0); |
|
2038 return KErrNotSupported; |
|
2039 } |
|
2040 |
|
2041 TZonePageType DPagedMemoryManager::PageType() |
2032 TZonePageType DPagedMemoryManager::PageType() |
2042 {// Paged manager's pages should be discardable and will actaully be freed by |
2033 {// Paged manager's pages should be discardable and will actaully be freed by |
2043 // the pager so this value won't be used. |
2034 // the pager so this value won't be used. |
2044 return EPageDiscard; |
2035 return EPageDiscard; |
2045 } |
2036 } |