]> git.proxmox.com Git - mirror_edk2.git/blobdiff - 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
diff --git a/ArmEbPkg/Sec/ModuleEntryPoint.asm b/ArmEbPkg/Sec/ModuleEntryPoint.asm
new file mode 100755 (executable)
index 0000000..ef24524
--- /dev/null
@@ -0,0 +1,53 @@
+//------------------------------------------------------------------------------ \r
+//\r
+// Copyright (c) 2008-2009 Apple Inc. All rights reserved.\r
+//\r
+// All rights reserved. This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution.  The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//------------------------------------------------------------------------------\r
+\r
+#include <AsmMacroIoLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <AutoGen.h>\r
+  INCLUDE AsmMacroIoLib.inc\r
+  \r
+  IMPORT  CEntryPoint\r
+  EXPORT  _ModuleEntryPoint\r
+        \r
+  PRESERVE8\r
+  AREA    ModuleEntryPoint, CODE, READONLY\r
+  \r
+\r
+_ModuleEntryPoint\r
\r
+\r
+  //\r
+  // Set stack based on PCD values. Need to do it this way to make C code work \r
+  // when it runs from FLASH. \r
+  //  \r
+  LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2)    /* stack base arg2  */\r
+  LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3)    /* stack size arg3  */\r
+  add     r4, r2, r3\r
+\r
+  //Enter SVC mode and set up SVC stack pointer\r
+  mov     r0,#0x13|0x80|0x40\r
+  msr     CPSR_c,r0\r
+  mov     r13,r4\r
+\r
+  // Call C entry point\r
+  LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1)    /* memory size arg1          */\r
+  LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0)    /* memory size arg0         */\r
+  blx     CEntryPoint       /* Assume C code is thumb    */\r
+\r
+ShouldNeverGetHere\r
+  /* _CEntryPoint should never return */\r
+  b       ShouldNeverGetHere\r
+  \r
+  END\r
+\r