From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 718CE1A1E3E for ; Wed, 10 Aug 2016 08:18:21 -0700 (PDT) Received: by mail-wm0-x234.google.com with SMTP id i5so111307456wmg.0 for ; Wed, 10 Aug 2016 08:18:21 -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=JmnBzX8hPgYjC1s+jgbaA21z74Nr6tW2fKzYjnkRBUY=; b=Qh6hS+Esn+x29M720W9HFDfLGSqrwasMI3gwfpXwM8if5noc/hrv/JL9PmiPN2K7YY vMevP/R0T7X7nwJwKHj8Afxx1w/nBNMOwKqxglYOYrX/IJQtDESH+siYebGK4OitpFgK SKjKjTbyYOXppx+SdWnBlXdsQA2k2DKKBO3Hg= 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=JmnBzX8hPgYjC1s+jgbaA21z74Nr6tW2fKzYjnkRBUY=; b=Klvq2EwGlznEsksp2qUofwdkmOdxbMFFZacdSkuE149A7H4lA2+M0CPIxlZk7rNjcb bvAWyrSkuUegHiD9TdznMKVeDZOHQDqzQnD0ift+Qp5r/o0B9yak+kXDnJA7eodpx5p8 3X7Cb/2sC3gZCaRY0tt8ow93Ycd05W2i1doFzCkRpzSSOPzrnxTXmwUeKioju4GgPSN/ +jU/fIVKzGIAXWlh614E/a5Jkqwj0dTZyc7aQlWc5PQf9S2xIkM/b3BIDFkoJvYPlP0x T/EqjgazYpiXI9KwErKIwvPo3Ix8WPNaSzpsH743BPkWuFzu+mKFB6Yyi9KtWa6V7IuZ 1M+w== X-Gm-Message-State: AEkoouv8hVvjGrWwp8oRJc3CODmgn89e+c0MpqraSReUPCJG3pnmUORaR+4xTNQkX28FH+Ns X-Received: by 10.194.114.135 with SMTP id jg7mr4520782wjb.166.1470842299891; Wed, 10 Aug 2016 08:18:19 -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.18.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Aug 2016 08:18:19 -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:40 +0200 Message-Id: <1470842282-8415-5-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 04/26] ArmPlatformPkg RVCT: drop dependency on GCC macro library 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:18:22 -0000 The RVCT .asm files include AsmMacroIoLib.h only for the definition of LoadConstantToReg (), which makes it tedious to make change to that file without the risk of making the RVCT assembler unhappy. So simply replace LoadConstantToReg() with mov32, which does the right thing in all cases. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm | 7 +++-- ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm | 8 +++--- ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm | 12 +++------ ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm | 5 ++-- ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm | 10 +++----- ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm | 4 +-- ArmPlatformPkg/PrePeiCore/Arm/Exception.asm | 2 -- ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm | 14 +++------- ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm | 27 ++++++++------------ 9 files changed, 29 insertions(+), 60 deletions(-) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm index f377cf2e72c6..c035843da078 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm @@ -11,7 +11,6 @@ // // -#include #include #include @@ -48,7 +47,7 @@ ArmPlatformGetCorePosition FUNCTION ArmPlatformIsPrimaryCore FUNCTION // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48 // with cpu_id[0:3] and cluster_id[4:7] - LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r1) + mov32 r1, ARM_CTA15A7_SCC_CFGREG48 ldr r1, [r1] lsr r1, #24 @@ -62,7 +61,7 @@ ArmPlatformIsPrimaryCore FUNCTION orr r1, r1, r2 // Keep the Cluster ID and Core ID from the MPID - LoadConstantToReg (ARM_CLUSTER_MASK :OR: ARM_CORE_MASK, r2) + mov32 r2, ARM_CLUSTER_MASK :OR: ARM_CORE_MASK and r0, r0, r2 // Compare mpid and boot cpu from ARM_SCC_CFGREG48 @@ -79,7 +78,7 @@ ArmPlatformIsPrimaryCore FUNCTION ArmPlatformGetPrimaryCoreMpId FUNCTION // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48 // with cpu_id[0:3] and cluster_id[4:7] - LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0) + mov32 r0, ARM_CTA15A7_SCC_CFGREG48 ldr r0, [r0] lsr r0, #24 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm index aa48ed730e16..d5afd9211357 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm @@ -11,7 +11,6 @@ // // -#include #include #include @@ -33,7 +32,7 @@ // VOID // ); ArmPlatformGetPrimaryCoreMpId FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0) + mov32 r0, FixedPcdGet32(PcdArmPrimaryCore) ldr r0, [r0] bx lr ENDFUNC @@ -43,10 +42,9 @@ ArmPlatformGetPrimaryCoreMpId FUNCTION // IN UINTN MpId // ); ArmPlatformIsPrimaryCore FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1) - ldr r1, [r1] + mov32 r1, FixedPcdGet32(PcdArmPrimaryCoreMask) and r0, r0, r1 - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1) + mov32 r1, FixedPcdGet32(PcdArmPrimaryCore) ldr r1, [r1] cmp r0, r1 moveq r0, #1 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm index f4ad51d36e06..66068e6595db 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm @@ -11,7 +11,6 @@ // // -#include #include #include #include @@ -28,9 +27,6 @@ EXPORT ArmPlatformGetPrimaryCoreMpId EXPORT ArmPlatformGetCorePosition - IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore - IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask - AREA RTSMHelper, CODE, READONLY ArmPlatformPeiBootAction FUNCTION @@ -52,8 +48,7 @@ ArmGetScuBaseAddress FUNCTION // VOID // ); ArmPlatformGetPrimaryCoreMpId FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0) - ldr r0, [r0] + mov32 r0, FixedPcdGet32(PcdArmPrimaryCore) bx lr ENDFUNC @@ -99,10 +94,9 @@ _Return // IN UINTN MpId // ); ArmPlatformIsPrimaryCore FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1) - ldr r1, [r1] + mov32 r1, FixedPcdGet32(PcdArmPrimaryCoreMask) and r0, r0, r1 - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1) + mov32 r1, FixedPcdGet32(PcdArmPrimaryCore) ldr r1, [r1] cmp r0, r1 moveq r0, #1 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm index 16fab1605ba1..06ce3776fce9 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm @@ -11,7 +11,6 @@ // // -#include #include #include #include @@ -90,7 +89,7 @@ ArmPlatformSecBootMemoryInit // // Initialize PL354 SMC // - LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1) + mov32 r1, ARM_VE_SMC_CTRL_BASE ldr r2, =VersatileExpressSmcConfiguration ldr r3, =VersatileExpressSmcConfigurationEnd blx PL35xSmcInitialize @@ -98,7 +97,7 @@ ArmPlatformSecBootMemoryInit // // Page mode setup for VRAM // - LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2) + mov32 r2, VRAM_MOTHERBOARD_BASE // Read current state ldr r0, [r2, #0] diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm index 95704c100a7a..c0f9a60dc836 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm +++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm @@ -11,7 +11,6 @@ // // -#include #include INCLUDE AsmMacroIoLib.inc @@ -47,8 +46,7 @@ ArmPlatformGetCorePosition FUNCTION // VOID // ); ArmPlatformGetPrimaryCoreMpId FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0) - ldr r0, [r0] + mov32 r0, FixedPcdGet32(PcdArmPrimaryCore) bx lr ENDFUNC @@ -57,11 +55,9 @@ ArmPlatformGetPrimaryCoreMpId FUNCTION // IN UINTN MpId // ); ArmPlatformIsPrimaryCore FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1) - ldr r1, [r1] + mov32 r1, FixedPcdGet32(PcdArmPrimaryCoreMask) and r0, r0, r1 - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1) - ldr r1, [r1] + mov32 r1, FixedPcdGet32(PcdArmPrimaryCore) cmp r0, r1 moveq r0, #1 movne r0, #0 diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm index 99218cd10ade..d8ed39cf23c6 100644 --- a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm +++ b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm @@ -11,8 +11,6 @@ // // -#include -#include #include INCLUDE AsmMacroIoLib.inc @@ -79,7 +77,7 @@ ArmPlatformStackSetPrimary FUNCTION add r0, r0, r2 // Compute SecondaryCoresCount * SecondaryCoreStackSize - LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, r1) + mov32 r1, FixedPcdGet32 (PcdCoreCount) ldr r1, [r1] sub r1, #1 mul r3, r3, r1 diff --git a/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm b/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm index de438f913ae1..4ffe2589976c 100644 --- a/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm +++ b/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm @@ -11,8 +11,6 @@ // // -#include -#include #include IMPORT PeiCommonExceptionEntry diff --git a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm index 9a8ca0b1748e..abea675828df 100644 --- a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm +++ b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm @@ -11,9 +11,6 @@ // // -#include -#include -#include #include INCLUDE AsmMacroIoLib.inc @@ -43,9 +40,7 @@ _ModuleEntryPoint bl 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 @@ -62,16 +57,15 @@ _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) diff --git a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm index a20e3fde0bda..023339841f75 100644 --- a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm +++ b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm @@ -11,11 +11,7 @@ // // -#include -#include -#include #include - #include INCLUDE AsmMacroIoLib.inc @@ -59,8 +55,8 @@ _SystemMemoryEndInit cmp r1, #0 bne _SetupStackPosition - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), r1) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), r2) + mov32 r1, FixedPcdGet32(PcdSystemMemoryBase) + mov32 r2, FixedPcdGet32(PcdSystemMemorySize) sub r2, r2, #1 add r1, r1, r2 // Update the global variable @@ -71,13 +67,13 @@ _SetupStackPosition // r1 = SystemMemoryTop // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2) - LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3) + mov32 r2, FixedPcdGet32(PcdFdBaseAddress) + mov32 r3, FixedPcdGet32(PcdFdSize) sub r3, r3, #1 add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize // UEFI Memory Size (stacks are allocated in this region) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4) + mov32 r4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize) // // Reserve the memory for the UEFI region (contain stacks on its top) @@ -108,7 +104,7 @@ _SetupAlignedStack _SetupOverflowStack // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE // aligned (4KB) - LoadConstantToReg (EFI_PAGE_MASK, r9) + mov32 r9, EFI_PAGE_MASK and r9, r9, r1 sub r1, r1, r9 @@ -119,22 +115,19 @@ _GetBaseUefiMemory _GetStackBase // r1 = The top of the Mpcore Stacks // Stack for the primary core = PrimaryCoreStack - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + mov32 r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize) sub r10, r1, r2 // Stack for the secondary core = Number of Cores - 1 - LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0) - sub r0, r0, #1 - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1) - mul r1, r1, r0 + mov32 r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize) sub r10, r10, r1 // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) mov r0, r10 mov r1, r8 //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3) + mov32 r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize) + mov32 r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize) bl ArmPlatformStackSet // Is it the Primary Core ? -- 2.7.4