sl@0: // Copyright (c) 2003-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: // toplevel initialization/destruction routines for 'user side' code compiled sl@0: // with the ARMCC EABI compiler. intended for static linking sl@0: // The code supports 2.2 both bpabi and non-bpabi. The values in .init_array are sl@0: // pointers in both environments, so the library is common to both. sl@0: // sl@0: // sl@0: sl@0: extern "C" { sl@0: sl@0: // This calls each of the compiler constructed functions referenced from pi_ctorvec. sl@0: // These functions arrange to 'call' the appropriate constructor for the 'static' instance sl@0: // (in fact the call may be inlined). If the class of the instance has a destructor then sl@0: // compiler records that this object needs 'destructing' at 'exit' time. It does this by sl@0: // calling the function __cxa_atexit. We provide our own definition of this. sl@0: // sl@0: sl@0: #ifdef __thumb sl@0: __asm void __cpp_initialize__aeabi_(void) sl@0: { sl@0: CODE16 sl@0: #ifndef _NO_FP sl@0: IMPORT _fp_init [WEAK] sl@0: #endif sl@0: IMPORT |SHT$$INIT_ARRAY$$Base| [WEAK] sl@0: IMPORT |SHT$$INIT_ARRAY$$Limit| [WEAK] sl@0: sl@0: // export std::nothrow from here sl@0: EXPORT _ZSt7nothrow sl@0: sl@0: #ifndef _NO_FP sl@0: LDR r0,fpinit sl@0: #endif sl@0: PUSH {r4-r6,r14} sl@0: #ifndef _NO_FP sl@0: CMP r0,#0 sl@0: BEQ skip sl@0: BL _fp_init ; sl@0: skip sl@0: #endif sl@0: LDR r4,base sl@0: LDR r5,limit sl@0: B check sl@0: loop sl@0: LDR r0,[r4,#0] sl@0: sl@0: BLX r0 sl@0: ADD r4,#4 sl@0: check sl@0: CMP r4,r5 sl@0: BCC loop sl@0: POP {r4-r6,pc} sl@0: sl@0: #ifndef _NO_FP sl@0: ALIGN 4 sl@0: fpinit sl@0: DCD _fp_init sl@0: #endif sl@0: sl@0: // cheat - saved a whole 4 bytes!!! - value is never used sl@0: _ZSt7nothrow sl@0: base sl@0: DCD |SHT$$INIT_ARRAY$$Base| sl@0: limit sl@0: DCD |SHT$$INIT_ARRAY$$Limit| sl@0: sl@0: } sl@0: sl@0: #else sl@0: __asm void __cpp_initialize__aeabi_(void) sl@0: { sl@0: CODE32 sl@0: #ifndef _NO_FP sl@0: IMPORT _fp_init [WEAK] sl@0: #endif sl@0: IMPORT |SHT$$INIT_ARRAY$$Base| [WEAK] sl@0: IMPORT |SHT$$INIT_ARRAY$$Limit| [WEAK] sl@0: sl@0: // export std::nothrow from here sl@0: EXPORT _ZSt7nothrow sl@0: sl@0: #ifndef _NO_FP sl@0: LDR r0, fpinit sl@0: #endif sl@0: STMFD r13!,{r3-r5,r14} sl@0: #ifndef _NO_FP sl@0: CMP r0, #0 sl@0: BEQ skip sl@0: BL _fp_init sl@0: skip sl@0: #endif sl@0: LDR r4,base sl@0: LDR r5,limit sl@0: CMP r4,r5 sl@0: LDMEQFD r13!,{r3-r5,pc} sl@0: loop sl@0: LDR r0,[r4,#0] sl@0: #ifdef __MARM_ARMV4__ sl@0: ADR r14,ret sl@0: MOV pc,r0 sl@0: #else sl@0: BLX r0 sl@0: #endif sl@0: ret sl@0: ADD r4,r4,#4 sl@0: CMP r4,r5 sl@0: BNE loop sl@0: LDMFD r13!,{r3-r5,pc} sl@0: sl@0: #ifndef _NO_FP sl@0: fpinit sl@0: DCD _fp_init sl@0: #endif sl@0: sl@0: base sl@0: DCD |SHT$$INIT_ARRAY$$Base| sl@0: limit sl@0: DCD |SHT$$INIT_ARRAY$$Limit| sl@0: sl@0: // cheat - defining this here saves a whole 4 bytes!!! - value is never used sl@0: _ZSt7nothrow sl@0: sl@0: } sl@0: #endif sl@0: sl@0: }