From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (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 6B8E71A1DED for ; Thu, 11 Aug 2016 04:27:49 -0700 (PDT) Received: by mail-io0-x22d.google.com with SMTP id m101so3064432ioi.2 for ; Thu, 11 Aug 2016 04:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sYaaS4pUjb6i2F2j9mEWj70lGH5GRm1ywzJSWzKB818=; b=WyiLgzoaDFhU6guOzM8CPJT5ZJ69DcSDzRYWkivbupMHDfhC6hpKvVISZIxhFn5E9z njVyKsi2TtMnzu6UIZi7OtV7Pwfjb5cu7ElVnpatSckln70cnm7KXjUgmJ9LEuzN1CPh A+1HiAMhVaCPTiy8LC0WqDXxF5yGqHHFvf/hg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sYaaS4pUjb6i2F2j9mEWj70lGH5GRm1ywzJSWzKB818=; b=P3lmauuDZh6zSwZDAODwsStc5QVTFiGIPnHXGGBfDO6VcWis1LEE+M+DGEJ+mZfqN8 Hyp8KYgaybA8rYuY2aiZJrldXP2GMILX8j4iklcBo1x549I3lOM8Yb6l+8vorX1Ia+mM 3N6BIjktBq5Lik1vf2wpY5/g8qir9AMb+rrhkpxZWGYX/e1iDnlSY2VvEQyEIBZ5ekJu ULqTyva/QmokuNTB5kog9CHNgJmKAdJOsTqhc7eQYdv2u1LGPrvT4Oye5NLszdMVjmsb TqBQrysxVpkJIphs1Hyp5sjy1VxcbGbTgeYA5J7Bv6z4kuy9yzBI9JflBKfN5JK5BiQO l1PA== X-Gm-Message-State: AEkoouuSTNIgsX9lCO14oxAgagY3sGUERIFZv7PoqCDuInE8zpv2vVDneD57rwVx3B3/xzCTDVqZbnQZtZAp/frS X-Received: by 10.107.135.22 with SMTP id j22mr12213112iod.56.1470914868371; Thu, 11 Aug 2016 04:27:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.204.195 with HTTP; Thu, 11 Aug 2016 04:27:47 -0700 (PDT) In-Reply-To: <20160811101822.GV31760@bivouac.eciton.net> References: <1470842282-8415-1-git-send-email-ard.biesheuvel@linaro.org> <20160811101822.GV31760@bivouac.eciton.net> From: Ard Biesheuvel Date: Thu, 11 Aug 2016 13:27:47 +0200 Message-ID: To: Leif Lindholm Cc: edk2-devel-01 , "Cohen, Eugene" , Laszlo Ersek Subject: Re: [PATCH 00/26] ARM assembler cleanup series 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: Thu, 11 Aug 2016 11:27:49 -0000 Content-Type: text/plain; charset=UTF-8 On 11 August 2016 at 12:18, Leif Lindholm wrote: > Nice bit of cleanup, thanks! > > For the ones I haven't commented on already: > Reviewed-by: Leif Lindholm > > (And for the BeagleBoardPkg as well, unless Andrew objects.) > Committed as 2b47cdc9364f ArmLib: remove ArmReplaceLiveTranslationEntry() implementation 820d07abadf1 ArmPkg: add missing ArmMmuLib resolution to ArmPkg.dsc 874883a49d0e ArmPkg/AsmMacroIoLib: remove unused obsolete MMIO and other asm macros 66edb631f8a2 ArmPlatformPkg RVCT: drop dependency on GCC macro library d2d0e27c7668 ArmPkg: introduce ASM_FUNC, MOV32/MOV64 and ADRL/LDRL macros 16a9fe2ca9cc ArmVirt/PrePi: make jump to CEntryPoint relative dfc2838892e4 ArmVirtPkg: clean up assembly source files 5e32710023e2 ArmPkg/ArmSmcLibNull: move to generic C implementation 136df8b8b2bb ArmPkg/ArmCpuLib: switch to ASM_FUNC() asm macro f0883e35dea7 ArmPkg/ArmGicV3: switch to ASM_FUNC() asm macro de656e666c61 ArmPkg/ArmHvcLib: switch to ASM_FUNC() asm macro 0efaa42f6e06 ArmPkg/ArmLib: switch to ASM_FUNC() asm macro e4d37ada015f ArmPkg/ArmMmuLib: switch to ASM_FUNC() asm macro 86a4d91bda59 ArmPkg/ArmSmcLib: switch to ASM_FUNC() asm macro 8ca934aab50b ArmPkg/BaseMemoryLibSm: switch to ASM_FUNC() asm macro 7589d9dbcfbf ArmPkg/BaseMemoryLibVstm: switch to ASM_FUNC() asm macro 903e31242d01 ArmPkg/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macro 22b080c78c7a ArmPkg/SemihostLib: switch to ASM_FUNC() asm macro b8f76eaec25e BeagleBoardPkg: add missing ArmMmuLib resolution a0f56915a02c ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro d2fa09a13487 ArmPlatformPkg/PrePi: switch to ASM_FUNC() asm macro 13dc7fa5a082 ArmPlatformPkg/PrePeiCore: switch to ASM_FUNC() asm macro 04209b53549b ArmPlatformPkg/ArmVExpressPkg: switch to ASM_FUNC() asm macro c17ae4cf8e07 ArmPlatformPkg/ArmPlatformLibNull: switch to ASM_FUNC() asm macro 926059304e83 ArmPlatformPkg/ArmPlatformStackLib: switch to ASM_FUNC() asm macro (with the comments addressed) Thanks, Ard. > On Wed, Aug 10, 2016 at 05:17:36PM +0200, Ard Biesheuvel wrote: >> As requested by Eugene, this series introduces a new ASM_FUNC preprocessor >> macro that emits functions into separate sections, allowing the linker to >> get rid of the code that ends up unused in the module. >> >> Note that using a native GNU as macro turned out to be problematic, due >> to our use of Trim, and the fact that not all versions of GNU as honour >> the -I option, making both #include (preprocessor) and .include (GNU as) >> unusable to include files with shared macro definitions. >> >> Since we're making a clean spot, let's introduce some other utility macros >> as well, and clean up the various assembler files to use it. In particular, >> clean up various patterns involving LoadConstantToReg(), including the gem >> >> LoadConstantToReg (_gPcd_FixedAtBuild_xxxx, rN) >> ldr rN, [rN] >> >> which performs two memory reads, including one that is subject to runtime >> relocation, to load a compile time constant into a register. Note that this >> is the definition of LoadConstantReg() we use for Clang, even on AARCH64: >> >> // load _Reg with _Data >> #define LoadConstantToReg(_Data, _Reg) \ >> ldr _Reg, 1f ; \ >> b 2f ; \ >> .align(8) ; \ >> 1: \ >> .8byte (_Data) ; \ >> 2: >> >> Other changes involve constant folding, i.e., >> >> // Stack for the secondary core = Number of Cores - 1 >> - LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0) >> - sub x0, x0, #1 >> - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1) >> - mul x1, x1, x0 >> + MOV32 (x1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) >> >> and >> >> - LoadConstantToReg (FixedPcdGet64(PcdCPUCoresStackBase), r1) >> - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) >> - add r1, r1, r2 >> + MOV32 (r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize)) >> >> (where r2 is dead after the add) >> >> Code can be found here >> https://git.linaro.org/people/ard.biesheuvel/uefi-next.git/shortlog/refs/heads/arm-asm-cleanup2 >> >> Ard Biesheuvel (26): >> ArmLib: remove ArmReplaceLiveTranslationEntry() implementation >> ArmPkg: add missing ArmMmuLib resolution to ArmPkg.dsc >> ArmPkg/AsmMacroIoLib: remove unused obsolete MMIO and other asm macros >> ArmPlatformPkg RVCT: drop dependency on GCC macro library >> ArmPkg: introduce ASM_FUNC, MOV32/MOV64 and ADRL/LDRL macros >> ArmVirt/PrePi: make jump to CEntryPoint relative >> ArmVirtPkg: clean up assembly source files >> ArmPkg/ArmSmcLibNull: move to generic C implementation >> ArmPkg/ArmCpuLib: switch to ASM_FUNC() asm macro >> ArmPkg/ArmGicV3: switch to ASM_FUNC() asm macro >> ArmPkg/ArmHvcLib: switch to ASM_FUNC() asm macro >> ArmPkg/ArmLib: switch to ASM_FUNC() asm macro >> ArmPkg/ArmMmuLib: switch to ASM_FUNC() asm macro >> ArmPkg/ArmSmcLib: switch to ASM_FUNC() asm macro >> ArmPkg/BaseMemoryLibSm: switch to ASM_FUNC() asm macro >> ArmPkg/BaseMemoryLibVstm: switch to ASM_FUNC() asm macro >> ArmPkg/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macro >> ArmPkg/SemihostLib: switch to ASM_FUNC() asm macro >> BeagleBoardPkg: remove unused Sec.inf module >> BeagleBoardPkg: add missing ArmMmuLib resolution >> ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro >> ArmPlatformPkg/PrePi: switch to ASM_FUNC() asm macro >> ArmPlatformPkg/PrePeiCore: switch to ASM_FUNC() asm macro >> ArmPlatformPkg/ArmVExpressPkg: switch to ASM_FUNC() asm macro >> ArmPlatformPkg/ArmPlatformLibNull: switch to ASM_FUNC() asm macro >> ArmPlatformPkg/ArmPlatformStackLib: switch to ASM_FUNC() asm macro >> >> ArmPkg/ArmPkg.dsc | 4 + >> ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/AArch64/ArmCortexA5xHelper.S | 9 +- >> ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Helper.S | 9 +- >> ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S | 28 +- >> ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S | 28 +- >> ArmPkg/Include/AsmMacroIoLib.h | 232 ++-------------- >> ArmPkg/Include/AsmMacroIoLib.inc | 54 ---- >> ArmPkg/Include/AsmMacroIoLibV8.h | 20 +- >> ArmPkg/Library/ArmHvcLib/AArch64/ArmHvc.S | 9 +- >> ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S | 10 +- >> ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimerSupport.S | 67 ++--- >> ArmPkg/Library/ArmLib/AArch64/AArch64Support.S | 181 +++---------- >> ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S | 43 +-- >> ArmPkg/Library/ArmLib/ArmV7/ArmLibSupportV7.S | 47 +--- >> ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimerSupport.S | 67 ++--- >> ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.S | 113 +++----- >> ArmPkg/Library/ArmLib/Common/AArch64/ArmLibSupport.S | 78 ++---- >> ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.S | 89 ++---- >> ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.asm | 4 +- >> ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S | 4 +- >> ArmPkg/Library/ArmSmcLib/AArch64/ArmSmc.S | 7 +- >> ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.S | 8 +- >> ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.S | 20 -- >> ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm | 20 -- >> ArmPkg/Library/ArmSmcLibNull/{AArch64/ArmSmcNull.S => ArmSmcLibNull.c} | 42 +-- >> ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf | 8 +- >> ArmPkg/Library/BaseMemoryLibStm/Arm/CopyMem.S | 8 +- >> ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.S | 7 +- >> ArmPkg/Library/BaseMemoryLibVstm/Arm/CopyMem.S | 8 +- >> ArmPkg/Library/BaseMemoryLibVstm/Arm/SetMem.S | 9 +- >> ArmPkg/Library/CompilerIntrinsicsLib/AArch64/memcpy.S | 10 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.S | 13 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S | 7 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.S | 7 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.S | 8 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch16.S | 8 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch32.S | 8 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch8.S | 8 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S | 9 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S | 7 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S | 7 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S | 6 +- >> ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S | 6 +- >> ArmPkg/Library/SemihostLib/AArch64/GccSemihost.S | 7 +- >> ArmPkg/Library/SemihostLib/Arm/GccSemihost.S | 8 +- >> ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S | 37 +-- >> ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S | 36 +-- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S | 22 +- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm | 7 +- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S | 28 +- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm | 8 +- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S | 38 +-- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S | 41 +-- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm | 12 +- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S | 23 +- >> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm | 5 +- >> ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S | 28 +- >> ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S | 28 +- >> ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm | 10 +- >> ArmPlatformPkg/Library/ArmPlatformStackLib/AArch64/ArmPlatformStackLib.S | 35 +-- >> ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S | 25 +- >> ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm | 4 +- >> ArmPlatformPkg/PrePeiCore/AArch64/Helper.S | 11 +- >> ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S | 30 +-- >> ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S | 9 +- >> ArmPlatformPkg/PrePeiCore/Arm/Exception.asm | 2 - >> ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S | 30 +-- >> ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm | 14 +- >> ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S | 9 +- >> ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 49 ++-- >> ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S | 50 +--- >> ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm | 27 +- >> ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S | 36 +-- >> ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper.S | 50 ++-- >> ArmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S | 30 +-- >> ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.S | 31 +-- >> ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.asm | 10 +- >> ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S | 36 +-- >> ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.S | 47 ++-- >> ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 48 +--- >> ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S | 73 ++--- >> BeagleBoardPkg/BeagleBoardPkg.dsc | 1 + >> BeagleBoardPkg/Sec/Arm/ModuleEntryPoint.S | 85 ------ >> BeagleBoardPkg/Sec/Arm/ModuleEntryPoint.asm | 89 ------ >> BeagleBoardPkg/Sec/Cache.c | 79 ------ >> BeagleBoardPkg/Sec/Clock.c | 70 ----- >> BeagleBoardPkg/Sec/LzmaDecompress.h | 103 ------- >> BeagleBoardPkg/Sec/PadConfiguration.c | 282 -------------------- >> BeagleBoardPkg/Sec/Sec.c | 186 ------------- >> BeagleBoardPkg/Sec/Sec.inf | 73 ----- >> 103 files changed, 647 insertions(+), 2730 deletions(-) >> delete mode 100644 ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.S >> delete mode 100644 ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm >> rename ArmPkg/Library/ArmSmcLibNull/{AArch64/ArmSmcNull.S => ArmSmcLibNull.c} (73%) >> delete mode 100644 BeagleBoardPkg/Sec/Arm/ModuleEntryPoint.S >> delete mode 100644 BeagleBoardPkg/Sec/Arm/ModuleEntryPoint.asm >> delete mode 100644 BeagleBoardPkg/Sec/Cache.c >> delete mode 100644 BeagleBoardPkg/Sec/Clock.c >> delete mode 100644 BeagleBoardPkg/Sec/LzmaDecompress.h >> delete mode 100644 BeagleBoardPkg/Sec/PadConfiguration.c >> delete mode 100644 BeagleBoardPkg/Sec/Sec.c >> delete mode 100644 BeagleBoardPkg/Sec/Sec.inf >> >> -- >> 2.7.4 >>