From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2EDAC1A1DF1 for ; Mon, 26 Sep 2016 21:21:54 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 26 Sep 2016 21:21:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,403,1470726000"; d="scan'208";a="1057060329" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 26 Sep 2016 21:21:53 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 26 Sep 2016 21:21:53 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 26 Sep 2016 21:21:52 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.15]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.96]) with mapi id 14.03.0248.002; Tue, 27 Sep 2016 12:21:50 +0800 From: "Gao, Liming" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "leif.lindholm@linaro.org" Thread-Topic: [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem() Thread-Index: AQHSGEmg6KEzG5qoa0Kdoij9wONh86CMvLZg Date: Tue, 27 Sep 2016 04:21:49 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B47D4FD@shsmsx102.ccr.corp.intel.com> References: <1474930756-6536-1-git-send-email-ard.biesheuvel@linaro.org> In-Reply-To: <1474930756-6536-1-git-send-email-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem() 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: Tue, 27 Sep 2016 04:21:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Tuesday, September 27, 2016 6:59 AM > To: edk2-devel@lists.01.org; Gao, Liming > Cc: leif.lindholm@linaro.org; Ard Biesheuvel > Subject: [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 > bug in ScanMem() >=20 > The ARM ScanMem() in BaseMemoryLibOptDxe contains code from the > open > source cortex-strings library, and inherited a bug from it where the > conditional execution of a sequence of instructions is erroneously > made dependent on the same condition. Since the final 'addeq' is > supposed to be dependent on the preceding 'tsteq' instruction, they > cannot be part of the same IT block. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S > b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S > index dc0e74e8657c..1c269547b072 100644 > --- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S > +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S > @@ -134,11 +134,12 @@ ASM_PFX(InternalMemScanMem8): > bne 61f > adds r0, r0, #1 > tst r5, #CHARTSTMASK(1) // 2nd character > - ittt eq > - addeq r0, r0 ,#1 > - tsteq r5, #(3 << 15) // 2nd & 3rd character > + bne 61f > + adds r0, r0 ,#1 > + tst r5, #(3 << 15) // 2nd & 3rd character > // If not the 3rd must be the last one > - addeq r0, r0, #1 > + it eq > + addeq.n r0, r0, #1 >=20 > 61: > pop {r4-r7} > -- > 2.7.4