kernel/eka/compsupp/rvct/sftfpini.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 
       
    20 
       
    21 extern "C" {
       
    22   
       
    23 // TODO: Can this be removed?
       
    24 EXPORT_C  void _fp_init() 
       
    25     {
       
    26     }
       
    27   
       
    28 // TODO: Is this ever used?
       
    29 EXPORT_C TAny * __rt_fp_status_addr() 
       
    30     { 
       
    31     TAny* aTls = Dll::Tls();
       
    32 
       
    33     if (aTls)
       
    34         return aTls;
       
    35 
       
    36     // If this is the first time we are called we need to set up some TLS for
       
    37     // the FP status word.
       
    38 
       
    39     TUint32* aReg = (TUint32*)User::AllocZ(sizeof(TUint32));
       
    40 
       
    41     _LIT(KFpGeneralPanic, "FP Emulator");
       
    42 
       
    43     if (aReg) 
       
    44         {
       
    45         TInt r = Dll::SetTls(aReg);
       
    46         if (r==KErrNone)
       
    47             return aReg;
       
    48 
       
    49         // if we get here we really in trouble. Just Panic.
       
    50         User::Panic(KFpGeneralPanic, KErrGeneral);
       
    51         }
       
    52     else
       
    53         {
       
    54         // If we get here, we're toast anyway....
       
    55         User::Panic(KFpGeneralPanic, KErrNoMemory);
       
    56         }
       
    57 
       
    58     return 0;
       
    59     }
       
    60 
       
    61 }