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