author | arunabha |
Thu, 19 Nov 2009 19:10:45 +0000 | |
branch | GCCE_COMPATIBILITY |
changeset 3 | 9a3ffdc955cd |
parent 0 | a41df078684a |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1996-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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\kernel\arm\k_entry.cia |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include <e32cia.h> |
|
19 |
#include <kernel/kernel.h> |
|
20 |
#include <arm_mem.h> |
|
21 |
||
22 |
#include "entry.h" |
|
23 |
||
24 |
extern "C" { |
|
25 |
||
26 |
extern void KernelMain(); |
|
27 |
||
28 |
||
29 |
/* |
|
30 |
* The main startup program |
|
31 |
* aRomHeader is address of ROM header passed in by bootstrap |
|
32 |
* aSuperPage is address of super page passed in by bootstrap |
|
33 |
* |
|
34 |
* *** NOTE *** |
|
35 |
* This is written in assembler in order that kc_exe.lib can be built entirely |
|
36 |
* from one source file. This is necessary to ensure that the vector table above |
|
37 |
* appears at the very beginning of the ekern.exe code section. |
|
38 |
* ************ |
|
39 |
*/ |
|
40 |
#if defined(__GCC32__) |
|
41 |
GLDEF_C __NAKED__ void _E32Startup(TLinAddr /*aRomHeader*/, TLinAddr /*aSuperPage*/) |
|
42 |
{ |
|
43 |
EKA2_ENTRY_POINT_VERSION_IDENTIFIER; // DUMMY INSTRUCTION TO INDICATE EKA2 ENTRY POINT |
|
44 |
asm("b 1f "); // branch over space for unique ID |
|
45 |
asm(".word 0 "); // padding |
|
46 |
||
47 |
asm(".word 0 "); // loader will replace with code seg unique ID |
|
48 |
// for RAM-loaded code segment |
|
49 |
// MUST BE AT OFFSET 12 FROM ENTRY POINT |
|
50 |
||
51 |
asm("1: "); |
|
52 |
asm("bl " CSM_ZN2PP20InitSuperPageFromRom); |
|
53 |
||
54 |
#ifdef __CPU_HAS_CP15_THREAD_ID_REG |
|
55 |
asm("mov r0, #0 "); |
|
56 |
SET_RWNO_TID(,r0); // initialise SubScheduler() pointer to 0 |
|
57 |
SET_RWRO_TID(,r0); |
|
58 |
SET_RWRW_TID(,r0); |
|
59 |
#endif |
|
60 |
||
61 |
asm("ldr r4, __CtorList "); |
|
62 |
||
63 |
asm("1: "); |
|
64 |
asm("ldr r0, [r4, #4]! "); |
|
65 |
asm("adr lr, 1b "); |
|
66 |
asm("cmp r0, #0 "); |
|
67 |
__JUMP(ne,r0); |
|
68 |
||
69 |
asm("b KernelMain "); |
|
70 |
||
71 |
asm("__CtorList: "); |
|
72 |
asm(".word __CTOR_LIST__ "); |
|
73 |
} |
|
3
9a3ffdc955cd
Bug 341 - [GCCE] Enabling support for gcce in cia files
arunabha
parents:
0
diff
changeset
|
74 |
#elif defined(__EABI__) |
0 | 75 |
void __DLL_Export_Table__(void); |
76 |
void __cpp_initialize__aeabi_(); |
|
77 |
||
78 |
// The compiler generates calls to this when it reckons a top-level construction |
|
79 |
// needs destruction. But the kernel never will need this so, define it as a nop |
|
80 |
void __record_needed_destruction (void * d){} |
|
81 |
// 2.1 calls __aeabi_atexit passing __dso_handle. This can be a dummy (i.e. just a label) |
|
82 |
||
3
9a3ffdc955cd
Bug 341 - [GCCE] Enabling support for gcce in cia files
arunabha
parents:
0
diff
changeset
|
83 |
__NAKED__ void __dso_handle(void) {} |
0 | 84 |
void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){} |
85 |
||
86 |
void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage); |
|
87 |
||
88 |
__NAKED__ void _E32Startup(TLinAddr aRomHeader, TLinAddr aSuperPage) |
|
89 |
{ |
|
90 |
EKA2_ENTRY_POINT_VERSION_IDENTIFIER; // DUMMY INSTRUCTION TO INDICATE EKA2 ENTRY POINT |
|
91 |
asm("b 1f "); |
|
92 |
asm(".word 0 "); // padding |
|
93 |
||
94 |
asm(".word 0 "); // loader will replace with code seg unique ID |
|
95 |
// for RAM-loaded code segment |
|
96 |
// MUST BE AT OFFSET 12 FROM ENTRY POINT |
|
97 |
asm("1: "); |
|
98 |
#ifdef __CPU_HAS_CP15_THREAD_ID_REG |
|
99 |
asm("mov r12, #0 "); |
|
100 |
SET_RWNO_TID(,r12); // initialise SubScheduler() pointer to 0 |
|
101 |
SET_RWRO_TID(,r12); |
|
102 |
SET_RWRW_TID(,r12); |
|
103 |
#endif |
|
104 |
asm("b _E32Startup_Body "); |
|
105 |
} |
|
106 |
||
107 |
GLDEF_C void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage) |
|
108 |
{ |
|
109 |
PP::InitSuperPageFromRom(aRomHeader, aSuperPage); |
|
110 |
||
111 |
// RVCT-specific initialisation |
|
112 |
||
113 |
// Make sure we get an export table |
|
114 |
__DLL_Export_Table__(); |
|
115 |
||
116 |
// Initialise static data |
|
117 |
__cpp_initialize__aeabi_(); |
|
118 |
||
119 |
KernelMain(); |
|
120 |
} |
|
121 |
#else |
|
122 |
#error Not supported |
|
123 |
#endif |
|
124 |
||
125 |
} |
|
126 |