sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "ARM EABI LICENCE.txt" sl@0: // which accompanies this distribution, and is available sl@0: // in kernel/eka/compsupp. sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // function the runtime can call to 'raise an exception' sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include // get from %ARMINC% sl@0: sl@0: extern "C" { sl@0: sl@0: EXPORT_C TInt __rt_raise(TInt signal, TInt type) sl@0: { sl@0: TExcType aExc = EExcGeneral; sl@0: // translate signal into EPOC exception sl@0: switch (signal) sl@0: { sl@0: case SIGABRT : sl@0: aExc = EExcAbort; sl@0: break; sl@0: case SIGFPE : sl@0: switch (type) sl@0: { sl@0: case DIVBYZERO : sl@0: aExc = EExcAbort; sl@0: break; sl@0: default: sl@0: aExc = EExcFloatInvalidOperation; sl@0: } sl@0: break; sl@0: case SIGILL : sl@0: aExc = EExcCodeAbort; sl@0: break; sl@0: case SIGINT : sl@0: aExc = EExcUserInterrupt; sl@0: break; sl@0: case SIGSEGV : sl@0: aExc = EExcDataAbort; sl@0: break; sl@0: case SIGTERM : sl@0: aExc = EExcKill; sl@0: break; sl@0: } sl@0: // yuk. Introduces dependendcy on EUSER!! sl@0: User::RaiseException(aExc); sl@0: return signal; sl@0: } sl@0: } sl@0: