]>
Commit | Line | Data |
---|---|---|
1 | //------------------------------------------------------------------------------ \r | |
2 | //\r | |
3 | // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
4 | //\r | |
5 | // 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 <Base.h>\r | |
17 | #include <Library/PcdLib.h>\r | |
18 | #include <ArmEb/ArmEb.h>\r | |
19 | #include <AutoGen.h>\r | |
20 | \r | |
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 | |
30 | _ModuleEntryPoint\r | |
31 | \r | |
32 | // Turn off remapping NOR to 0. We can now use DRAM in low memory\r | |
33 | MmioOr32 (0x10001000 ,BIT8) //EB_SP810_CTRL_BASE\r | |
34 | \r | |
35 | // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r | |
36 | mrc p15, 0, r0, c1, c0, 2\r | |
37 | orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)\r | |
38 | mcr p15, 0, r0, c1, c0, 2\r | |
39 | mov r0, #0x40000000 // Set EN bit in FPEXC\r | |
40 | mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r | |
41 | \r | |
42 | // Set CPU vectors to start of DRAM\r | |
43 | LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r | |
44 | mcr p15, 0, r0, c12, c0, 0\r | |
45 | isb // Sync changes to control registers\r | |
46 | \r | |
47 | // Fill vector table with branchs to current pc (jmp $)\r | |
48 | // CPU DXE driver likes known values so it can let GDB stub hook vectors\r | |
49 | ldr r1, ShouldNeverGetHere\r | |
50 | movs r2, #0\r | |
51 | FillVectors\r | |
52 | str r1, [r0, r2]\r | |
53 | adds r2, r2, #4\r | |
54 | cmp r2, #32\r | |
55 | bne FillVectors\r | |
56 | \r | |
57 | //\r | |
58 | // Set stack based on PCD values. Need to do it this way to make C code work \r | |
59 | // when it runs from FLASH. \r | |
60 | // \r | |
61 | LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2 \r | |
62 | LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3 \r | |
63 | add r4, r2, r3\r | |
64 | mov r13, r4\r | |
65 | \r | |
66 | // Call C entry point\r | |
67 | LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1 \r | |
68 | LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0 \r | |
69 | blx CEntryPoint \r | |
70 | \r | |
71 | ShouldNeverGetHere\r | |
72 | // _CEntryPoint should never return \r | |
73 | b ShouldNeverGetHere\r | |
74 | \r | |
75 | END\r | |
76 | \r | |
77 | \r |