os/kernelhwsrv/kernel/eka/euser/epoc/x86/uc_exe.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32\euser\epoc\x86\uc_exe.cpp
    15 // 
    16 //
    17 
    18 #include "u32std.h"
    19 #include <u32exec.h>
    20 #include <e32svr.h>
    21 
    22 // include the static data definitions
    23 #define __FLTUSED
    24 #include "win32crt.h"
    25 #include "nwdl.h"
    26 
    27 
    28 GLREF_C TInt E32Main();
    29 
    30 extern "C" {
    31 
    32 void globalDestructorFunc()
    33 	{
    34 	destroyStatics(); // this is a macro
    35 	}
    36 
    37 void __fastcall RunThread(TBool aNotFirst, SThreadCreateInfo& aInfo)
    38 	{
    39 	SStdEpocThreadCreateInfo& cinfo = (SStdEpocThreadCreateInfo&)aInfo;
    40 
    41 #ifdef USE_INSTRUMENTED_HEAP
    42 	cinfo.iFlags |= ETraceHeapAllocs;
    43 #elif defined(ENABLE_HEAP_MONITORING)
    44 	cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory;
    45 #endif
    46 	TInt r = UserHeap::SetupThreadHeap(aNotFirst, cinfo);
    47 
    48 	if (r==KErrNone)
    49 		r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc);
    50 
    51 	if (r==KErrNone)
    52 		{
    53 		if (aNotFirst)
    54 			r = (*cinfo.iFunction)(cinfo.iPtr);
    55 		else
    56 			{
    57 			// Init statics for implicitly linked DLLs
    58 			User::InitProcess();
    59 
    60 			// Init statics for EXE
    61 			constructStatics();
    62 			r = E32Main();
    63 			}
    64 		}
    65 	User::Exit(r);
    66 	}
    67 
    68 void _fltused() {}	
    69 }