Update contrib.
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\euser\epoc\arm\uc_exe.cpp
22 GLREF_C TInt E32Main();
26 #if defined(__GCC32__)
27 typedef void (*PFV)();
28 extern PFV __CTOR_LIST__[];
29 extern PFV __DTOR_LIST__[];
31 void globalDestructorFunc()
34 while (__DTOR_LIST__[i])
35 (*__DTOR_LIST__[i++])();
38 void RunThread(TBool aNotFirst, SThreadCreateInfo& aInfo)
40 SStdEpocThreadCreateInfo& cinfo = (SStdEpocThreadCreateInfo&)aInfo;
42 #ifdef USE_INSTRUMENTED_HEAP
43 cinfo.iFlags |= ETraceHeapAllocs;
44 #elif defined(ENABLE_HEAP_MONITORING)
45 cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory;
47 TInt r = UserHeap::SetupThreadHeap(aNotFirst, cinfo);
50 r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc);
55 r = (*cinfo.iFunction)(cinfo.iPtr);
58 // Init statics for implicitly linked DLLs
61 // Init statics for EXE
63 while (__CTOR_LIST__[i])
64 (*__CTOR_LIST__[i++])();
73 #elif defined(__ARMCC__)
75 TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst);
77 __weak void run_static_dtors(void);
79 void globalDestructorFunc()
81 int call_static_dtors = (int)run_static_dtors;
82 if (call_static_dtors)
86 void RunThread(TBool aNotFirst, SThreadCreateInfo& aInfo)
88 SStdEpocThreadCreateInfo& cinfo = (SStdEpocThreadCreateInfo&)aInfo;
90 #ifdef USE_INSTRUMENTED_HEAP
91 cinfo.iFlags |= ETraceHeapAllocs;
92 #elif defined(ENABLE_HEAP_MONITORING)
93 cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory;
95 TInt r = UserHeap::SetupThreadHeap(aNotFirst, cinfo);
98 r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc);
101 r = CallThrdProcEntry(cinfo.iFunction, cinfo.iPtr, aNotFirst);