os/kernelhwsrv/kernel/eka/euser/epoc/x86/uc_exe.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/euser/epoc/x86/uc_exe.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\euser\epoc\x86\uc_exe.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "u32std.h"
    1.22 +#include <u32exec.h>
    1.23 +#include <e32svr.h>
    1.24 +
    1.25 +// include the static data definitions
    1.26 +#define __FLTUSED
    1.27 +#include "win32crt.h"
    1.28 +#include "nwdl.h"
    1.29 +
    1.30 +
    1.31 +GLREF_C TInt E32Main();
    1.32 +
    1.33 +extern "C" {
    1.34 +
    1.35 +void globalDestructorFunc()
    1.36 +	{
    1.37 +	destroyStatics(); // this is a macro
    1.38 +	}
    1.39 +
    1.40 +void __fastcall RunThread(TBool aNotFirst, SThreadCreateInfo& aInfo)
    1.41 +	{
    1.42 +	SStdEpocThreadCreateInfo& cinfo = (SStdEpocThreadCreateInfo&)aInfo;
    1.43 +
    1.44 +#ifdef USE_INSTRUMENTED_HEAP
    1.45 +	cinfo.iFlags |= ETraceHeapAllocs;
    1.46 +#elif defined(ENABLE_HEAP_MONITORING)
    1.47 +	cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory;
    1.48 +#endif
    1.49 +	TInt r = UserHeap::SetupThreadHeap(aNotFirst, cinfo);
    1.50 +
    1.51 +	if (r==KErrNone)
    1.52 +		r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc);
    1.53 +
    1.54 +	if (r==KErrNone)
    1.55 +		{
    1.56 +		if (aNotFirst)
    1.57 +			r = (*cinfo.iFunction)(cinfo.iPtr);
    1.58 +		else
    1.59 +			{
    1.60 +			// Init statics for implicitly linked DLLs
    1.61 +			User::InitProcess();
    1.62 +
    1.63 +			// Init statics for EXE
    1.64 +			constructStatics();
    1.65 +			r = E32Main();
    1.66 +			}
    1.67 +		}
    1.68 +	User::Exit(r);
    1.69 +	}
    1.70 +
    1.71 +void _fltused() {}	
    1.72 +}