1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/compsupp/rvct2_1/ucppinit_aeabi.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,136 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "ARM EABI LICENCE.txt"
1.8 +// which accompanies this distribution, and is available
1.9 +// in kernel/eka/compsupp.
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// toplevel initialization/destruction routines for 'user side' code compiled
1.18 +// with the ARMCC EABI compiler. intended for static linking
1.19 +//
1.20 +//
1.21 +
1.22 +extern "C" {
1.23 +
1.24 +// This calls each of the compiler constructed functions referenced from pi_ctorvec.
1.25 +// These functions arrange to 'call' the appropriate constructor for the 'static' instance
1.26 +// (in fact the call may be inlined). If the class of the instance has a destructor then
1.27 +// compiler records that this object needs 'destructing' at 'exit' time. It does this by
1.28 +// calling the function __cxa_atexit. We provide our own definition of this.
1.29 +//
1.30 +// This is the EABI compliant version - it uses .init_array rather than C$$pi_ctorvec
1.31 +// which means we need to do via assembler :-(
1.32 +
1.33 +#ifdef __thumb
1.34 + __asm void __cpp_initialize__aeabi_(void)
1.35 + {
1.36 + CODE16
1.37 +#ifndef _NO_FP
1.38 + IMPORT _fp_init [WEAK]
1.39 +#endif
1.40 + IMPORT |.init_array$$Base| [WEAK]
1.41 + IMPORT |.init_array$$Limit| [WEAK]
1.42 +
1.43 + // export std::nothrow from here
1.44 + EXPORT _ZSt7nothrow
1.45 +
1.46 +#ifndef _NO_FP
1.47 + LDR r0,fpinit
1.48 +#endif
1.49 + PUSH {r4-r6,r14}
1.50 +#ifndef _NO_FP
1.51 + CMP r0,#0
1.52 + BEQ skip
1.53 + BL _fp_init ;
1.54 +skip
1.55 +#endif
1.56 + LDR r4,base
1.57 + LDR r5,limit
1.58 + B check
1.59 +loop
1.60 + LDR r0,[r4,#0]
1.61 + ADD r0,r0,r4
1.62 +
1.63 + BLX r0
1.64 + ADD r4,#4
1.65 +check
1.66 + CMP r4,r5
1.67 + BCC loop
1.68 + POP {r4-r6,pc}
1.69 +
1.70 +#ifndef _NO_FP
1.71 +fpinit
1.72 + DCD _fp_init
1.73 +#endif
1.74 +
1.75 +// cheat - saved a whole 4 bytes!!! - value is never user
1.76 +_ZSt7nothrow
1.77 +base
1.78 + DCD |.init_array$$Base|
1.79 +limit
1.80 + DCD |.init_array$$Limit|
1.81 +
1.82 + }
1.83 +
1.84 +#else
1.85 + __asm void __cpp_initialize__aeabi_(void)
1.86 + {
1.87 + CODE32
1.88 +#ifndef _NO_FP
1.89 + IMPORT _fp_init [WEAK]
1.90 +#endif
1.91 + IMPORT |.init_array$$Base| [WEAK]
1.92 + IMPORT |.init_array$$Limit| [WEAK]
1.93 +
1.94 + // export std::nothrow from here
1.95 + EXPORT _ZSt7nothrow
1.96 +
1.97 +#ifndef _NO_FP
1.98 + LDR r0, fpinit
1.99 +#endif
1.100 + STMFD r13!,{r3-r5,r14}
1.101 +#ifndef _NO_FP
1.102 + CMP r0, #0
1.103 + BEQ skip
1.104 + BL _fp_init
1.105 +skip
1.106 +#endif
1.107 + LDR r4,base
1.108 + LDR r5,limit
1.109 + CMP r4,r5
1.110 + LDMEQFD r13!,{r3-r5,pc}
1.111 +loop
1.112 + LDR r0,[r4,#0]
1.113 + ADR r14,ret
1.114 + ADD r0,r0,r4
1.115 + MOV pc,r0
1.116 +ret
1.117 + ADD r4,r4,#4
1.118 + CMP r4,r5
1.119 + BNE loop
1.120 + LDMFD r13!,{r3-r5,pc}
1.121 +
1.122 +#ifndef _NO_FP
1.123 +fpinit
1.124 + DCD _fp_init
1.125 +#endif
1.126 +
1.127 +base
1.128 + DCD |.init_array$$Base|
1.129 +limit
1.130 + DCD |.init_array$$Limit|
1.131 +
1.132 +// cheat - defining this here saves a whole 4 bytes!!! - value is never user
1.133 +_ZSt7nothrow
1.134 +
1.135 + }
1.136 +#endif
1.137 +
1.138 +}
1.139 +