First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\memmodel\epoc\pprocess.cpp
18 #include "plat_priv.h"
19 #include <kernel/cache.h>
22 GLREF_C void DumpCodeSegCreateInfo(TCodeSegCreateInfo& a);
25 TInt DEpocProcess::AttachExistingCodeSeg(TProcessCreateInfo& aInfo)
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);
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;
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;
55 if (aInfo.iTotalDataSize && iDataBssRunAddress!=dra)
56 return KErrNotSupported;
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));