]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePi/ModuleEntryPoint.S
Sync BaseTool trunk (version r2460) into EDKII BaseTools. The change mainly includes:
[mirror_edk2.git] / ArmPlatformPkg / PrePi / ModuleEntryPoint.S
index b5f2ee2e57a583ae4fdd8d9d1d6af6ef79bb7bcc..75728c983fef016ac03f33ad8cbcda7dc07d246b 100755 (executable)
@@ -21,7 +21,7 @@
 \r
 GCC_ASM_IMPORT(CEntryPoint)\r
 GCC_ASM_IMPORT(ArmReadMpidr)\r
-GCC_ASM_IMPORT(ArmIsMPCore)\r
+GCC_ASM_IMPORT(ArmIsMpCore)\r
 GCC_ASM_EXPORT(_ModuleEntryPoint)\r
 \r
 StartupAddr: .word    CEntryPoint\r
@@ -34,7 +34,7 @@ ASM_PFX(_ModuleEntryPoint):
   and   r5, r0, r1\r
 \r
 _SetSVCMode:\r
-  // Enter SVC mode\r
+  // Enter SVC mode, Disable FIQ and IRQ\r
   mov     r1, #0x13|0x80|0x40\r
   msr     CPSR_c, r1\r
 \r
@@ -48,9 +48,9 @@ _SetupStackPosition:
   add   r1, r1, r2      // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize\r
 \r
   // Calculate Top of the Firmware Device\r
-  LoadConstantToReg (FixedPcdGet32(PcdNormalFdBaseAddress), r2)\r
-  LoadConstantToReg (FixedPcdGet32(PcdNormalFdSize), r3)\r
-  add   r3, r3, r2      // r4 = FdTop = PcdNormalFdBaseAddress + PcdNormalFdSize\r
+  LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2)\r
+  LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3)\r
+  add   r3, r3, r2      // r4 = FdTop = PcdFdBaseAddress + PcdFdSize\r
 \r
   // UEFI Memory Size (stacks are allocated in this region)\r
   LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4)\r
@@ -77,7 +77,7 @@ _SetupStack:
 _GetStackBase:\r
   // Compute Base of Normal stacks for CPU Cores\r
   // Is it MpCore system\r
-  bl    ArmIsMPCore\r
+  bl    ASM_PFX(ArmIsMpCore)\r
   cmp   r0, #0\r
   // Case it is not an MP Core system. Just setup the primary core\r
   beq   _SetupUnicoreStack\r
@@ -98,7 +98,7 @@ _GetStackBaseMpCore:
 \r
   // Is it the Primary Core ?\r
   LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCore), r4)\r
-  cmp   r0, r4\r
+  cmp   r5, r4\r
   beq   _SetupPrimaryCoreStack\r
 \r
 _SetupSecondaryCoreStack:\r
@@ -127,20 +127,27 @@ _SetGlobals:
   mov   r3, sp\r
   mov   r2, #0x0\r
 _InitGlobals:\r
-  str   r2, [r3], #4\r
   cmp   r3, r1\r
-  blt   _InitGlobals\r
-\r
+  beq   _PrepareArguments\r
+  str   r2, [r3], #4\r
+  b     _InitGlobals\r
 \r
 _PrepareArguments:\r
+  mov   r0, r5\r
+  mov   r1, r6\r
+  mov   r2, r7\r
+  mov   r3, sp\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
+  ldr   r4, StartupAddr\r
 \r
   // Jump to PrePiCore C code\r
   //    r0 = MpId\r
   //    r1 = UefiMemoryBase\r
-  blx   r2\r
+  //    r2 = StacksBase\r
+  //    r3 = GlobalVariableBase\r
+  blx   r4\r
 \r
 _NeverReturn:\r
   b _NeverReturn\r