os/kernelhwsrv/kernel/eka/compsupp/rvct2_0/sftfpini.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "ARM EABI LICENCE.txt"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// in kernel/eka/compsupp.
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <e32std.h>
sl@0
    17
#include <e32std_private.h>
sl@0
    18
sl@0
    19
// support functions for ARM supplied softvfp compiler-helper functions
sl@0
    20
sl@0
    21
extern "C" {
sl@0
    22
sl@0
    23
//void __rt_fp_status_register_cleanup(TAny * aReg)
sl@0
    24
//	{
sl@0
    25
//	delete aReg;
sl@0
    26
//	}
sl@0
    27
sl@0
    28
// set up the fp status register 
sl@0
    29
EXPORT_C  void _fp_init(void) 
sl@0
    30
	{
sl@0
    31
	TUint32 * aReg = (TUint32 *)User::AllocZ(sizeof(TUint32));
sl@0
    32
	if (aReg) 
sl@0
    33
		{
sl@0
    34
		Dll::SetTls(aReg /*, __rt_fp_status_register_cleanup*/);
sl@0
    35
		}
sl@0
    36
	else
sl@0
    37
		{
sl@0
    38
		// This will force us to try again if we actually get an FP 
sl@0
    39
		// exception later.
sl@0
    40
		Dll::SetTls(0 /*, __rt_fp_status_register_cleanup*/);
sl@0
    41
		}
sl@0
    42
	}
sl@0
    43
  
sl@0
    44
EXPORT_C TAny * __rt_fp_status_addr(void) 
sl@0
    45
	{ 
sl@0
    46
	//return &__fp_status_register; 
sl@0
    47
	TAny* aTls = Dll::Tls();
sl@0
    48
	if (aTls)
sl@0
    49
		return aTls;
sl@0
    50
	// we obviously failed to set it up before. Try again, so we can
sl@0
    51
	// at least try to error meaningfully
sl@0
    52
	TUint32* aReg = (TUint32*)User::AllocZ(sizeof(TUint32));
sl@0
    53
	_LIT(KFpGeneralPanic, "FP Emulator");
sl@0
    54
	if (aReg) 
sl@0
    55
		{
sl@0
    56
		TInt r = Dll::SetTls(aReg /*, __rt_fp_status_register_cleanup*/);
sl@0
    57
		if (r==KErrNone)
sl@0
    58
			return aReg;
sl@0
    59
		// if we get here we really in trouble. Just Panic.
sl@0
    60
		User::Panic(KFpGeneralPanic, KErrGeneral);
sl@0
    61
		}
sl@0
    62
	else
sl@0
    63
		{
sl@0
    64
		// If we get here, we're toast anyway....
sl@0
    65
		User::Panic(KFpGeneralPanic, KErrNoMemory);
sl@0
    66
		}
sl@0
    67
	return 0;
sl@0
    68
	}
sl@0
    69
}
sl@0
    70