diff -r 96e5fb8b040d -r 36bfc973b146 kernel/eka/memmodel/epoc/flexible/mmu/mmapping.cpp --- a/kernel/eka/memmodel/epoc/flexible/mmu/mmapping.cpp Thu Dec 17 09:24:54 2009 +0200 +++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmapping.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -507,19 +507,20 @@ if(pinnedPt && pinnedPt!=pt) { // previously pinned page table not needed... - PageTableAllocator::UnpinPageTable(pinnedPt,aPinArgs); + ::PageTables.UnpinPageTable(pinnedPt,aPinArgs); // make sure we have memory for next pin attempt... MmuLock::Unlock(); aPinArgs.AllocReplacementPages(KNumPagesToPinOnePageTable); - MmuLock::Lock(); if(!aPinArgs.HaveSufficientPages(KNumPagesToPinOnePageTable)) // if out of memory... { // make sure we free any unneeded page table we allocated... if(pt) FreePageTable(Mmu::PageDirectoryEntry(OsAsid(),aAddr)); + MmuLock::Lock(); return 0; } + MmuLock::Lock(); } if(!pt) @@ -539,8 +540,16 @@ return pt; // pin the page table... + if (::PageTables.PinPageTable(pt,aPinArgs) != KErrNone) + {// Couldn't pin the page table... + MmuLock::Unlock(); + // make sure we free any unneeded page table we allocated... + FreePageTable(Mmu::PageDirectoryEntry(OsAsid(),aAddr)); + MmuLock::Lock(); + return 0; + } + pinnedPt = pt; - PageTableAllocator::PinPageTable(pinnedPt,aPinArgs); } } @@ -1485,7 +1494,7 @@ MmuLock::Lock(); while(pPt