kernel/eka/compsupp/gcce/ucppinit.cpp
branchGCC_SURGE
changeset 237 2604c9de91e0
equal deleted inserted replaced
236:7dc50dc94301 237:2604c9de91e0
       
     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 // Mike Kinghan, mikek@symbian.org, for Symbian Foundation.
       
    13 //
       
    14 // Description:
       
    15 // This file is part of usrt.lib and ksrt.lib.
       
    16 // 
       
    17 //
       
    18 
       
    19 
       
    20 extern "C" __NAKED__ void __cpp_initialize__aeabi_()
       
    21     {
       
    22     asm(".code 32");
       
    23 	asm(".weak SHT$$INIT_ARRAY$$Base");
       
    24 	asm(".weak SHT$$INIT_ARRAY$$Limit");
       
    25 	asm(".global _ZSt7nothrow");     
       
    26 	asm("STMFD    r13!,{r3-r5,r14}");
       
    27 	asm("LDR      r4,base");
       
    28 	asm("LDR      r5,limit");
       
    29 	asm("CMP      r4,r5");
       
    30     // Exit if the array is empty.
       
    31     asm("LDMEQFD  r13!,{r3-r5,pc}");
       
    32 	asm("loop:");
       
    33     asm("LDR      r0,[r4,#0]");
       
    34     asm("ADD      r0,r0,r4");
       
    35 #ifdef __MARM_ARMV4__
       
    36     asm("ADR      r14,ret");
       
    37     asm("MOV      pc,r0");
       
    38 #else
       
    39     asm("BLX      r0");
       
    40 #endif
       
    41 	asm("ret:");
       
    42     asm("ADD      r4,r4,#4");
       
    43     asm("CMP      r4,r5");
       
    44     asm("BNE      loop");
       
    45     asm("LDMFD    r13!,{r3-r5,pc}");
       
    46 	asm("base:");
       
    47     asm(".word SHT$$INIT_ARRAY$$Base");
       
    48 	asm("limit:");
       
    49     asm(".word SHT$$INIT_ARRAY$$Limit");
       
    50 	asm("_ZSt7nothrow:");
       
    51     }
       
    52