#\r
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+# Copyright (c) 2016, Linaro 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
#\r
\r
#include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm64LinuxMagic:\r
- .byte 0x41, 0x52, 0x4d, 0x64\r
\r
// VOID\r
// ArmPlatformPeiBootAction (\r
// VOID *DeviceTreeBaseAddress, // passed by loader in x0\r
// VOID *ImageBase // passed by FDF trampoline in x1\r
// );\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
//\r
// If we are booting from RAM using the Linux kernel boot protocol, x0 will\r
// point to the DTB image in memory. Otherwise, use the default value defined\r
.Lout:\r
ret x29\r
\r
+.LArm64LinuxMagic:\r
+ .byte 0x41, 0x52, 0x4d, 0x64\r
+\r
//UINTN\r
//ArmPlatformGetPrimaryCoreMpId (\r
// VOID\r
// );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
- ldrh w0, [x0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+ MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
ret\r
\r
//UINTN\r
//ArmPlatformIsPrimaryCore (\r
// IN UINTN MpId\r
// );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
mov x0, #1\r
ret\r
\r
// IN UINTN MpId\r
// );\r
// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
and x1, x0, #ARM_CORE_MASK\r
and x0, x0, #ARM_CLUSTER_MASK\r
add x0, x1, x0, LSR #6\r
//GetPhysAddrTop (\r
// VOID\r
// );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
mrs x0, id_aa64mmfr0_el1\r
adr x1, .LPARanges\r
and x0, x0, #7\r
#\r
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-# Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+# Copyright (c) 2014-2016, Linaro 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
#\r
\r
#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm32LinuxMagic:\r
- .byte 0x18, 0x28, 0x6f, 0x01\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
//\r
// If we are booting from RAM using the Linux kernel boot protocol, r0 will\r
// point to the DTB image in memory. Otherwise, use the default value defined\r
//\r
teq r0, #0\r
bne 0f\r
- ldr r0, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+ LDRL (r0, PcdGet64 (PcdDeviceTreeInitialBaseAddress))\r
\r
0:mov r11, r14 // preserve LR\r
mov r10, r0 // preserve DTB pointer\r
// to the actual relocated value, and add the shift of PcdFdBaseAddress to\r
// PcdFvBaseAddress as well\r
//\r
- ldr r8, =PcdGet64 (PcdFdBaseAddress)\r
- ldr r7, =PcdGet64 (PcdFvBaseAddress)\r
+ ADRL (r8, PcdGet64 (PcdFdBaseAddress))\r
+ ADRL (r7, PcdGet64 (PcdFvBaseAddress))\r
ldr r6, [r8]\r
ldr r5, [r7]\r
sub r5, r5, r6\r
// encountered. Since we are calling a C function, use the window at the\r
// beginning of the FD image as a temp stack.\r
//\r
- ldr r1, =PcdGet64 (PcdSystemMemoryBase)\r
- ldr r2, =PcdGet64 (PcdSystemMemorySize)\r
+ ADRL (r1, PcdGet64 (PcdSystemMemoryBase))\r
+ ADRL (r2, PcdGet64 (PcdSystemMemorySize))\r
mov sp, r5\r
bl FindMemnode\r
teq r0, #0\r
// image header at the base of this image (defined in the FDF), and record the\r
// pointer in PcdDeviceTreeInitialBaseAddress.\r
//\r
- ldr r8, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+ ADRL (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress))\r
add r9, r9, #0x40\r
str r9, [r8]\r
\r
.Lout:\r
bx r11\r
\r
+.LArm32LinuxMagic:\r
+ .byte 0x18, 0x28, 0x6f, 0x01\r
+\r
//UINTN\r
//ArmPlatformGetPrimaryCoreMpId (\r
// VOID\r
// );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
- ldr r0, [r0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+ MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
bx lr\r
\r
//UINTN\r
//ArmPlatformIsPrimaryCore (\r
// IN UINTN MpId\r
// );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
mov r0, #1\r
bx lr\r
\r
// IN UINTN MpId\r
// );\r
// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
and r1, r0, #ARM_CORE_MASK\r
and r0, r0, #ARM_CLUSTER_MASK\r
add r0, r1, r0, LSR #6\r
//GetPhysAddrTop (\r
// VOID\r
// );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
mov r0, #0x00000000\r
mov r1, #0x10000\r
bx lr\r
-\r
#\r
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+# Copyright (c) 2016, Linaro 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
#\r
\r
#include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
ret\r
\r
//UINTN\r
//ArmPlatformGetPrimaryCoreMpId (\r
// VOID\r
// );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
- ldrh w0, [x0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+ MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
ret\r
\r
//UINTN\r
//ArmPlatformIsPrimaryCore (\r
// IN UINTN MpId\r
// );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
mov x0, #1\r
ret\r
\r
// IN UINTN MpId\r
// );\r
// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
and x1, x0, #ARM_CORE_MASK\r
and x0, x0, #ARM_CLUSTER_MASK\r
add x0, x1, x0, LSR #6\r
//GetPhysAddrTop (\r
// VOID\r
// );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
mrs x0, id_aa64mmfr0_el1\r
adr x1, .LPARanges\r
and x0, x0, #7\r
#\r
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-# Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+# Copyright (c) 2014-2016, Linaro 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
#\r
\r
#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
bx lr\r
\r
//UINTN\r
//ArmPlatformGetPrimaryCoreMpId (\r
// VOID\r
// );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
- ldr r0, [r0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+ MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
bx lr\r
\r
//UINTN\r
//ArmPlatformIsPrimaryCore (\r
// IN UINTN MpId\r
// );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
mov r0, #1\r
bx lr\r
\r
// IN UINTN MpId\r
// );\r
// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
and r1, r0, #ARM_CORE_MASK\r
and r0, r0, #ARM_CLUSTER_MASK\r
add r0, r1, r0, LSR #6\r
//GetPhysAddrTop (\r
// VOID\r
// );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
mov r0, #0x00000000\r
mov r1, #0x10000\r
bx lr\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
\r
-#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
#include <AutoGen.h>\r
\r
INCLUDE AsmMacroIoLib.inc\r
EXPORT ArmPlatformGetCorePosition\r
EXPORT ArmGetPhysAddrTop\r
\r
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore\r
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask\r
- IMPORT _gPcd_FixedAtBuild_PcdCoreCount\r
-\r
AREA VirtHelper, CODE, READONLY\r
\r
ArmPlatformPeiBootAction FUNCTION\r
// VOID\r
// );\r
ArmPlatformGetPrimaryCoreMpId FUNCTION\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
- ldr r0, [r0]\r
+ MOV32 r0, FixedPcdGet32 (PcdArmPrimaryCore)\r
bx lr\r
ENDFUNC\r
\r
#\r
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+# Copyright (c) 2016, Linaro 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
#\r
\r
#include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm64LinuxMagic:\r
- .byte 0x41, 0x52, 0x4d, 0x64\r
\r
// VOID\r
// ArmPlatformPeiBootAction (\r
// VOID *DeviceTreeBaseAddress, // passed by loader in x0\r
// VOID *ImageBase // passed by FDF trampoline in x1\r
// );\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
mov x29, x30 // preserve LR\r
mov x28, x0 // preserve DTB pointer\r
mov x27, x1 // preserve base of image pointer\r
.Lout:\r
ret x29\r
\r
+.LArm64LinuxMagic:\r
+ .byte 0x41, 0x52, 0x4d, 0x64\r
+\r
//UINTN\r
//ArmPlatformGetPrimaryCoreMpId (\r
// VOID\r
// );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
- ldrh w0, [x0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+ MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
ret\r
\r
//UINTN\r
//ArmPlatformIsPrimaryCore (\r
// IN UINTN MpId\r
// );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
mov x0, #1\r
ret\r
\r
// IN UINTN MpId\r
// );\r
// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
and x1, x0, #ARM_CORE_MASK\r
and x0, x0, #ARM_CLUSTER_MASK\r
add x0, x1, x0, LSR #6\r
//GetPhysAddrTop (\r
// VOID\r
// );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
mrs x0, id_aa64mmfr0_el1\r
adr x1, .LPARanges\r
and x0, x0, #7\r
#\r
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-# Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+# Copyright (c) 2014-2016, Linaro 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
#\r
\r
#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
#include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm32LinuxMagic:\r
- .byte 0x18, 0x28, 0x6f, 0x01\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
mov r11, r14 // preserve LR\r
mov r10, r0 // preserve DTB pointer\r
mov r9, r1 // preserve base of image pointer\r
// to the actual relocated value, and add the shift of PcdFdBaseAddress to\r
// PcdFvBaseAddress as well\r
//\r
- ldr r8, =PcdGet64 (PcdFdBaseAddress)\r
- ldr r7, =PcdGet64 (PcdFvBaseAddress)\r
+ ADRL (r8, PcdGet64 (PcdFdBaseAddress))\r
+ ADRL (r7, PcdGet64 (PcdFvBaseAddress))\r
ldr r6, [r8]\r
ldr r5, [r7]\r
sub r5, r5, r6\r
// encountered. Since we are calling a C function, use the window at the\r
// beginning of the FD image as a temp stack.\r
//\r
- ldr r1, =PcdGet64 (PcdSystemMemoryBase)\r
- ldr r2, =PcdGet64 (PcdSystemMemorySize)\r
+ ADRL (r1, PcdGet64 (PcdSystemMemoryBase))\r
+ ADRL (r2, PcdGet64 (PcdSystemMemorySize))\r
mov sp, r5\r
bl FindMemnode\r
teq r0, #0\r
// image header at the base of this image (defined in the FDF), and record the\r
// pointer in PcdDeviceTreeInitialBaseAddress.\r
//\r
- ldr r8, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+ ADRL (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress))\r
add r9, r9, #0x40\r
str r9, [r8]\r
\r
.Lout:\r
bx r11\r
\r
+.LArm32LinuxMagic:\r
+ .byte 0x18, 0x28, 0x6f, 0x01\r
+\r
//UINTN\r
//ArmPlatformGetPrimaryCoreMpId (\r
// VOID\r
// );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
- ldr r0, [r0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+ MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
bx lr\r
\r
//UINTN\r
//ArmPlatformIsPrimaryCore (\r
// IN UINTN MpId\r
// );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
mov r0, #1\r
bx lr\r
\r
// IN UINTN MpId\r
// );\r
// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
and r1, r0, #ARM_CORE_MASK\r
and r0, r0, #ARM_CLUSTER_MASK\r
add r0, r1, r0, LSR #6\r
//GetPhysAddrTop (\r
// VOID\r
// );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
mov r0, #0x00000000\r
mov r1, #0x10000\r
bx lr\r
//\r
// Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-// Copyright (c) 2015, Linaro Limited. All rights reserved.\r
+// Copyright (c) 2015-2016, Linaro 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
//\r
\r
#include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 3\r
-\r
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_IMPORT(ArmReadMpidr)\r
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_IMPORT(ArmPlatformStackSet)\r
-GCC_ASM_EXPORT(_ModuleEntryPoint)\r
-ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
\r
-ASM_PFX(mSystemMemoryEnd): .8byte 0\r
+ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
\r
-ASM_PFX(_ModuleEntryPoint):\r
+ASM_FUNC(_ModuleEntryPoint)\r
//\r
// We are built as a ET_DYN PIE executable, so we need to process all\r
// relative relocations regardless of whether or not we are executing from\r
\r
// Calculate Top of the Firmware Device\r
ldr x2, PcdGet64 (PcdFdBaseAddress)\r
- ldr w3, PcdGet32 (PcdFdSize)\r
- sub x3, x3, #1\r
+ MOV32 (w3, FixedPcdGet32 (PcdFdSize) - 1)\r
add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize\r
\r
// UEFI Memory Size (stacks are allocated in this region)\r
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), x4)\r
+ MOV32 (x4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize))\r
\r
//\r
// Reserve the memory for the UEFI region (contain stacks on its top)\r
_SetupOverflowStack:\r
// Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE\r
// aligned (4KB)\r
- LoadConstantToReg (EFI_PAGE_MASK, x21)\r
- and x21, x21, x1\r
- sub x1, x1, x21\r
+ and x1, x1, ~EFI_PAGE_MASK\r
\r
_GetBaseUefiMemory:\r
// Calculate the Base of the UEFI Memory\r
_GetStackBase:\r
// r1 = The top of the Mpcore Stacks\r
// Stack for the primary core = PrimaryCoreStack\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)\r
+ MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
sub x22, x1, x2\r
\r
// Stack for the secondary core = Number of Cores - 1\r
- LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0)\r
- sub x0, x0, #1\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1)\r
- mul x1, x1, x0\r
+ MOV32 (x1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
sub x22, x22, x1\r
\r
// x22 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
mov x0, x22\r
mov x1, x20\r
//ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x3)\r
+ MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
+ MOV32 (x3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
bl ASM_PFX(ArmPlatformStackSet)\r
\r
// Is it the Primary Core ?\r
\r
_NeverReturn:\r
b _NeverReturn\r
+\r
+ASM_PFX(mSystemMemoryEnd): .8byte 0\r
//\r
// Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-// Copyright (c) 2015, Linaro Limited. All rights reserved.\r
+// Copyright (c) 2015-2016, Linaro 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
//\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
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_IMPORT(ArmReadMpidr)\r
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_IMPORT(ArmPlatformStackSet)\r
-GCC_ASM_EXPORT(_ModuleEntryPoint)\r
-ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
-\r
-ASM_PFX(mSystemMemoryEnd): .quad 0\r
\r
-__relocs:\r
- .long __reloc_base - __relocs\r
- .long __reloc_start - __relocs\r
- .long __reloc_end - __relocs\r
+ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
\r
-ASM_PFX(_ModuleEntryPoint):\r
+ASM_FUNC(_ModuleEntryPoint)\r
//\r
// We are built as a ET_DYN PIE executable, so we need to process all\r
// relative relocations if we are executing from a different offset than we\r
// were linked at. This is only possible if we are running from RAM.\r
//\r
-\r
- adr r12, __relocs\r
- ldrd r4, r5, [r12]\r
- ldr r6, [r12, #8]\r
-\r
- add r4, r4, r12\r
- add r5, r5, r12\r
- add r6, r6, r12\r
+ ADRL (r4, __reloc_base)\r
+ ADRL (r5, __reloc_start)\r
+ ADRL (r6, __reloc_end)\r
\r
.Lreloc_loop:\r
cmp r5, r6\r
// at the top of the DRAM)\r
_SetupStackPosition:\r
// Compute Top of System Memory\r
- ldr r12, =PcdGet64 (PcdSystemMemoryBase)\r
- ldr r1, [r12]\r
- ldr r12, =PcdGet64 (PcdSystemMemorySize)\r
+ LDRL (r1, PcdGet64 (PcdSystemMemoryBase))\r
+ ADRL (r12, PcdGet64 (PcdSystemMemorySize))\r
ldrd r2, r3, [r12]\r
\r
// calculate the top of memory, and record it in mSystemMemoryEnd\r
moveq r1, r2\r
\r
// Calculate Top of the Firmware Device\r
- ldr r12, =PcdGet64 (PcdFdBaseAddress)\r
- ldr r2, [r12]\r
- ldr r3, =FixedPcdGet32 (PcdFdSize)\r
- sub r3, r3, #1\r
+ LDRL (r2, PcdGet64 (PcdFdBaseAddress))\r
+ MOV32 (r3, FixedPcdGet32 (PcdFdSize) - 1)\r
add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize\r
\r
// UEFI Memory Size (stacks are allocated in this region)\r
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4)\r
+ MOV32 (r4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize))\r
\r
//\r
// Reserve the memory for the UEFI region (contain stacks on its top)\r
_SetupOverflowStack:\r
// Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE\r
// aligned (4KB)\r
- LoadConstantToReg (EFI_PAGE_MASK, r11)\r
- and r11, r11, r1\r
- sub r1, r1, r11\r
+ MOV32 (r11, (~EFI_PAGE_MASK) & 0xffffffff)\r
+ and r1, r1, r11\r
\r
_GetBaseUefiMemory:\r
// Calculate the Base of the UEFI Memory\r
_GetStackBase:\r
// r1 = The top of the Mpcore Stacks\r
// Stack for the primary core = PrimaryCoreStack\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
+ MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
sub r9, r1, r2\r
\r
// Stack for the secondary core = Number of Cores - 1\r
- LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0)\r
- sub r0, r0, #1\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1)\r
- mul r1, r1, r0\r
+ MOV32 (r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
sub r9, r9, r1\r
\r
// r9 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
mov r0, r9\r
mov r1, r10\r
//ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3)\r
+ MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
+ MOV32 (r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
bl ASM_PFX(ArmPlatformStackSet)\r
\r
// Is it the Primary Core ?\r
\r
_NeverReturn:\r
b _NeverReturn\r
+\r
+ASM_PFX(mSystemMemoryEnd): .quad 0\r