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