]> git.proxmox.com Git - mirror_edk2.git/blame - ArmEbPkg/Sec/ModuleEntryPoint.S
Fixup to point to real RAM and NOR addressess.
[mirror_edk2.git] / ArmEbPkg / Sec / ModuleEntryPoint.S
CommitLineData
1fde2f61 1#------------------------------------------------------------------------------ \r
2#\r
4ade93d0 3# ARM EB Entry point. Reset vector in FV header will brach to\r
4# _ModuleEntryPoint. \r
5#\r
6# We use crazy macros, like LoadConstantToReg, since Xcode assembler \r
7# does not support = assembly syntax for ldr.\r
8#\r
cf748a1a 9# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
1fde2f61 10#\r
cf748a1a 11# This program and the accompanying materials\r
1fde2f61 12# are licensed and made available under the terms and conditions of the BSD License\r
13# which accompanies this distribution. The full text of the license may be found at\r
14# http://opensource.org/licenses/bsd-license.php\r
15#\r
16# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
17# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
18#\r
19#------------------------------------------------------------------------------\r
20\r
21#include <AsmMacroIoLib.h>\r
4ade93d0 22#include <Base.h>\r
1fde2f61 23#include <Library/PcdLib.h>\r
4ade93d0 24#include <ArmEb/ArmEb.h>\r
1fde2f61 25\r
26.text\r
27.align 3\r
28\r
29.globl ASM_PFX(CEntryPoint)\r
30.globl ASM_PFX(_ModuleEntryPoint)\r
31\r
32ASM_PFX(_ModuleEntryPoint):\r
4ade93d0 33 \r
34 // Turn off remapping NOR to 0. We can now use DRAM in low memory\r
35 MmioOr32 (EB_SP810_CTRL_BASE ,BIT8) \r
36\r
37 // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
38 mrc p15, 0, r0, c1, c0, 2\r
39 orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)\r
40 mcr p15, 0, r0, c1, c0, 2\r
41 mov r0, #0x40000000 // Set EN bit in FPEXC\r
42 msr FPEXC,r0\r
43 \r
44 \r
45 // Set CPU vectors to start of DRAM\r
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
50 // Fill vector table with branchs to current pc (jmp $)\r
51 // CPU DXE driver likes known values so it can let GDB stub hook vectors\r
52 ldr r1, ShouldNeverGetHere\r
53 movs r2, #0\r
54FillVectors\r
55 str r1, [r0, r2]\r
56 adds r2, r2, #4\r
57 cmp r2, #32\r
58 bne FillVectors\r
1fde2f61 59\r
60 //\r
61 // Set stack based on PCD values. Need to do it this way to make C code work \r
62 // when it runs from FLASH. \r
63 // \r
4ade93d0 64 LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2 \r
65 LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3 \r
1fde2f61 66 add r4, r2, r3\r
4ade93d0 67 mov r13, r4\r
1fde2f61 68\r
69 // Call C entry point\r
4ade93d0 70 LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1 \r
71 LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0 \r
72 blx ASM_PFX(CEntryPoint) \r
1fde2f61 73\r
74ShouldNeverGetHere:\r
4ade93d0 75 // _CEntryPoint should never return \r
1fde2f61 76 b ShouldNeverGetHere\r
77\r
4ade93d0 78 \r