author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 11:08:29 +0300 | |
changeset 247 | d8d70de2bd36 |
parent 90 | 947f0dc9f7a8 |
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 |
// |
|
15 |
||
16 |
#include <memmodel.h> |
|
17 |
#include "mmu/mm.h" |
|
18 |
#include "mmboot.h" |
|
19 |
||
20 |
#include "cache_maintenance.h" |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "mmu/mmu.h" |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#include "mmu/mpager.h" |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
|
0 | 24 |
|
25 |
extern void DoProcessSwitch(); |
|
26 |
||
27 |
void M::Init1() |
|
28 |
{ |
|
29 |
// Memory model dependent CPU stuff |
|
30 |
__KTRACE_OPT(KBOOT,Kern::Printf("MM::Init1()")); |
|
31 |
||
32 |
K::MaxMemCopyInOneGo=KDefaultMaxMemCopyInOneGo; |
|
33 |
TheScheduler.SetProcessHandler((TLinAddr)DoProcessSwitch); |
|
34 |
||
35 |
__KTRACE_OPT(KBOOT,Kern::Printf("K::MaxMemCopyInOneGo=0x%x",K::MaxMemCopyInOneGo)); |
|
36 |
||
37 |
// Set up cache info |
|
38 |
CacheMaintenance::Init1(); |
|
39 |
||
40 |
// First phase MMU initialisation |
|
41 |
MM::Init1(); |
|
42 |
} |
|
43 |
||
44 |
||
45 |
void M::Init2() |
|
46 |
{ |
|
47 |
// Second phase MMU initialisation |
|
48 |
MM::Init2(); |
|
49 |
} |
|
50 |
||
51 |
||
52 |
void M::Init3() |
|
53 |
{ |
|
54 |
// Third phase MMU initialisation |
|
55 |
MM::Init3(); |
|
56 |
} |
|
57 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
void M::Init4() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
// Fourth phase MMU initialisation |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
ThePager.InitCache(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
|
0 | 64 |
|
65 |
TInt M::InitSvHeapChunk(DChunk* aChunk, TInt aSize) |
|
66 |
{ |
|
67 |
TInt r; |
|
68 |
TLinAddr base = TheRomHeader().iKernDataAddress; |
|
69 |
DMemModelChunk* pC = (DMemModelChunk*)aChunk; |
|
70 |
K::HeapInfo.iChunk = aChunk; |
|
71 |
K::HeapInfo.iBase = (TUint8*)base; |
|
72 |
K::HeapInfo.iMaxSize = pC->MaxSize(); |
|
73 |
pC->SetFixedAddress(base, aSize); |
|
74 |
__KTRACE_OPT(KBOOT,Kern::Printf("Created SvHeap chunk, addr %08X, init size %08X max size %08X",base,aSize,pC->MaxSize())); |
|
75 |
r=((DMemModelProcess*)K::TheKernelProcess)->DoAddChunk(pC,EFalse); |
|
76 |
__KTRACE_OPT(KBOOT,Kern::Printf("Added kernel heap chunk to current process, %d",r)); |
|
77 |
__NK_ASSERT_DEBUG(pC->Base(K::TheKernelProcess)==(TUint8*)base); |
|
78 |
return r; |
|
79 |
} |
|
80 |
||
81 |
||
82 |
TInt M::InitSvStackChunk() |
|
83 |
{ |
|
84 |
// nothing to do... |
|
85 |
return KErrNone; |
|
86 |
} |
|
87 |
||
88 |
||
89 |
void RHeapK::Mutate(TInt aOffset, TInt aMaxLength) |
|
90 |
// |
|
91 |
// Used by the kernel to mutate a fixed heap into a chunk heap. |
|
92 |
// |
|
93 |
{ |
|
94 |
iMinLength += aOffset; |
|
95 |
iMaxLength = aMaxLength + aOffset; |
|
96 |
iOffset = aOffset; |
|
97 |
iChunkHandle = (TInt)K::HeapInfo.iChunk; |
|
98 |
iPageSize = KPageSize; |
|
99 |
iGrowBy = iPageSize; |
|
100 |
iFlags = 0; |
|
101 |
MM::MemorySetLock(((DMemModelChunk*)K::HeapInfo.iChunk)->iMemoryObject,*(DMutex**)&iLock); |
|
102 |
} |
|
103 |
||
104 |