sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <memmodel.h>
|
sl@0
|
17 |
#include "mmu/mm.h"
|
sl@0
|
18 |
#include "mmboot.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "cache_maintenance.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
extern void DoProcessSwitch();
|
sl@0
|
23 |
|
sl@0
|
24 |
void M::Init1()
|
sl@0
|
25 |
{
|
sl@0
|
26 |
// Memory model dependent CPU stuff
|
sl@0
|
27 |
__KTRACE_OPT(KBOOT,Kern::Printf("MM::Init1()"));
|
sl@0
|
28 |
|
sl@0
|
29 |
K::MaxMemCopyInOneGo=KDefaultMaxMemCopyInOneGo;
|
sl@0
|
30 |
TheScheduler.SetProcessHandler((TLinAddr)DoProcessSwitch);
|
sl@0
|
31 |
|
sl@0
|
32 |
__KTRACE_OPT(KBOOT,Kern::Printf("K::MaxMemCopyInOneGo=0x%x",K::MaxMemCopyInOneGo));
|
sl@0
|
33 |
|
sl@0
|
34 |
// Set up cache info
|
sl@0
|
35 |
CacheMaintenance::Init1();
|
sl@0
|
36 |
|
sl@0
|
37 |
// First phase MMU initialisation
|
sl@0
|
38 |
MM::Init1();
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
void M::Init2()
|
sl@0
|
43 |
{
|
sl@0
|
44 |
// Second phase MMU initialisation
|
sl@0
|
45 |
MM::Init2();
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
|
sl@0
|
49 |
void M::Init3()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
// Third phase MMU initialisation
|
sl@0
|
52 |
MM::Init3();
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
|
sl@0
|
56 |
TInt M::InitSvHeapChunk(DChunk* aChunk, TInt aSize)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
TInt r;
|
sl@0
|
59 |
TLinAddr base = TheRomHeader().iKernDataAddress;
|
sl@0
|
60 |
DMemModelChunk* pC = (DMemModelChunk*)aChunk;
|
sl@0
|
61 |
K::HeapInfo.iChunk = aChunk;
|
sl@0
|
62 |
K::HeapInfo.iBase = (TUint8*)base;
|
sl@0
|
63 |
K::HeapInfo.iMaxSize = pC->MaxSize();
|
sl@0
|
64 |
pC->SetFixedAddress(base, aSize);
|
sl@0
|
65 |
__KTRACE_OPT(KBOOT,Kern::Printf("Created SvHeap chunk, addr %08X, init size %08X max size %08X",base,aSize,pC->MaxSize()));
|
sl@0
|
66 |
r=((DMemModelProcess*)K::TheKernelProcess)->DoAddChunk(pC,EFalse);
|
sl@0
|
67 |
__KTRACE_OPT(KBOOT,Kern::Printf("Added kernel heap chunk to current process, %d",r));
|
sl@0
|
68 |
__NK_ASSERT_DEBUG(pC->Base(K::TheKernelProcess)==(TUint8*)base);
|
sl@0
|
69 |
return r;
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
|
sl@0
|
73 |
TInt M::InitSvStackChunk()
|
sl@0
|
74 |
{
|
sl@0
|
75 |
// nothing to do...
|
sl@0
|
76 |
return KErrNone;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
void RHeapK::Mutate(TInt aOffset, TInt aMaxLength)
|
sl@0
|
81 |
//
|
sl@0
|
82 |
// Used by the kernel to mutate a fixed heap into a chunk heap.
|
sl@0
|
83 |
//
|
sl@0
|
84 |
{
|
sl@0
|
85 |
iMinLength += aOffset;
|
sl@0
|
86 |
iMaxLength = aMaxLength + aOffset;
|
sl@0
|
87 |
iOffset = aOffset;
|
sl@0
|
88 |
iChunkHandle = (TInt)K::HeapInfo.iChunk;
|
sl@0
|
89 |
iPageSize = KPageSize;
|
sl@0
|
90 |
iGrowBy = iPageSize;
|
sl@0
|
91 |
iFlags = 0;
|
sl@0
|
92 |
MM::MemorySetLock(((DMemModelChunk*)K::HeapInfo.iChunk)->iMemoryObject,*(DMutex**)&iLock);
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
|