Update contrib.
1 // Copyright (c) 1998-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\memmodel\epoc\moving\mmu.cpp
20 /*******************************************************************************
21 * "Independent" MMU code
22 *******************************************************************************/
24 void Mmu::Panic(TPanic aPanic)
26 Kern::Fault("MMU",aPanic);
31 __KTRACE_OPT2(KBOOT,KMMU,Kern::Printf("Mmu::Init1"));
32 __ASSERT_ALWAYS(TheRomHeader().iUserDataAddress==iDllDataBase+iMaxDllDataSize,Panic(ERomUserDataAddressInvalid));
33 __ASSERT_ALWAYS((TheRomHeader().iTotalUserDataSize&iPageMask)==0,Panic(ERomUserDataSizeInvalid));
34 __ASSERT_ALWAYS(::RomHeaderAddress==iRomLinearBase,Panic(ERomLinearAddressInvalid));
40 __KTRACE_OPT2(KBOOT,KMMU,Kern::Printf("Mmu::DoInit2"));
41 MM::DllDataAllocator=TBitMapAllocator::New(iMaxDllDataSize>>iPageShift, ETrue);
42 __ASSERT_ALWAYS(MM::DllDataAllocator,Panic(EDllDataAllocatorCreateFailed));
43 TInt rom_dll_pages=TheRomHeader().iTotalUserDataSize>>iPageShift;
44 __KTRACE_OPT2(KBOOT,KMMU,Kern::Printf("DllDataAllocator @ %08x, %d ROM DLL Data Pages", MM::DllDataAllocator, rom_dll_pages));
46 MM::DllDataAllocator->Alloc(0, rom_dll_pages); // low bit numbers represent high addresses
49 //#ifndef __MMU_MACHINE_CODED__
50 TInt Mmu::PageTableId(TLinAddr aAddr)
53 TInt id = GetPageTableId(aAddr);
54 NKern::UnlockSystem();
59 void Mmu::AssignPageTable(TInt aId, TInt aUsage, TAny* aObject, TLinAddr aAddr, TPde aPdePerm)
61 __KTRACE_OPT(KMMU,Kern::Printf("Mmu::AssignPageTable id=%d, u=%08x, obj=%08x, addr=%08x, perm=%08x",
62 aId, aUsage, aObject, aAddr, aPdePerm));
64 SPageTableInfo& pti=PtInfo(aId);
67 // case SPageTableInfo::EChunk:
69 // DMemModelChunk* pC=(DMemModelChunk*)aObject;
70 // TUint32 ccp=K::CompressKHeapPtr(pC);
71 // TUint32 offset=(aAddr-TLinAddr(pC->iBase))>>iChunkShift;
72 // pti.SetChunk(ccp,offset);
75 // case SPageTableInfo::EHwChunk:
77 case SPageTableInfo::EGlobal:
78 pti.SetGlobal(aAddr>>iChunkShift);
81 Panic(EAssignPageTableInvalidUsage);
83 DoAssignPageTable(aId, aAddr, aPdePerm);
84 NKern::UnlockSystem();
87 TInt Mmu::UnassignPageTable(TLinAddr aAddr)
89 __KTRACE_OPT(KMMU,Kern::Printf("Mmu::UnassignPageTable addr=%08x", aAddr));
91 TInt id=GetPageTableId(aAddr);
93 DoUnassignPageTable(aAddr);
94 NKern::UnlockSystem();