1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/compsupp/symaehabi/callfirstprocessfn.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,68 @@
1.4 +// Copyright (c) 2004-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 "ARM EABI LICENCE.txt"
1.8 +// which accompanies this distribution, and is available
1.9 +// in kernel/eka/compsupp.
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\compsupp\symaehabi\callfirstprocessfn.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include "unwind_env.h"
1.22 +#include "unwinder.h"
1.23 +#include "symbian_support.h"
1.24 +#include <e32panic.h>
1.25 +
1.26 +#ifdef __LEAVE_EQUALS_THROW__
1.27 +_LIT(KLitUser,"USER");
1.28 +#endif
1.29 +
1.30 +TInt E32Main();
1.31 +
1.32 +#ifdef __KERNEL_MODE__
1.33 +#error This file should not be compiled in kernel mode
1.34 +#endif
1.35 +
1.36 +extern "C" {
1.37 +
1.38 +void __cpp_initialize__aeabi_();
1.39 +void __DLL_Export_Table__();
1.40 +
1.41 +TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst)
1.42 + {
1.43 + TCppRTExceptionsGlobals aExceptionGlobals;
1.44 +
1.45 + if (!aNotFirst)
1.46 + {
1.47 + // Init statics for implicitly linked DLLs
1.48 + User::InitProcess();
1.49 +
1.50 + // Init statics for EXE
1.51 + //pick up export table if we're an exexp
1.52 + __DLL_Export_Table__();
1.53 + __cpp_initialize__aeabi_();
1.54 + }
1.55 +#ifdef __LEAVE_EQUALS_THROW__
1.56 + TInt r = KErrNone;
1.57 +
1.58 + try {
1.59 + r = aNotFirst ? (*aFn)(aPtr) : E32Main();
1.60 + }
1.61 + catch (XLeaveException&)
1.62 + {
1.63 + User::Panic(KLitUser, EUserLeaveWithoutTrap);
1.64 + }
1.65 +
1.66 + return r;
1.67 +#else
1.68 + return aNotFirst ? (*aFn)(aPtr) : E32Main();
1.69 +#endif
1.70 + }
1.71 +}