os/kernelhwsrv/kernel/eka/compsupp/rvct3_1/ucppinit.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/compsupp/rvct3_1/ucppinit.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +// Copyright (c) 2008-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 +// This file is part of usrt.lib and ksrt.lib.
    1.18 +// 
    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 +
    1.31 +
    1.32 +__asm void __cpp_initialize__aeabi_()
    1.33 +    {
    1.34 +    CODE32
    1.35 +
    1.36 +    IMPORT |SHT$$INIT_ARRAY$$Base|  [WEAK]
    1.37 +    IMPORT |SHT$$INIT_ARRAY$$Limit| [WEAK]
    1.38 +
    1.39 +    // Export std::nothrow from here.
    1.40 +    EXPORT    _ZSt7nothrow
    1.41 +
    1.42 +    STMFD    r13!,{r3-r5,r14}
    1.43 +
    1.44 +    LDR      r4,base
    1.45 +    LDR      r5,limit
    1.46 +    CMP      r4,r5
    1.47 +    
    1.48 +    // Exit if the array is empty.
    1.49 +    LDMEQFD  r13!,{r3-r5,pc}
    1.50 +
    1.51 +loop
    1.52 +	LDR      r0,[r4,#0]
    1.53 +    ADD      r0,r0,r4
    1.54 +#ifdef __MARM_ARMV4__
    1.55 +    ADR      r14,ret
    1.56 +    MOV      pc,r0
    1.57 +#else
    1.58 +    BLX      r0
    1.59 +#endif
    1.60 +
    1.61 +ret
    1.62 +    ADD      r4,r4,#4
    1.63 +    CMP      r4,r5
    1.64 +    BNE      loop
    1.65 +    LDMFD    r13!,{r3-r5,pc}
    1.66 +
    1.67 +base
    1.68 +    DCD    |SHT$$INIT_ARRAY$$Base|
    1.69 +limit
    1.70 +    DCD    |SHT$$INIT_ARRAY$$Limit|
    1.71 +
    1.72 +// cheat - defining this here saves a whole 4 bytes!!! - value is never used
    1.73 +_ZSt7nothrow
    1.74 +    }
    1.75 +
    1.76 +
    1.77 +} // extern "C"
    1.78 +