public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, eugene@hp.com, lersek@redhat.com
Subject: Re: [PATCH 21/26] ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro
Date: Thu, 11 Aug 2016 09:37:51 +0100	[thread overview]
Message-ID: <20160811083751.GP31760@bivouac.eciton.net> (raw)
In-Reply-To: <1470842282-8415-22-git-send-email-ard.biesheuvel@linaro.org>

On Wed, Aug 10, 2016 at 05:17:57PM +0200, Ard Biesheuvel wrote:
> Annotate functions with ASM_FUNC() so that they are emitted into
> separate sections.

Also replacing LoadConstantToReg. Add that to commit message and:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S | 37 ++++++--------------
>  ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S     | 36 ++++++-------------
>  2 files changed, 21 insertions(+), 52 deletions(-)
> 
> diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
> index 73b249ca5ffd..4bdf08d1a98a 100644
> --- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
> +++ b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
> @@ -15,25 +15,12 @@
>  #include <AsmMacroIoLibV8.h>
>  #include <Library/ArmLib.h>
>  
> -.text
> -.align 3
> -
> -GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
> -GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
> -GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
> -GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
> -
> -GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
> -
> -
> -PrimaryCoreMpid:  .word    0x0
> -
>  //UINTN
>  //ArmPlatformGetCorePosition (
>  //  IN UINTN MpId
>  //  );
>  // With this function: CorePos = (ClusterId * 2) + CoreId
> -ASM_PFX(ArmPlatformGetCorePosition):
> +ASM_FUNC(ArmPlatformGetCorePosition)
>    and   x1, x0, #ARM_CORE_MASK
>    and   x0, x0, #ARM_CLUSTER_MASK
>    add   x0, x1, x0, LSR #7
> @@ -43,33 +30,29 @@ ASM_PFX(ArmPlatformGetCorePosition):
>  //ArmPlatformGetPrimaryCoreMpId (
>  //  VOID
>  //  );
> -ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
> -  ldr   x0, =PrimaryCoreMpid
> -  ldrh  w0, [x0]
> +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
> +  ldr   w0, PrimaryCoreMpid
>    ret
>  
>  //UINTN
>  //ArmPlatformIsPrimaryCore (
>  //  IN UINTN MpId
>  //  );
> -ASM_PFX(ArmPlatformIsPrimaryCore):
> -  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
> -  ldrh  w1, [x1]
> +ASM_FUNC(ArmPlatformIsPrimaryCore)
> +  MOV32 (w1, FixedPcdGet32 (PcdArmPrimaryCoreMask))
>    and   x0, x0, x1
>  
> -  ldr   x1, =PrimaryCoreMpid
> -  ldrh  w1, [x1]
> +  ldr   w1, PrimaryCoreMpid
>  
>    cmp   w0, w1
> -  mov   x0, #1
> -  mov   x1, #0
> -  csel  x0, x0, x1, eq
> +  cset  x0, eq
>    ret
>  
> -ASM_PFX(ArmPlatformPeiBootAction):
> +ASM_FUNC(ArmPlatformPeiBootAction)
>    // The trusted firmware passes the primary CPU MPID through x0 register.
>    // Save it in a variable.
> -  ldr  x1, =PrimaryCoreMpid
> +  adr  x1, PrimaryCoreMpid
>    str  w0, [x1]
>    ret
>  
> +PrimaryCoreMpid:  .word    0x0
> diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
> index 2efb5451b88b..a7e904eac697 100644
> --- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
> +++ b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
> @@ -12,22 +12,9 @@
>  *
>  **/
>  
> -#include <AsmMacroIoLibV8.h>
> +#include <AsmMacroIoLib.h>
>  #include <Library/ArmLib.h>
>  
> -.text
> -.align 3
> -
> -GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
> -GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
> -GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
> -GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
> -
> -GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
> -
> -
> -PrimaryCoreMpid:  .word    0x0
> -
>  //
>  // Return the core position from the value of its MpId register
>  //
> @@ -41,7 +28,7 @@ PrimaryCoreMpid:  .word    0x0
>  //  IN UINTN MpId
>  //  );
>  // With this function: CorePos = (ClusterId * 2) + CoreId
> -ASM_PFX(ArmPlatformGetCorePosition):
> +ASM_FUNC(ArmPlatformGetCorePosition)
>    and   r1, r0, #ARM_CORE_MASK
>    and   r0, r0, #ARM_CLUSTER_MASK
>    add   r0, r1, r0, LSR #7
> @@ -59,9 +46,8 @@ ASM_PFX(ArmPlatformGetCorePosition):
>  //ArmPlatformGetPrimaryCoreMpId (
>  //  VOID
>  //  );
> -ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
> -  ldr   r0, =PrimaryCoreMpid
> -  ldr   r0, [r0]
> +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
> +  LDRL  (r0, PrimaryCoreMpid)
>    bx    lr
>  
>  //
> @@ -77,13 +63,11 @@ ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
>  //ArmPlatformIsPrimaryCore (
>  //  IN UINTN MpId
>  //  );
> -ASM_PFX(ArmPlatformIsPrimaryCore):
> -  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
> -  ldr   r1, [r1]
> +ASM_FUNC(ArmPlatformIsPrimaryCore)
> +  MOV32 (r1, FixedPcdGet32 (PcdArmPrimaryCoreMask))
>    and   r0, r0, r1
>  
> -  ldr   r1, =PrimaryCoreMpid
> -  ldr   r1, [r1]
> +  LDRL  (r1, PrimaryCoreMpid)
>  
>    cmp   r0, r1
>    moveq r0, #1
> @@ -97,9 +81,11 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
>  // or PrePeiCore modules. It allows to retrieve arguments passed to
>  // the UEFI firmware through the CPU registers.
>  //
> -ASM_PFX(ArmPlatformPeiBootAction):
> +ASM_FUNC(ArmPlatformPeiBootAction)
>    // The trusted firmware passes the primary CPU MPID through r0 register.
>    // Save it in a variable.
> -  ldr  r1, =PrimaryCoreMpid
> +  adr  r1, PrimaryCoreMpid
>    str  r0, [r1]
>    bx   lr
> +
> +PrimaryCoreMpid:  .word    0x0
> -- 
> 2.7.4
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2016-08-11  8:37 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 [this message]
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 ` [PATCH 23/26] ArmPlatformPkg/PrePeiCore: " Ard Biesheuvel
2016-08-11  8:38   ` 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=20160811083751.GP31760@bivouac.eciton.net \
    --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