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