]>
Commit | Line | Data |
---|---|---|
1fde2f61 | 1 | //------------------------------------------------------------------------------ \r |
2 | //\r | |
3 | // Copyright (c) 2008-2009 Apple Inc. All rights reserved.\r | |
4 | //\r | |
5 | // All rights reserved. This program and the accompanying materials\r | |
6 | // are licensed and made available under the terms and conditions of the BSD License\r | |
7 | // which accompanies this distribution. The full text of the license may be found at\r | |
8 | // http://opensource.org/licenses/bsd-license.php\r | |
9 | //\r | |
10 | // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | //\r | |
13 | //------------------------------------------------------------------------------\r | |
14 | \r | |
15 | #include <AsmMacroIoLib.h>\r | |
16 | #include <Library/PcdLib.h>\r | |
17 | #include <AutoGen.h>\r | |
18 | INCLUDE AsmMacroIoLib.inc\r | |
19 | \r | |
20 | IMPORT CEntryPoint\r | |
21 | EXPORT _ModuleEntryPoint\r | |
22 | \r | |
23 | PRESERVE8\r | |
24 | AREA ModuleEntryPoint, CODE, READONLY\r | |
25 | \r | |
26 | \r | |
27 | _ModuleEntryPoint\r | |
28 | \r | |
29 | \r | |
30 | //\r | |
31 | // Set stack based on PCD values. Need to do it this way to make C code work \r | |
32 | // when it runs from FLASH. \r | |
33 | // \r | |
34 | LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) /* stack base arg2 */\r | |
35 | LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) /* stack size arg3 */\r | |
36 | add r4, r2, r3\r | |
37 | \r | |
38 | //Enter SVC mode and set up SVC stack pointer\r | |
39 | mov r0,#0x13|0x80|0x40\r | |
40 | msr CPSR_c,r0\r | |
41 | mov r13,r4\r | |
42 | \r | |
43 | // Call C entry point\r | |
44 | LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) /* memory size arg1 */\r | |
45 | LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) /* memory size arg0 */\r | |
46 | blx CEntryPoint /* Assume C code is thumb */\r | |
47 | \r | |
48 | ShouldNeverGetHere\r | |
49 | /* _CEntryPoint should never return */\r | |
50 | b ShouldNeverGetHere\r | |
51 | \r | |
52 | END\r | |
53 | \r |