public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, eugene@hp.com
Cc: lersek@redhat.com, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 23/26] ArmPlatformPkg/PrePeiCore: switch to ASM_FUNC() asm macro
Date: Wed, 10 Aug 2016 17:17:59 +0200	[thread overview]
Message-ID: <1470842282-8415-24-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1470842282-8415-1-git-send-email-ard.biesheuvel@linaro.org>

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPlatformPkg/PrePeiCore/AArch64/Helper.S               | 11 ++-----
 ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S | 30 ++++----------------
 ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S          |  9 ++----
 ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S     | 30 ++++----------------
 ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S              |  9 ++----
 5 files changed, 18 insertions(+), 71 deletions(-)

diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S b/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S
index 8e23b0389653..5f35484b1259 100644
--- a/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S
+++ b/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S
@@ -14,15 +14,8 @@
 #include <AsmMacroIoLibV8.h>
 #include <Chipset/AArch64.h>
 
-#start of the code section
-.text
-.align 3
-
-GCC_ASM_EXPORT(SetupExceptionLevel1)
-GCC_ASM_EXPORT(SetupExceptionLevel2)
-
 // Setup EL1 while in EL1
-ASM_PFX(SetupExceptionLevel1):
+ASM_FUNC(SetupExceptionLevel1)
    mov  x5, x30                   // Save LR
 
    mov  x0, #CPACR_CP_FULL_ACCESS
@@ -31,7 +24,7 @@ ASM_PFX(SetupExceptionLevel1):
    ret  x5
 
 // Setup EL2 while in EL2
-ASM_PFX(SetupExceptionLevel2):
+ASM_FUNC(SetupExceptionLevel2)
    msr     sctlr_el2, xzr
    mrs     x0, hcr_el2            // Read EL2 Hypervisor configuration Register
 
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S
index 34bf3a4e6831..aab5edab0c42 100644
--- a/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S
+++ b/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S
@@ -12,23 +12,8 @@
 //
 
 #include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
 
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-StartupAddr: .8byte CEntryPoint
-
-ASM_PFX(_ModuleEntryPoint):
+ASM_FUNC(_ModuleEntryPoint)
   // Do early platform specific actions
   bl    ASM_PFX(ArmPlatformPeiBootAction)
 
@@ -60,9 +45,7 @@ ASM_PFX(MainEntryPoint):
   bl    ASM_PFX(ArmPlatformIsPrimaryCore)
 
   // Get the top of the primary stacks (and the base of the secondary stacks)
-  LoadConstantToReg (FixedPcdGet64(PcdCPUCoresStackBase), x1)
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)
-  add   x1, x1, x2
+  MOV64 (x1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize))
 
   // x0 is equal to 1 if I am the primary core
   cmp   x0, #1
@@ -79,20 +62,19 @@ _SetupSecondaryCoreStack:
   add   x0, x0, #1
 
   // StackOffset = CorePos * StackSize
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x2)
+  MOV32 (x2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))
   mul   x0, x0, x2
   // SP = StackBase + StackOffset
   add   sp, x6, x0
 
 _PrepareArguments:
   // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
-  LoadConstantToReg (FixedPcdGet64(PcdFvBaseAddress), x2)
-  add   x2, x2, #8
-  ldr   x1, [x2]
+  MOV64 (x2, FixedPcdGet64(PcdFvBaseAddress))
+  ldr   x1, [x2, #8]
 
   // Move sec startup address into a data register
   // Ensure we're jumping to FV version of the code (not boot remapped alias)
-  ldr   x3, StartupAddr
+  ldr   x3, =ASM_PFX(CEntryPoint)
 
   // Jump to PrePeiCore C code
   //    x0 = mp_id
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S b/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S
index 8d83510517b4..89b98e630f5c 100644
--- a/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S
+++ b/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S
@@ -14,12 +14,7 @@
 #
 #------------------------------------------------------------------------------
 
-.text
-.align 3
-
-GCC_ASM_EXPORT(SecSwitchStack)
-
-
+#include <AsmMacroIoLibV8.h>
 
 #/**
 #  This allows the caller to switch the stack and return
@@ -35,7 +30,7 @@ GCC_ASM_EXPORT(SecSwitchStack)
 #  VOID  *StackDelta
 #  )#
 #
-ASM_PFX(SecSwitchStack):
+ASM_FUNC(SecSwitchStack)
     mov   x1, sp
     add   x1, x0, x1
     mov   sp, x1
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
index 1693f52e26c8..14344425ad4c 100644
--- a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
+++ b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
@@ -12,23 +12,8 @@
 //
 
 #include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
 
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-StartupAddr: .word    CEntryPoint
-
-ASM_PFX(_ModuleEntryPoint):
+ASM_FUNC(_ModuleEntryPoint)
   // Do early platform specific actions
   bl    ASM_PFX(ArmPlatformPeiBootAction)
 
@@ -41,9 +26,7 @@ ASM_PFX(_ModuleEntryPoint):
   bl    ASM_PFX(ArmPlatformIsPrimaryCore)
 
   // Get the top of the primary stacks (and the base of the secondary stacks)
-  LoadConstantToReg (FixedPcdGet64(PcdCPUCoresStackBase), r1)
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
-  add   r1, r1, r2
+  MOV32 (r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize))
 
   // r0 is equal to 1 if I am the primary core
   cmp   r0, #1
@@ -60,20 +43,19 @@ _SetupSecondaryCoreStack:
   add   r0, r0, #1
 
   // StackOffset = CorePos * StackSize
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)
+  MOV32 (r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))
   mul   r0, r0, r2
   // SP = StackBase + StackOffset
   add   sp, r6, r0
 
 _PrepareArguments:
   // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
-  LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2)
-  add   r2, r2, #4
-  ldr   r1, [r2]
+  MOV32 (r2, FixedPcdGet32(PcdFvBaseAddress))
+  ldr   r1, [r2, #4]
 
   // Move sec startup address into a data register
   // Ensure we're jumping to FV version of the code (not boot remapped alias)
-  ldr   r3, StartupAddr
+  ldr   r3, =ASM_PFX(CEntryPoint)
 
   // Jump to PrePeiCore C code
   //    r0 = mp_id
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
index 509dc205d992..c419463b4f94 100644
--- a/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
+++ b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
@@ -12,12 +12,7 @@
 #
 #------------------------------------------------------------------------------
 
-.text
-.align 3
-
-GCC_ASM_EXPORT(SecSwitchStack)
-
-
+#include <AsmMacroIoLib.h>
 
 #/**
 #  This allows the caller to switch the stack and return
@@ -33,7 +28,7 @@ GCC_ASM_EXPORT(SecSwitchStack)
 #  VOID  *StackDelta
 #  )#
 #
-ASM_PFX(SecSwitchStack):
+ASM_FUNC(SecSwitchStack)
     mov   R1, R13
     add   R1, R0, R1
     mov   R13, R1
-- 
2.7.4



  parent reply	other threads:[~2016-08-10 15:19 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 15:17 [PATCH 00/26] ARM assembler cleanup series Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 01/26] ArmLib: remove ArmReplaceLiveTranslationEntry() implementation Ard Biesheuvel
2016-08-10 16:56   ` Leif Lindholm
2016-08-10 17:31     ` Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 02/26] ArmPkg: add missing ArmMmuLib resolution to ArmPkg.dsc Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 03/26] ArmPkg/AsmMacroIoLib: remove unused obsolete MMIO and other asm macros Ard Biesheuvel
2016-08-10 17:04   ` Leif Lindholm
2016-08-10 17:26     ` Ard Biesheuvel
2016-08-11  8:23       ` Leif Lindholm
2016-08-10 15:17 ` [PATCH 04/26] ArmPlatformPkg RVCT: drop dependency on GCC macro library Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 05/26] ArmPkg: introduce ASM_FUNC, MOV32/MOV64 and ADRL/LDRL macros Ard Biesheuvel
2016-08-10 18:26   ` Cohen, Eugene
2016-08-10 18:29     ` Ard Biesheuvel
2016-08-10 18:48       ` Cohen, Eugene
2016-08-10 15:17 ` [PATCH 06/26] ArmVirt/PrePi: make jump to CEntryPoint relative Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 07/26] ArmVirtPkg: clean up assembly source files Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 08/26] ArmPkg/ArmSmcLibNull: move to generic C implementation Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 09/26] ArmPkg/ArmCpuLib: switch to ASM_FUNC() asm macro Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 10/26] ArmPkg/ArmGicV3: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 11/26] ArmPkg/ArmHvcLib: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 12/26] ArmPkg/ArmLib: " Ard Biesheuvel
2016-08-10 19:00   ` Leif Lindholm
2016-08-10 15:17 ` [PATCH 13/26] ArmPkg/ArmMmuLib: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 14/26] ArmPkg/ArmSmcLib: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 15/26] ArmPkg/BaseMemoryLibSm: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 16/26] ArmPkg/BaseMemoryLibVstm: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 17/26] ArmPkg/CompilerIntrinsicsLib: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 18/26] ArmPkg/SemihostLib: " Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 19/26] BeagleBoardPkg: remove unused Sec.inf module Ard Biesheuvel
2016-08-11  8:34   ` Leif Lindholm
2016-08-10 15:17 ` [PATCH 20/26] BeagleBoardPkg: add missing ArmMmuLib resolution Ard Biesheuvel
2016-08-10 15:17 ` [PATCH 21/26] ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro Ard Biesheuvel
2016-08-11  8:37   ` Leif Lindholm
2016-08-10 15:17 ` [PATCH 22/26] ArmPlatformPkg/PrePi: " Ard Biesheuvel
2016-08-11  8:38   ` Leif Lindholm
2016-08-31  4:33     ` Michael Zimmermann
2016-08-31  9:14       ` Ard Biesheuvel
2016-08-31  9:43         ` Michael Zimmermann
2016-08-31  9:45           ` Ard Biesheuvel
2016-08-31  9:47       ` Evan Lloyd
2016-08-31  9:52         ` Michael Zimmermann
2016-08-31  9:53           ` Ard Biesheuvel
2016-09-07 11:10       ` Ryan Harkin
2016-09-07 11:59         ` Ard Biesheuvel
2016-09-07 12:18           ` Ryan Harkin
2016-08-10 15:17 ` Ard Biesheuvel [this message]
2016-08-11  8:38   ` [PATCH 23/26] ArmPlatformPkg/PrePeiCore: " Leif Lindholm
2016-08-10 15:18 ` [PATCH 24/26] ArmPlatformPkg/ArmVExpressPkg: " Ard Biesheuvel
2016-08-11  8:39   ` Leif Lindholm
2016-08-10 15:18 ` [PATCH 25/26] ArmPlatformPkg/ArmPlatformLibNull: " Ard Biesheuvel
2016-08-11  8:39   ` Leif Lindholm
2016-08-10 15:18 ` [PATCH 26/26] ArmPlatformPkg/ArmPlatformStackLib: " Ard Biesheuvel
2016-08-11  8:42   ` Leif Lindholm
2016-08-11 10:18 ` [PATCH 00/26] ARM assembler cleanup series Leif Lindholm
2016-08-11 11:27   ` Ard Biesheuvel
2016-08-11 11:31     ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470842282-8415-24-git-send-email-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox