author | Chetan Kapoor <chetank@symbian.org> |
Tue, 04 May 2010 16:57:20 +0100 | |
changeset 104 | 466a0df5c15a |
parent 0 | a41df078684a |
child 246 | 4a60358e2cbf |
permissions | -rw-r--r-- |
0 | 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\arm\uc_exe.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "u32std.h" |
|
19 |
#include <u32exec.h> |
|
20 |
#include <e32svr.h> |
|
21 |
||
22 |
GLREF_C TInt E32Main(); |
|
23 |
||
24 |
extern "C" { |
|
25 |
||
26 |
#if defined(__GCC32__) |
|
27 |
typedef void (*PFV)(); |
|
28 |
extern PFV __CTOR_LIST__[]; |
|
29 |
extern PFV __DTOR_LIST__[]; |
|
30 |
||
31 |
void globalDestructorFunc() |
|
32 |
{ |
|
33 |
TUint i=1; |
|
34 |
while (__DTOR_LIST__[i]) |
|
35 |
(*__DTOR_LIST__[i++])(); |
|
36 |
} |
|
37 |
||
38 |
void RunThread(TBool aNotFirst, SThreadCreateInfo& aInfo) |
|
39 |
{ |
|
40 |
SStdEpocThreadCreateInfo& cinfo = (SStdEpocThreadCreateInfo&)aInfo; |
|
41 |
||
42 |
#ifdef USE_INSTRUMENTED_HEAP |
|
43 |
cinfo.iFlags |= ETraceHeapAllocs; |
|
44 |
#elif defined(ENABLE_HEAP_MONITORING) |
|
45 |
cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory; |
|
46 |
#endif |
|
47 |
TInt r = UserHeap::SetupThreadHeap(aNotFirst, cinfo); |
|
48 |
||
49 |
if (r==KErrNone) |
|
50 |
r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc); |
|
51 |
||
52 |
if (r==KErrNone) |
|
53 |
{ |
|
54 |
if (aNotFirst) |
|
55 |
r = (*cinfo.iFunction)(cinfo.iPtr); |
|
56 |
else |
|
57 |
{ |
|
58 |
// Init statics for implicitly linked DLLs |
|
59 |
User::InitProcess(); |
|
60 |
||
61 |
// Init statics for EXE |
|
62 |
TUint i=1; |
|
63 |
while (__CTOR_LIST__[i]) |
|
64 |
(*__CTOR_LIST__[i++])(); |
|
65 |
||
66 |
r = E32Main(); |
|
67 |
} |
|
68 |
} |
|
69 |
User::Exit(r); |
|
70 |
} |
|
71 |
} |
|
72 |
||
104
466a0df5c15a
RVCT 4.0 support, gcce fixes (Bug 2283)
Chetan Kapoor <chetank@symbian.org>
parents:
0
diff
changeset
|
73 |
#elif defined(__EABI__) |
0 | 74 |
|
75 |
TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst); |
|
76 |
||
104
466a0df5c15a
RVCT 4.0 support, gcce fixes (Bug 2283)
Chetan Kapoor <chetank@symbian.org>
parents:
0
diff
changeset
|
77 |
__WEAK__ void run_static_dtors(void); |
0 | 78 |
|
79 |
void globalDestructorFunc() |
|
80 |
{ |
|
81 |
int call_static_dtors = (int)run_static_dtors; |
|
82 |
if (call_static_dtors) |
|
83 |
run_static_dtors(); |
|
84 |
} |
|
85 |
||
86 |
void RunThread(TBool aNotFirst, SThreadCreateInfo& aInfo) |
|
87 |
{ |
|
88 |
SStdEpocThreadCreateInfo& cinfo = (SStdEpocThreadCreateInfo&)aInfo; |
|
89 |
||
90 |
#ifdef USE_INSTRUMENTED_HEAP |
|
91 |
cinfo.iFlags |= ETraceHeapAllocs; |
|
92 |
#elif defined(ENABLE_HEAP_MONITORING) |
|
93 |
cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory; |
|
94 |
#endif |
|
95 |
TInt r = UserHeap::SetupThreadHeap(aNotFirst, cinfo); |
|
96 |
||
97 |
if (r==KErrNone) |
|
98 |
r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc); |
|
99 |
||
100 |
if (r==KErrNone) |
|
101 |
r = CallThrdProcEntry(cinfo.iFunction, cinfo.iPtr, aNotFirst); |
|
102 |
||
103 |
User::Exit(r); |
|
104 |
} |
|
105 |
} |
|
106 |
||
107 |
#else |
|
108 |
#error not supported |
|
109 |
#endif |