sl@0
|
1 |
// Copyright (c) 1995-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 |
// e32\memmodel\epoc\pprocess.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "plat_priv.h"
|
sl@0
|
19 |
#include <kernel/cache.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
#ifdef KDLL
|
sl@0
|
22 |
GLREF_C void DumpCodeSegCreateInfo(TCodeSegCreateInfo& a);
|
sl@0
|
23 |
#endif
|
sl@0
|
24 |
|
sl@0
|
25 |
TInt DEpocProcess::AttachExistingCodeSeg(TProcessCreateInfo& aInfo)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
CHECK_PAGING_SAFE;
|
sl@0
|
28 |
__KTRACE_OPT(KDLL,Kern::Printf("DEpocProcess %O AttachExistingCodeSeg",this));
|
sl@0
|
29 |
__KTRACE_OPT(KDLL,DumpCodeSegCreateInfo(aInfo));
|
sl@0
|
30 |
DEpocCodeSeg& s=*(DEpocCodeSeg*)iTempCodeSeg;
|
sl@0
|
31 |
if (s.iAttachProcess && s.iAttachProcess!=this)
|
sl@0
|
32 |
return KErrAlreadyExists;
|
sl@0
|
33 |
TInt r=CreateDataBssStackArea(aInfo);
|
sl@0
|
34 |
if (r==KErrNone)
|
sl@0
|
35 |
{
|
sl@0
|
36 |
TLinAddr dra;
|
sl@0
|
37 |
if (s.iXIP)
|
sl@0
|
38 |
{
|
sl@0
|
39 |
const TRomImageHeader& rih=s.RomInfo();
|
sl@0
|
40 |
aInfo.iExportDir=rih.iExportDir;
|
sl@0
|
41 |
aInfo.iCodeLoadAddress=rih.iCodeAddress;
|
sl@0
|
42 |
aInfo.iCodeRunAddress=rih.iCodeAddress;
|
sl@0
|
43 |
aInfo.iDataLoadAddress=rih.iDataAddress;
|
sl@0
|
44 |
dra=aInfo.iDataRunAddress=rih.iDataBssLinearBase;
|
sl@0
|
45 |
}
|
sl@0
|
46 |
else
|
sl@0
|
47 |
{
|
sl@0
|
48 |
SRamCodeInfo& ri=s.RamInfo();
|
sl@0
|
49 |
aInfo.iExportDir=ri.iExportDir;
|
sl@0
|
50 |
aInfo.iCodeLoadAddress=ri.iCodeLoadAddr;
|
sl@0
|
51 |
aInfo.iCodeRunAddress=ri.iCodeRunAddr;
|
sl@0
|
52 |
aInfo.iDataLoadAddress=ri.iDataLoadAddr;
|
sl@0
|
53 |
dra=aInfo.iDataRunAddress=ri.iDataRunAddr;
|
sl@0
|
54 |
}
|
sl@0
|
55 |
if (aInfo.iTotalDataSize && iDataBssRunAddress!=dra)
|
sl@0
|
56 |
return KErrNotSupported;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
aInfo.iEntryPtVeneer=s.iEntryPtVeneer;
|
sl@0
|
59 |
aInfo.iFileEntryPoint=s.iFileEntryPoint;
|
sl@0
|
60 |
__KTRACE_OPT(KDLL,DumpCodeSegCreateInfo(aInfo));
|
sl@0
|
61 |
__KTRACE_OPT(KDLL,Kern::Printf("DEpocProcess::AttachExistingCodeSeg returns %d",r));
|
sl@0
|
62 |
return r;
|
sl@0
|
63 |
}
|