kernel/eka/compsupp/rvct2_1/sftfpini.cpp
changeset 9 96e5fb8b040d
child 10 36bfc973b146
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     1 /*
       
     2 * Copyright (c) 2002-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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <e32std_private.h>
       
    21 
       
    22 // support functions for ARM supplied softvfp compiler-helper functions
       
    23 
       
    24 extern "C" {
       
    25 
       
    26 //void __rt_fp_status_register_cleanup(TAny * aReg)
       
    27 //	{
       
    28 //	delete aReg;
       
    29 //	}
       
    30 
       
    31 // set up the fp status register 
       
    32 EXPORT_C  void _fp_init(void) 
       
    33 	{
       
    34 	TUint32 * aReg = (TUint32 *)User::AllocZ(sizeof(TUint32));
       
    35 	if (aReg) 
       
    36 		{
       
    37 		Dll::SetTls(aReg /*, __rt_fp_status_register_cleanup*/);
       
    38 		}
       
    39 	else
       
    40 		{
       
    41 		// This will force us to try again if we actually get an FP 
       
    42 		// exception later.
       
    43 		Dll::SetTls(0 /*, __rt_fp_status_register_cleanup*/);
       
    44 		}
       
    45 	}
       
    46   
       
    47 EXPORT_C TAny * __rt_fp_status_addr(void) 
       
    48 	{ 
       
    49 	//return &__fp_status_register; 
       
    50 	TAny* aTls = Dll::Tls();
       
    51 	if (aTls)
       
    52 		return aTls;
       
    53 	// we obviously failed to set it up before. Try again, so we can
       
    54 	// at least try to error meaningfully
       
    55 	TUint32* aReg = (TUint32*)User::AllocZ(sizeof(TUint32));
       
    56 	_LIT(KFpGeneralPanic, "FP Emulator");
       
    57 	if (aReg) 
       
    58 		{
       
    59 		TInt r = Dll::SetTls(aReg /*, __rt_fp_status_register_cleanup*/);
       
    60 		if (r==KErrNone)
       
    61 			return aReg;
       
    62 		// if we get here we really in trouble. Just Panic.
       
    63 		User::Panic(KFpGeneralPanic, KErrGeneral);
       
    64 		}
       
    65 	else
       
    66 		{
       
    67 		// If we get here, we're toast anyway....
       
    68 		User::Panic(KFpGeneralPanic, KErrNoMemory);
       
    69 		}
       
    70 	return 0;
       
    71 	}
       
    72 }
       
    73