]>
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 | \r | |
18 | .text\r | |
19 | .align 3\r | |
20 | \r | |
21 | .globl ASM_PFX(CEntryPoint)\r | |
22 | .globl ASM_PFX(_ModuleEntryPoint)\r | |
23 | \r | |
24 | ASM_PFX(_ModuleEntryPoint):\r | |
25 | \r | |
26 | //\r | |
27 | // Set stack based on PCD values. Need to do it this way to make C code work \r | |
28 | // when it runs from FLASH. \r | |
29 | // \r | |
30 | LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) /* stack base arg2 */\r | |
31 | LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) /* stack size arg3 */\r | |
32 | add r4, r2, r3\r | |
33 | \r | |
34 | //Enter SVC mode and set up SVC stack pointer\r | |
35 | mov r0,#0x13|0x80|0x40\r | |
36 | msr CPSR_c,r0\r | |
37 | sub r4, r4, #0x400\r | |
38 | mov r13,r4\r | |
39 | \r | |
40 | // Call C entry point\r | |
41 | LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) /* memory size arg1 */\r | |
42 | LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) /* memory size arg0 */\r | |
43 | \r | |
44 | blx ASM_PFX(CEntryPoint) /* Assume C code is ARM */\r | |
45 | \r | |
46 | ShouldNeverGetHere:\r | |
47 | /* _CEntryPoint should never return */\r | |
48 | b ShouldNeverGetHere\r | |
49 | \r | |
50 | \r |