sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\memmodel\epoc\pprocess.cpp sl@0: // sl@0: // sl@0: sl@0: #include "plat_priv.h" sl@0: #include sl@0: sl@0: #ifdef KDLL sl@0: GLREF_C void DumpCodeSegCreateInfo(TCodeSegCreateInfo& a); sl@0: #endif sl@0: sl@0: TInt DEpocProcess::AttachExistingCodeSeg(TProcessCreateInfo& aInfo) sl@0: { sl@0: CHECK_PAGING_SAFE; sl@0: __KTRACE_OPT(KDLL,Kern::Printf("DEpocProcess %O AttachExistingCodeSeg",this)); sl@0: __KTRACE_OPT(KDLL,DumpCodeSegCreateInfo(aInfo)); sl@0: DEpocCodeSeg& s=*(DEpocCodeSeg*)iTempCodeSeg; sl@0: if (s.iAttachProcess && s.iAttachProcess!=this) sl@0: return KErrAlreadyExists; sl@0: TInt r=CreateDataBssStackArea(aInfo); sl@0: if (r==KErrNone) sl@0: { sl@0: TLinAddr dra; sl@0: if (s.iXIP) sl@0: { sl@0: const TRomImageHeader& rih=s.RomInfo(); sl@0: aInfo.iExportDir=rih.iExportDir; sl@0: aInfo.iCodeLoadAddress=rih.iCodeAddress; sl@0: aInfo.iCodeRunAddress=rih.iCodeAddress; sl@0: aInfo.iDataLoadAddress=rih.iDataAddress; sl@0: dra=aInfo.iDataRunAddress=rih.iDataBssLinearBase; sl@0: } sl@0: else sl@0: { sl@0: SRamCodeInfo& ri=s.RamInfo(); sl@0: aInfo.iExportDir=ri.iExportDir; sl@0: aInfo.iCodeLoadAddress=ri.iCodeLoadAddr; sl@0: aInfo.iCodeRunAddress=ri.iCodeRunAddr; sl@0: aInfo.iDataLoadAddress=ri.iDataLoadAddr; sl@0: dra=aInfo.iDataRunAddress=ri.iDataRunAddr; sl@0: } sl@0: if (aInfo.iTotalDataSize && iDataBssRunAddress!=dra) sl@0: return KErrNotSupported; sl@0: } sl@0: aInfo.iEntryPtVeneer=s.iEntryPtVeneer; sl@0: aInfo.iFileEntryPoint=s.iFileEntryPoint; sl@0: __KTRACE_OPT(KDLL,DumpCodeSegCreateInfo(aInfo)); sl@0: __KTRACE_OPT(KDLL,Kern::Printf("DEpocProcess::AttachExistingCodeSeg returns %d",r)); sl@0: return r; sl@0: }