Update contrib.
1 // Copyright (c) 1996-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\multiple\minit.cpp
19 #include "cache_maintenance.h"
21 _LIT(KLitSvStack,"SvStack");
23 const TInt KMaxThreads=1024;
27 // Memory model dependent CPU stuff
31 CacheMaintenance::Init1();
33 // First phase MMU initialisation
40 // Second phase MMU initialisation
47 // Third phase MMU initialisation
52 TInt M::InitSvHeapChunk(DChunk* aChunk, TInt aSize)
55 TLinAddr base = TheRomHeader().iKernDataAddress;
56 DMemModelChunk* pC = (DMemModelChunk*)aChunk;
57 K::HeapInfo.iChunk = aChunk;
58 K::HeapInfo.iBase = (TUint8*)base;
59 K::HeapInfo.iMaxSize = pC->MaxSize();
60 pC->SetFixedAddress(base, aSize);
61 __KTRACE_OPT(KBOOT,Kern::Printf("Created SvHeap chunk, addr %08X, init size %08X max size %08X",pC->Base(),aSize,pC->MaxSize()));
62 TLinAddr dataSectionBase=0;
63 r=((DMemModelProcess*)K::TheKernelProcess)->AddChunk(pC,dataSectionBase,EFalse);
64 __KTRACE_OPT(KBOOT,Kern::Printf("Added kernel heap chunk to current process, %d",r));
68 TInt M::InitSvStackChunk()
70 // create a chunk to hold supervisor-mode stacks
72 TInt alias_space=m.iAliasSize+m.iPageSize;
73 TInt total=alias_space+K::SupervisorThreadStackSize+PP::SupervisorThreadStackGuard;
74 total=(total+m.iAliasMask)&~m.iAliasMask;
75 DMemModelChunk* pC=NULL;
76 DMemModelProcess* pP=(DMemModelProcess*)K::TheKernelProcess;
77 TInt maxsize=total*KMaxThreads;
78 TLinAddr dataSectionBase=0;
79 SChunkCreateInfo cinfo;
81 cinfo.iAtt=TChunkCreate::EDisconnected;
82 cinfo.iForceFixed=EFalse;
84 cinfo.iType=EKernelStack;
85 cinfo.iMaxSize=maxsize;
86 cinfo.iPreallocated=0;
87 cinfo.iName.Set(KLitSvStack);
88 cinfo.iOwner=K::TheKernelProcess;
89 TInt r=pP->NewChunk((DChunk*&)pC,cinfo,dataSectionBase);
90 __KTRACE_OPT(KBOOT,Kern::Printf("Created SvStack, %d",r));
96 __KTRACE_OPT(KBOOT,Kern::Printf("Created SvStack chunk, addr %08X, max size %08X",pC->Base(),maxsize));
98 r=pP->AddChunk(pC,dataSectionBase,EFalse);
99 __KTRACE_OPT(KBOOT,Kern::Printf("Added SvStack chunk to current process, %d",r));