Update contrib.
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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\nkern\arm\nk_entry.cia
24 #ifndef EKA2_ENTRY_POINT_VERSION_IDENTIFIER
25 #define EKA2_ENTRY_POINT_VERSION_IDENTIFIER \
26 asm("tst pc, #%a0" : : "i" ((TInt)0) )
31 extern void HwInit0();
32 extern void KernelMain();
33 extern TLinAddr RomHeaderAddress;
34 extern TLinAddr SuperPageAddress;
38 * The main startup program
39 * aRomHeader is address of ROM header passed in by bootstrap
40 * aSuperPage is address of super page passed in by bootstrap
43 * This is written in assembler in order that nk_exe.lib can be built entirely
44 * from one source file. This is necessary to ensure that the vector table above
45 * appears at the very beginning of the ekern.exe code section.
48 #if defined(__GCC32__)
49 GLDEF_C __NAKED__ void _E32Startup(TLinAddr /*aRomHeader*/, TLinAddr /*aSuperPage*/)
51 EKA2_ENTRY_POINT_VERSION_IDENTIFIER; // DUMMY INSTRUCTION TO INDICATE EKA2 ENTRY POINT
52 asm("ldr r2, __RomHeaderAddress ");
53 asm("b 1f "); // branch over space for unique ID
55 asm(".word 0 "); // loader will replace with code seg unique ID
56 // for RAM-loaded code segment
57 // MUST BE AT OFFSET 12 FROM ENTRY POINT
60 asm("ldr r3, __SuperPage ");
66 asm("ldr r4, __CtorList ");
69 asm("ldr r0, [r4, #4]! ");
76 asm("__RomHeaderAddress: ");
77 asm(".word RomHeaderAddress ");
79 asm(".word SuperPageAddress ");
81 asm(".word __CTOR_LIST__ ");
83 #elif defined(__ARMCC__)
84 void __DLL_Export_Table__(void);
85 void __cpp_initialize__aeabi_();
87 // The compiler generates calls to this when it reckons a top-level construction
88 // needs destruction. But the kernel never will need this so, define it as a nop
89 void __record_needed_destruction (void * d){}
90 // 2.1 calls __aeabi_atexit passing __dso_handle. This can be a dummy (i.e. just a label)
92 __asm void __dso_handle(void) {}
93 void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){}
95 void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage);
97 __NAKED__ void _E32Startup(TLinAddr aRomHeader, TLinAddr aSuperPage)
99 EKA2_ENTRY_POINT_VERSION_IDENTIFIER; // DUMMY INSTRUCTION TO INDICATE EKA2 ENTRY POINT
100 asm("b _E32Startup_Body ");
101 asm(".word 0 "); // padding
103 asm(".word 0 "); // loader will replace with code seg unique ID
104 // for RAM-loaded code segment
105 // MUST BE AT OFFSET 12 FROM ENTRY POINT
108 GLDEF_C void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage)
110 RomHeaderAddress = aRomHeader;
111 SuperPageAddress = aSuperPage;
114 // RVCT specific initialization
116 // Make sure we get an export table
117 __DLL_Export_Table__();
119 // Initialise static data
120 __cpp_initialize__aeabi_();