From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C313A1A1E69 for ; Wed, 10 Aug 2016 08:19:04 -0700 (PDT) Received: by mail-wm0-x22a.google.com with SMTP id i5so111353974wmg.0 for ; Wed, 10 Aug 2016 08:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vV1rUk42Cyn9x3EwyR2OiJOz4a2q47x60QpIIPScBvo=; b=des1f1dwIbFebkJF+0p4oSZpHFftoDYMkBf0HqHsAk5pknTg5OyogId0KDF10D3a61 GSU2xnyVi6BTjWYRKaK4xh1QnCWcRE9179WQJJuMONsHhiVxWHZQ/k2u64mFAtVYiubw Vj5N2Cbohhji6KWvnJDqvGuvw8azq44a0+XPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vV1rUk42Cyn9x3EwyR2OiJOz4a2q47x60QpIIPScBvo=; b=dvUtZGtyex/VJzk+gLOAiVkeryJIOijIJWKy5YiyeUog1UMh87Of6mbRGEo2TP8OU6 wAJX8fFwZU/8KaoLCHXKwyyUXzlQKsEMkY8p2sbtrvpL99L6/EoBv6w7y+zacuhw0v80 hAEtdnRIwxC0/WA8YpmUGYvkzMATPk6ZUpUzSQ86A0b/PAq4ooiqARcSQhECYXY5f4TT pjO5A87VYsIpWz8K6II4v+0/NGp6NHNyXG94K5BqTulKMjOltbkSHMXTDcpk5D2xKIGp V6wv6nn/KVnM9bznfKsN92YanjxgWyIvngplKmBZdnyTR0uBuu+qZn+iwtcmy7qJxuVo wu9Q== X-Gm-Message-State: AEkoousLTZhpxDQDYhrxmjsBBtnj2GwzrPuJxfIz7Ykk3auNvNv+WjtL3U8oi7Sd3MJrkkzq X-Received: by 10.194.35.72 with SMTP id f8mr4480006wjj.45.1470842343191; Wed, 10 Aug 2016 08:19:03 -0700 (PDT) Received: from localhost.localdomain (46.red-81-37-107.dynamicip.rima-tde.net. [81.37.107.46]) by smtp.gmail.com with ESMTPSA id c16sm8908374wme.4.2016.08.10.08.19.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Aug 2016 08:19:02 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, eugene@hp.com Cc: lersek@redhat.com, Ard Biesheuvel Date: Wed, 10 Aug 2016 17:17:57 +0200 Message-Id: <1470842282-8415-22-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470842282-8415-1-git-send-email-ard.biesheuvel@linaro.org> References: <1470842282-8415-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 21/26] ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2016 15:19:05 -0000 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 --- 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 #include -.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 +#include #include -.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