|
1 // Copyright (c) 2004-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 "ARM EABI LICENCE.txt" |
|
5 // which accompanies this distribution, and is available |
|
6 // in kernel/eka/compsupp. |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\compsupp\symaehabi\callfirstprocessfn.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include "unwind_env.h" |
|
19 #include "unwinder.h" |
|
20 #include "symbian_support.h" |
|
21 #include <e32panic.h> |
|
22 |
|
23 #ifdef __LEAVE_EQUALS_THROW__ |
|
24 _LIT(KLitUser,"USER"); |
|
25 #endif |
|
26 |
|
27 TInt E32Main(); |
|
28 |
|
29 #ifdef __KERNEL_MODE__ |
|
30 #error This file should not be compiled in kernel mode |
|
31 #endif |
|
32 |
|
33 extern "C" { |
|
34 |
|
35 void __cpp_initialize__aeabi_(); |
|
36 void __DLL_Export_Table__(); |
|
37 |
|
38 TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst) |
|
39 { |
|
40 TCppRTExceptionsGlobals aExceptionGlobals; |
|
41 |
|
42 if (!aNotFirst) |
|
43 { |
|
44 // Init statics for implicitly linked DLLs |
|
45 User::InitProcess(); |
|
46 |
|
47 // Init statics for EXE |
|
48 //pick up export table if we're an exexp |
|
49 __DLL_Export_Table__(); |
|
50 __cpp_initialize__aeabi_(); |
|
51 } |
|
52 #ifdef __LEAVE_EQUALS_THROW__ |
|
53 TInt r = KErrNone; |
|
54 |
|
55 try { |
|
56 r = aNotFirst ? (*aFn)(aPtr) : E32Main(); |
|
57 } |
|
58 catch (XLeaveException&) |
|
59 { |
|
60 User::Panic(KLitUser, EUserLeaveWithoutTrap); |
|
61 } |
|
62 |
|
63 return r; |
|
64 #else |
|
65 return aNotFirst ? (*aFn)(aPtr) : E32Main(); |
|
66 #endif |
|
67 } |
|
68 } |