sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "ARM EABI LICENCE.txt" sl@0: // which accompanies this distribution, and is available sl@0: // in kernel/eka/compsupp. sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // support functions for ARM supplied softvfp compiler-helper functions sl@0: sl@0: extern "C" { sl@0: sl@0: //void __rt_fp_status_register_cleanup(TAny * aReg) sl@0: // { sl@0: // delete aReg; sl@0: // } sl@0: sl@0: // set up the fp status register sl@0: EXPORT_C void _fp_init(void) sl@0: { sl@0: TUint32 * aReg = (TUint32 *)User::AllocZ(sizeof(TUint32)); sl@0: if (aReg) sl@0: { sl@0: Dll::SetTls(aReg /*, __rt_fp_status_register_cleanup*/); sl@0: } sl@0: else sl@0: { sl@0: // This will force us to try again if we actually get an FP sl@0: // exception later. sl@0: Dll::SetTls(0 /*, __rt_fp_status_register_cleanup*/); sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TAny * __rt_fp_status_addr(void) sl@0: { sl@0: //return &__fp_status_register; sl@0: TAny* aTls = Dll::Tls(); sl@0: if (aTls) sl@0: return aTls; sl@0: // we obviously failed to set it up before. Try again, so we can sl@0: // at least try to error meaningfully sl@0: TUint32* aReg = (TUint32*)User::AllocZ(sizeof(TUint32)); sl@0: _LIT(KFpGeneralPanic, "FP Emulator"); sl@0: if (aReg) sl@0: { sl@0: TInt r = Dll::SetTls(aReg /*, __rt_fp_status_register_cleanup*/); sl@0: if (r==KErrNone) sl@0: return aReg; sl@0: // if we get here we really in trouble. Just Panic. sl@0: User::Panic(KFpGeneralPanic, KErrGeneral); sl@0: } sl@0: else sl@0: { sl@0: // If we get here, we're toast anyway.... sl@0: User::Panic(KFpGeneralPanic, KErrNoMemory); sl@0: } sl@0: return 0; sl@0: } sl@0: } sl@0: