kernel/eka/compsupp/rvct/rtraise.cpp
changeset 9 96e5fb8b040d
child 10 36bfc973b146
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <e32std.h>
       
    21 #include <signal.h> // Will be found among RVCT's header files.
       
    22 
       
    23 
       
    24 extern "C" EXPORT_C TInt __rt_raise(TInt signal, TInt type)
       
    25     {
       
    26     TExcType aExc = EExcGeneral;
       
    27 
       
    28     // Translate the signal into an EPOC exception.
       
    29     switch (signal)
       
    30         {
       
    31 	case SIGABRT : 
       
    32 	    aExc = EExcAbort;
       
    33 	    break;
       
    34 
       
    35 	case SIGFPE :
       
    36 	    switch (type)
       
    37 	        {
       
    38 		case DIVBYZERO :
       
    39 		    aExc = EExcAbort;
       
    40 		    break;
       
    41 		default:
       
    42 		    aExc = EExcFloatInvalidOperation;
       
    43 		}
       
    44 	    break;
       
    45 
       
    46 	case SIGILL :
       
    47 	    aExc = EExcCodeAbort;
       
    48 	    break;
       
    49 
       
    50 	case SIGINT :
       
    51 	    aExc = EExcUserInterrupt;
       
    52 	    break;
       
    53 
       
    54 	case SIGSEGV :
       
    55 	    aExc = EExcDataAbort;
       
    56 	    break;
       
    57 
       
    58 	case SIGTERM :
       
    59 	    aExc = EExcKill;
       
    60 	    break;
       
    61 	}
       
    62 
       
    63     User::RaiseException(aExc);
       
    64 
       
    65     return signal;
       
    66     }