os/kernelhwsrv/kernel/eka/compsupp/rvct3_1/rtraise.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 <e32std_private.h>
    20 #include <signal.h> // Will be found among RVCT's header files.
    21 
    22 
    23 extern "C" EXPORT_C TInt __rt_raise(TInt signal, TInt type)
    24     {
    25     TExcType aExc = EExcGeneral;
    26 
    27     // Translate the signal into an EPOC exception.
    28     switch (signal)
    29         {
    30 	case SIGABRT : 
    31 	    aExc = EExcAbort;
    32 	    break;
    33 
    34 	case SIGFPE :
    35 	    switch (type)
    36 	        {
    37 		case DIVBYZERO :
    38 		    aExc = EExcAbort;
    39 		    break;
    40 		default:
    41 		    aExc = EExcFloatInvalidOperation;
    42 		}
    43 	    break;
    44 
    45 	case SIGILL :
    46 	    aExc = EExcCodeAbort;
    47 	    break;
    48 
    49 	case SIGINT :
    50 	    aExc = EExcUserInterrupt;
    51 	    break;
    52 
    53 	case SIGSEGV :
    54 	    aExc = EExcDataAbort;
    55 	    break;
    56 
    57 	case SIGTERM :
    58 	    aExc = EExcKill;
    59 	    break;
    60 	}
    61 
    62     User::RaiseException(aExc);
    63 
    64     return signal;
    65     }
    66