From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.10550.1602591407122882750 for ; Tue, 13 Oct 2020 05:16:47 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8B7CF1FB; Tue, 13 Oct 2020 05:16:45 -0700 (PDT) Received: from [192.168.1.81] (unknown [10.37.8.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8CE273F719; Tue, 13 Oct 2020 05:16:44 -0700 (PDT) Subject: Re: [PATCH 3/5] MdePkg/BaseLib: use normal register init in ARM SetJump implementations To: Leif Lindholm , devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu References: <20201001183712.1738-1-leif@nuviainc.com> <20201001183712.1738-4-leif@nuviainc.com> From: "Ard Biesheuvel" Message-ID: Date: Tue, 13 Oct 2020 14:16:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201001183712.1738-4-leif@nuviainc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/1/20 8:37 PM, Leif Lindholm wrote: > There may be architectures on which there are benefits to > eor r0, r0(, r0) > but ARM was never one of them. Change to more readable > mov r0, #0 > instead. > > Signed-off-by: Leif Lindholm > --- > MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S | 2 +- > MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S > index 54b11ad2197c..407df5f41ac5 100644 > --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S > +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S > @@ -36,7 +36,7 @@ ASM_PFX(SetJump): > pop {r0, lr} > mov r3, r13 > stmia r0, {r3-r12,r14} > - eor r0, r0, r0 > + mov r0, #0 Actually, 'movs r0, #0' produces a smaller opcode here when building in Thumb2 mode :-) > bx lr > > #/** > diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm > index 6d47033975f2..3a45f045460a 100644 > --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm > +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm > @@ -36,7 +36,7 @@ SetJump > POP {R0, LR} > MOV R3, R13 > STM R0, {R3-R12,R14} > - EOR R0, R0 > + MOV RO, #0 > BX LR > > ;/** >