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