From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (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 9DB661A1DF5 for ; Thu, 11 Aug 2016 03:18:27 -0700 (PDT) Received: by mail-wm0-x22e.google.com with SMTP id f65so20435550wmi.0 for ; Thu, 11 Aug 2016 03:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2r42dcJSOUzuAcQbYQZuMQ7BntrjuqmUUS6edT4GSNA=; b=Q+zsWh/e5vezKtcmjvqvz9M5wGeoUHM67SL4Uf96M4CJ5VQWIe59bH6bnwzegR7+F7 WmapxbNX4XnRu9RTsm0UR6ZMWcXdRsjknGGODFlKxhDRDmHCp2jfto+fewCT6y4dPNvS oNLWxG8vSSK1L/OHvNjwGh4soBrD5mQ+tE+dA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2r42dcJSOUzuAcQbYQZuMQ7BntrjuqmUUS6edT4GSNA=; b=Bd/5HWiN2O+Lfj5tsVRbsm4uYx2dXKgGZxKxnHIBOO+lb57MBXIcthGS13nWrzrquc mz3Kr5tUIgtS9qUpmE0AKVGy6I1Q3XLBkDaBCOAh45Fee7812/tTN6x04qEAzsfmGUji gn66WswXwwccKlQGOKpnPL9pusgjcCVJZvx20tVXN2bng3pLlYa7H6MRLMlmdhxYbSog j6BwxAI65jh5Ec0Icsi+8pEtSK/mg2SKIuGIbioxrVIHRapjQVmID5OgnZBMgL1H7Jpd k4B5DaePQohxC8VSUjQUyX1+W4j3HVqP/gyi1WP5V/4aDX+ZvnuhND7dc9q7f7S/bvN5 e6dQ== X-Gm-Message-State: AEkoouto0QGh7immLqIBlpkihp09vncbQnGKn+7Jrq8y7P0GkY1LUQLmKng72PhjdMpJN8Lr X-Received: by 10.28.35.86 with SMTP id j83mr7722488wmj.18.1470910704707; Thu, 11 Aug 2016 03:18:24 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id 142sm2453370wmh.12.2016.08.11.03.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Aug 2016 03:18:23 -0700 (PDT) Date: Thu, 11 Aug 2016 11:18:22 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, eugene@hp.com, lersek@redhat.com Message-ID: <20160811101822.GV31760@bivouac.eciton.net> References: <1470842282-8415-1-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1470842282-8415-1-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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 10:18:28 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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.) 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 >