kernel/eka/compsupp/rvct3_1/ucppinit.cpp
changeset 266 0008ccd16016
parent 259 57b9594f5772
child 272 70a6efdb753f
child 281 13fbfa31d2ba
equal deleted inserted replaced
259:57b9594f5772 266:0008ccd16016
     1 // Copyright (c) 2008-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 // This file is part of usrt.lib and ksrt.lib.
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 extern "C" {
       
    20 
       
    21 // This calls each of the compiler constructed functions referenced from pi_ctorvec.
       
    22 // These functions arrange to 'call' the appropriate constructor for the 'static' instance
       
    23 // (in fact the call may be inlined). If the class of the instance has a destructor then 
       
    24 // compiler records that this object needs 'destructing' at 'exit' time. It does this by 
       
    25 // calling the function __cxa_atexit. We provide our own definition of this.
       
    26 // 
       
    27 
       
    28 
       
    29 __asm void __cpp_initialize__aeabi_()
       
    30     {
       
    31     CODE32
       
    32 
       
    33     IMPORT |SHT$$INIT_ARRAY$$Base|  [WEAK]
       
    34     IMPORT |SHT$$INIT_ARRAY$$Limit| [WEAK]
       
    35 
       
    36     // Export std::nothrow from here.
       
    37     EXPORT    _ZSt7nothrow
       
    38 
       
    39     STMFD    r13!,{r3-r5,r14}
       
    40 
       
    41     LDR      r4,base
       
    42     LDR      r5,limit
       
    43     CMP      r4,r5
       
    44     
       
    45     // Exit if the array is empty.
       
    46     LDMEQFD  r13!,{r3-r5,pc}
       
    47 
       
    48 loop
       
    49 	LDR      r0,[r4,#0]
       
    50     ADD      r0,r0,r4
       
    51 #ifdef __MARM_ARMV4__
       
    52     ADR      r14,ret
       
    53     MOV      pc,r0
       
    54 #else
       
    55     BLX      r0
       
    56 #endif
       
    57 
       
    58 ret
       
    59     ADD      r4,r4,#4
       
    60     CMP      r4,r5
       
    61     BNE      loop
       
    62     LDMFD    r13!,{r3-r5,pc}
       
    63 
       
    64 base
       
    65     DCD    |SHT$$INIT_ARRAY$$Base|
       
    66 limit
       
    67     DCD    |SHT$$INIT_ARRAY$$Limit|
       
    68 
       
    69 // cheat - defining this here saves a whole 4 bytes!!! - value is never used
       
    70 _ZSt7nothrow
       
    71     }
       
    72 
       
    73 
       
    74 } // extern "C"
       
    75