]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S
Arm Packages: Fixed coding style/Line endings to follow EDK2 coding convention
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / PrePeiCoreEntryPoint.S
index cf9cb9f9ca51f207597187f1923a4b5dbecf2ab7..49174cc94207f2069b56f112a419b341265372bb 100644 (file)
@@ -1,65 +1,69 @@
-//
-//  Copyright (c) 2011, ARM Limited. All rights reserved.
-//  
-# This program and the accompanying materials                          
-#  are licensed and made available under the terms and conditions of the BSD License         
-#  which accompanies this distribution.  The full text of the license may be found at        
-#  http:#opensource.org/licenses/bsd-license.php                                            
-#
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
-#
-#
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-#start of the code section
-.text
-.align 3
-
-#global symbols referenced by this module
-GCC_ASM_IMPORT(CEntryPoint)
-
-StartupAddr: .word    CEntryPoint
-
-#make _ModuleEntryPoint as global
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-
-ASM_PFX(_ModuleEntryPoint):
-  # Identify CPU ID
-  mrc   p15, 0, r0, c0, c0, 5
-  and   r0, #0xf
-
-_SetupStack:
-  # Setup Stack for the 4 CPU cores
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackBase) ,r1)
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackSize) ,r2)
-  
-  mov     r3,r0         @ r3 = core_id
-  mul     r3,r3,r2      @ r3 = core_id * stack_size = offset from the stack base
-  add     r3,r3,r1      @ r3 = stack_base + offset
-  add     r3,r3,r2,LSR #1   @ r3 = stack_offset + (stack_size/2)   <-- the top half is for the heap
-  mov     sp, r3
-
-  # lr points to area in reset vector block containing PEI core address. lr needs to
-  # be saved from the beginning as the _ModuleEntryPoint could call helper functions
-  # that will overwrite 'lr'
-  LoadConstantToReg (FixedPcdGet32(PcdEmbeddedFdBaseAddress), r2)
-  add   r2, r2, #4
-  ldr   r1, [r2]
-
-  # move sec startup address into a data register
-  # ensure we're jumping to FV version of the code (not boot remapped alias)
-  ldr   r2, StartupAddr
-
-  # jump to SEC C code
-  #    r0 = core_id
-  #    r1 = pei_core_address
-  blx   r2
-
-#end of the file
-.end
+//\r
+//  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+//  \r
+//  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 <Base.h>\r
+#include <Library/PcdLib.h>\r
+#include <AutoGen.h>\r
+\r
+.text\r
+.align 3\r
+\r
+#global symbols referenced by this module\r
+GCC_ASM_IMPORT(CEntryPoint)\r
+\r
+StartupAddr: .word    CEntryPoint\r
+\r
+#make _ModuleEntryPoint as global\r
+GCC_ASM_EXPORT(_ModuleEntryPoint)\r
+\r
+\r
+ASM_PFX(_ModuleEntryPoint):\r
+  # Identify CPU ID\r
+  mrc   p15, 0, r0, c0, c0, 5\r
+  and   r0, #0xf\r
+\r
+_SetupStack:\r
+  # Setup Stack for the 4 CPU cores\r
+  LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackBase), r1)\r
+  LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackSize), r2)\r
+  \r
+  mov     r3,r0         @ r3 = core_id\r
+  mul     r3,r3,r2      @ r3 = core_id * stack_size = offset from the stack base\r
+  add     r3,r3,r1      @ r3 = stack_base + offset\r
+  add     r3,r3,r2,LSR #1   @ r3 = stack_offset + (stack_size/2)   <-- the top half is for the heap\r
+  mov     sp, r3\r
+\r
+  # Only allocate memory in top of the primary core stack\r
+  cmp   r0, #0\r
+  bne   _PrepareArguments\r
+\r
+_AllocateGlobalPeiVariables:\r
+  # Reserve top of the stack for Global PEI Variables (eg: PeiServicesTablePointer)\r
+  LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r1)\r
+  sub   sp, sp, r1\r
+\r
+_PrepareArguments:\r
+  # The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector\r
+  LoadConstantToReg (FixedPcdGet32(PcdNormalFvBaseAddress), r2)\r
+  add   r2, r2, #4\r
+  ldr   r1, [r2]\r
+\r
+  # move sec startup address into a data register\r
+  # ensure we're jumping to FV version of the code (not boot remapped alias)\r
+  ldr   r2, StartupAddr\r
+\r
+  # jump to PrePeiCore C code\r
+  #    r0 = core_id\r
+  #    r1 = pei_core_address\r
+  blx   r2\r