]> git.proxmox.com Git - mirror_edk2.git/blame - ArmRealViewEbPkg/SecForPei/Arm/ModuleEntryPoint.asm
Enhance EDKII Browser to support flexible HotKey setting.
[mirror_edk2.git] / ArmRealViewEbPkg / SecForPei / Arm / ModuleEntryPoint.asm
CommitLineData
1fde2f61 1//------------------------------------------------------------------------------ \r
2//\r
cf748a1a 3// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
1fde2f61 4//\r
cf748a1a 5// This program and the accompanying materials\r
1fde2f61 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
4ade93d0 16#include <Base.h>\r
1fde2f61 17#include <Library/PcdLib.h>\r
4ade93d0 18#include <ArmEb/ArmEb.h>\r
1fde2f61 19#include <AutoGen.h>\r
4ade93d0 20\r
1fde2f61 21 INCLUDE AsmMacroIoLib.inc\r
22 \r
23 IMPORT CEntryPoint\r
24 EXPORT _ModuleEntryPoint\r
25 \r
26 PRESERVE8\r
27 AREA ModuleEntryPoint, CODE, READONLY\r
28 \r
29\r
afdfe8f0 30StartupAddr DCD CEntryPoint\r
31\r
1fde2f61 32_ModuleEntryPoint\r
33 \r
4ade93d0 34 // Turn off remapping NOR to 0. We can now use DRAM in low memory\r
afdfe8f0 35 // CAN'T DO THIS HERE -- BRANCH FROM RESET VECTOR IS RELATIVE AND REMAINS IN REMAPPED NOR\r
36 //MmioOr32 (0x10001000 ,BIT8) //EB_SP810_CTRL_BASE\r
4ade93d0 37\r
38 // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
39 mrc p15, 0, r0, c1, c0, 2\r
afdfe8f0 40 orr r0, r0, #0x00f00000 // Enable VFP access (V* instructions)\r
4ade93d0 41 mcr p15, 0, r0, c1, c0, 2\r
42 mov r0, #0x40000000 // Set EN bit in FPEXC\r
364aa45e 43 mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r
4ade93d0 44 \r
afdfe8f0 45 // Set CPU vectors to 0 (which is currently flash)\r
4ade93d0 46 LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
47 mcr p15, 0, r0, c12, c0, 0\r
48 isb // Sync changes to control registers\r
49\r
1fde2f61 50 //\r
51 // Set stack based on PCD values. Need to do it this way to make C code work \r
52 // when it runs from FLASH. \r
53 // \r
afdfe8f0 54 LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r0) // temp ram base arg 0 TODO: change "stackbase" to "temprambase"\r
55 LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r1) // temp ram size arg 1\r
56 lsr r3, r1, #1 // r4 = size of temp mem / 2\r
57 add r3, r3, r0 // r2 = temp ram base + r4\r
58 mov r13, r3 // result: stack pointer = temp ram base + (size of temp mem / 2)\r
59 \r
60 // lr points to area in reset vector block containing PEI core address\r
61 ldr r2, [lr] // pei core arg 3\r
62 \r
63 // move sec startup address into a data register\r
64 // ensure we're jumping to FV version of the code (not boot remapped alias)\r
65 ldr r4, StartupAddr\r
1fde2f61 66\r
afdfe8f0 67 // jump to SEC C code\r
68 blx r4\r
69 \r
1fde2f61 70 // Call C entry point\r
afdfe8f0 71 // THIS DOESN'T WORK, WE NEED A LONG JUMP\r
72 // blx CEntryPoint \r
1fde2f61 73\r
74ShouldNeverGetHere\r
4ade93d0 75 // _CEntryPoint should never return \r
1fde2f61 76 b ShouldNeverGetHere\r
77 \r
78 END\r
79\r
4ade93d0 80\r