os/kernelhwsrv/kernel/eka/compsupp/rvct2_2/rtraise.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2001-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 // function the runtime can call to 'raise an exception'
    15 // 
    16 //
    17 
    18 #include <e32std.h>
    19 #include <e32std_private.h>
    20 #include <signal.h> // get from %ARMINC%
    21 
    22 extern "C" {
    23 
    24 EXPORT_C TInt __rt_raise(TInt signal, TInt type)
    25     {
    26     TExcType aExc = EExcGeneral;
    27     // translate signal into EPOC exception
    28     switch (signal)
    29         {
    30 	case SIGABRT : 
    31 	    aExc = EExcAbort;
    32 	    break;
    33 	case SIGFPE :
    34 	    switch (type)
    35 	        {
    36 		case DIVBYZERO :
    37 		    aExc = EExcAbort;
    38 		    break;
    39 		default:
    40 		    aExc = EExcFloatInvalidOperation;
    41 		}
    42 	    break;
    43 	case SIGILL :
    44 	    aExc = EExcCodeAbort;
    45 	    break;
    46 	case SIGINT :
    47 	    aExc = EExcUserInterrupt;
    48 	    break;
    49 	case SIGSEGV :
    50 	    aExc = EExcDataAbort;
    51 	    break;
    52 	case SIGTERM :
    53 	    aExc = EExcKill;
    54 	    break;
    55 	}
    56     // yuk. Introduces dependendcy on EUSER!!
    57     User::RaiseException(aExc);
    58     return signal;
    59     }
    60 }
    61