author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 31 Mar 2010 23:38:45 +0300 | |
branch | RCL_3 |
changeset 87 | 2f92ad2dc5db |
parent 62 | 4a8fed1c0ef6 |
permissions | -rw-r--r-- |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\memmodel\epoc\moving\minit.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "memmodel.h" |
|
19 |
#include "cache_maintenance.h" |
|
20 |
||
21 |
_LIT(KLitSvStack,"SvStack"); |
|
22 |
||
23 |
const TInt KMaxSupervisorStackSpace=0x200000; |
|
24 |
||
25 |
void M::Init1() |
|
26 |
{ |
|
27 |
TheCurrentAddressSpace=NULL; |
|
28 |
TheCurrentVMProcess=NULL; |
|
29 |
TheCurrentDataSectionProcess=NULL; |
|
30 |
TheCompleteDataSectionProcess=NULL; |
|
31 |
||
32 |
// Memory model dependent CPU stuff |
|
33 |
MM::Init1(); |
|
34 |
||
35 |
// Set up cache info |
|
36 |
CacheMaintenance::Init1(); |
|
37 |
||
38 |
// First phase MMU initialisation |
|
39 |
Mmu& m=Mmu::Get(); |
|
40 |
m.Init1(); |
|
41 |
} |
|
42 |
||
43 |
void M::Init2() |
|
44 |
{ |
|
45 |
// Second phase MMU initialisation |
|
46 |
Mmu& m=Mmu::Get(); |
|
47 |
m.Init2(); |
|
48 |
} |
|
49 |
||
50 |
void M::Init3() |
|
51 |
{ |
|
52 |
// Third phase MMU initialisation |
|
53 |
Mmu& m=Mmu::Get(); |
|
54 |
m.Init3(); |
|
55 |
} |
|
56 |
||
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
void M::Init4() |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
{ |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
// Fourth phase MMU initialisation - Not required on this memory model. |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
} |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
|
0 | 62 |
TInt M::InitSvHeapChunk(DChunk* aChunk, TInt aSize) |
63 |
{ |
|
64 |
TInt r; |
|
65 |
DMemModelChunk* pC=(DMemModelChunk*)aChunk; |
|
66 |
TLinAddr base = TheRomHeader().iKernDataAddress; |
|
67 |
K::HeapInfo.iChunk = aChunk; |
|
68 |
K::HeapInfo.iBase = (TUint8*)base; |
|
69 |
K::HeapInfo.iMaxSize = pC->MaxSize(); |
|
70 |
pC->SetFixedAddress(base, aSize); |
|
71 |
__KTRACE_OPT(KBOOT,Kern::Printf("Created SvHeap chunk, addr %08X, init size %08X max size %08X",pC->Base(),aSize,pC->MaxSize())); |
|
72 |
TLinAddr dataSectionBase=0; |
|
73 |
r=((DMemModelProcess*)K::TheKernelProcess)->AddChunk(pC,dataSectionBase,EFalse); |
|
74 |
__KTRACE_OPT(KBOOT,Kern::Printf("Added kernel heap chunk to current process, %d",r)); |
|
75 |
return r; |
|
76 |
} |
|
77 |
||
78 |
TInt M::InitSvStackChunk() |
|
79 |
{ |
|
80 |
// create a chunk to hold supervisor-mode stacks |
|
81 |
DMemModelChunk* pC=NULL; |
|
82 |
DMemModelProcess* pP=(DMemModelProcess*)K::TheKernelProcess; |
|
83 |
TInt maxsize=Mmu::RoundToChunkSize(KMaxSupervisorStackSpace); |
|
84 |
TLinAddr dataSectionBase=0; |
|
85 |
SChunkCreateInfo cinfo; |
|
86 |
cinfo.iGlobal=EFalse; |
|
87 |
cinfo.iAtt=TChunkCreate::EDisconnected; |
|
88 |
cinfo.iForceFixed=EFalse; |
|
89 |
cinfo.iOperations=0; |
|
90 |
cinfo.iType=EKernelStack; |
|
91 |
cinfo.iMaxSize=maxsize; |
|
92 |
cinfo.iPreallocated=0; |
|
93 |
cinfo.iName.Set(KLitSvStack); |
|
94 |
cinfo.iOwner=K::TheKernelProcess; |
|
95 |
TInt r=pP->NewChunk((DChunk*&)pC,cinfo,dataSectionBase); |
|
96 |
__KTRACE_OPT(KBOOT,Kern::Printf("Created SvStack, %d",r)); |
|
97 |
if (r!=KErrNone) |
|
98 |
return r; |
|
99 |
r=pC->Reserve(0); |
|
100 |
if (r!=KErrNone) |
|
101 |
return r; |
|
102 |
__KTRACE_OPT(KBOOT,Kern::Printf("Created SvStack chunk, addr %08X, max size %08X",pC->Base(),maxsize)); |
|
103 |
MM::SvStackChunk=pC; |
|
104 |
r=pP->AddChunk(pC,dataSectionBase,EFalse); |
|
105 |
__KTRACE_OPT(KBOOT,Kern::Printf("Added SvStack chunk to current process, %d",r)); |
|
106 |
||
107 |
// create user code chunk |
|
108 |
if (r==KErrNone) |
|
109 |
r = MM::CreateCodeChunk(EFalse); |
|
110 |
||
111 |
// create kernel code chunk |
|
112 |
if (r==KErrNone) |
|
113 |
r = MM::CreateCodeChunk(ETrue); |
|
114 |
return r; |
|
115 |
} |
|
116 |