kernel/eka/compsupp/rvct/rtraise.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2008-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 // This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32std.h>
       
    19 #include <signal.h> // Will be found among RVCT's header files.
       
    20 
       
    21 
       
    22 extern "C" EXPORT_C TInt __rt_raise(TInt signal, TInt type)
       
    23     {
       
    24     TExcType aExc = EExcGeneral;
       
    25 
       
    26     // Translate the signal into an EPOC exception.
       
    27     switch (signal)
       
    28         {
       
    29 	case SIGABRT : 
       
    30 	    aExc = EExcAbort;
       
    31 	    break;
       
    32 
       
    33 	case SIGFPE :
       
    34 	    switch (type)
       
    35 	        {
       
    36 		case DIVBYZERO :
       
    37 		    aExc = EExcAbort;
       
    38 		    break;
       
    39 		default:
       
    40 		    aExc = EExcFloatInvalidOperation;
       
    41 		}
       
    42 	    break;
       
    43 
       
    44 	case SIGILL :
       
    45 	    aExc = EExcCodeAbort;
       
    46 	    break;
       
    47 
       
    48 	case SIGINT :
       
    49 	    aExc = EExcUserInterrupt;
       
    50 	    break;
       
    51 
       
    52 	case SIGSEGV :
       
    53 	    aExc = EExcDataAbort;
       
    54 	    break;
       
    55 
       
    56 	case SIGTERM :
       
    57 	    aExc = EExcKill;
       
    58 	    break;
       
    59 	}
       
    60 
       
    61     User::RaiseException(aExc);
       
    62 
       
    63     return signal;
       
    64     }