|
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" |
|
21 |
|
22 extern void DoProcessSwitch(); |
|
23 |
|
24 void M::Init1() |
|
25 { |
|
26 // Memory model dependent CPU stuff |
|
27 __KTRACE_OPT(KBOOT,Kern::Printf("MM::Init1()")); |
|
28 |
|
29 K::MaxMemCopyInOneGo=KDefaultMaxMemCopyInOneGo; |
|
30 TheScheduler.SetProcessHandler((TLinAddr)DoProcessSwitch); |
|
31 |
|
32 __KTRACE_OPT(KBOOT,Kern::Printf("K::MaxMemCopyInOneGo=0x%x",K::MaxMemCopyInOneGo)); |
|
33 |
|
34 // Set up cache info |
|
35 CacheMaintenance::Init1(); |
|
36 |
|
37 // First phase MMU initialisation |
|
38 MM::Init1(); |
|
39 } |
|
40 |
|
41 |
|
42 void M::Init2() |
|
43 { |
|
44 // Second phase MMU initialisation |
|
45 MM::Init2(); |
|
46 } |
|
47 |
|
48 |
|
49 void M::Init3() |
|
50 { |
|
51 // Third phase MMU initialisation |
|
52 MM::Init3(); |
|
53 } |
|
54 |
|
55 |
|
56 TInt M::InitSvHeapChunk(DChunk* aChunk, TInt aSize) |
|
57 { |
|
58 TInt r; |
|
59 TLinAddr base = TheRomHeader().iKernDataAddress; |
|
60 DMemModelChunk* pC = (DMemModelChunk*)aChunk; |
|
61 K::HeapInfo.iChunk = aChunk; |
|
62 K::HeapInfo.iBase = (TUint8*)base; |
|
63 K::HeapInfo.iMaxSize = pC->MaxSize(); |
|
64 pC->SetFixedAddress(base, aSize); |
|
65 __KTRACE_OPT(KBOOT,Kern::Printf("Created SvHeap chunk, addr %08X, init size %08X max size %08X",base,aSize,pC->MaxSize())); |
|
66 r=((DMemModelProcess*)K::TheKernelProcess)->DoAddChunk(pC,EFalse); |
|
67 __KTRACE_OPT(KBOOT,Kern::Printf("Added kernel heap chunk to current process, %d",r)); |
|
68 __NK_ASSERT_DEBUG(pC->Base(K::TheKernelProcess)==(TUint8*)base); |
|
69 return r; |
|
70 } |
|
71 |
|
72 |
|
73 TInt M::InitSvStackChunk() |
|
74 { |
|
75 // nothing to do... |
|
76 return KErrNone; |
|
77 } |
|
78 |
|
79 |
|
80 void RHeapK::Mutate(TInt aOffset, TInt aMaxLength) |
|
81 // |
|
82 // Used by the kernel to mutate a fixed heap into a chunk heap. |
|
83 // |
|
84 { |
|
85 iMinLength += aOffset; |
|
86 iMaxLength = aMaxLength + aOffset; |
|
87 iOffset = aOffset; |
|
88 iChunkHandle = (TInt)K::HeapInfo.iChunk; |
|
89 iPageSize = KPageSize; |
|
90 iGrowBy = iPageSize; |
|
91 iFlags = 0; |
|
92 MM::MemorySetLock(((DMemModelChunk*)K::HeapInfo.iChunk)->iMemoryObject,*(DMutex**)&iLock); |
|
93 } |
|
94 |
|
95 |