kernel/eka/compsupp/rvct3_1/ucppinit.cpp
changeset 9 96e5fb8b040d
child 10 36bfc973b146
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * This file is part of usrt.lib and ksrt.lib.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 extern "C" {
       
    22 
       
    23 // This calls each of the compiler constructed functions referenced from pi_ctorvec.
       
    24 // These functions arrange to 'call' the appropriate constructor for the 'static' instance
       
    25 // (in fact the call may be inlined). If the class of the instance has a destructor then 
       
    26 // compiler records that this object needs 'destructing' at 'exit' time. It does this by 
       
    27 // calling the function __cxa_atexit. We provide our own definition of this.
       
    28 // 
       
    29 
       
    30 
       
    31 __asm void __cpp_initialize__aeabi_()
       
    32     {
       
    33     CODE32
       
    34 
       
    35     IMPORT |SHT$$INIT_ARRAY$$Base|  [WEAK]
       
    36     IMPORT |SHT$$INIT_ARRAY$$Limit| [WEAK]
       
    37 
       
    38     // Export std::nothrow from here.
       
    39     EXPORT    _ZSt7nothrow
       
    40 
       
    41     STMFD    r13!,{r3-r5,r14}
       
    42 
       
    43     LDR      r4,base
       
    44     LDR      r5,limit
       
    45     CMP      r4,r5
       
    46     
       
    47     // Exit if the array is empty.
       
    48     LDMEQFD  r13!,{r3-r5,pc}
       
    49 
       
    50 loop
       
    51 	LDR      r0,[r4,#0]
       
    52     ADD      r0,r0,r4
       
    53 #ifdef __MARM_ARMV4__
       
    54     ADR      r14,ret
       
    55     MOV      pc,r0
       
    56 #else
       
    57     BLX      r0
       
    58 #endif
       
    59 
       
    60 ret
       
    61     ADD      r4,r4,#4
       
    62     CMP      r4,r5
       
    63     BNE      loop
       
    64     LDMFD    r13!,{r3-r5,pc}
       
    65 
       
    66 base
       
    67     DCD    |SHT$$INIT_ARRAY$$Base|
       
    68 limit
       
    69     DCD    |SHT$$INIT_ARRAY$$Limit|
       
    70 
       
    71 // cheat - defining this here saves a whole 4 bytes!!! - value is never used
       
    72 _ZSt7nothrow
       
    73     }
       
    74 
       
    75 
       
    76 } // extern "C"
       
    77