From patchwork Mon Sep 26 22:59:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77044 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1415233qgf; Mon, 26 Sep 2016 15:59:22 -0700 (PDT) X-Received: by 10.98.217.70 with SMTP id s67mr42739958pfg.118.1474930762109; Mon, 26 Sep 2016 15:59:22 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id q83si27165688pfi.296.2016.09.26.15.59.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Sep 2016 15:59:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8730E1A1E0E; Mon, 26 Sep 2016 15:59:21 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x235.google.com (mail-pf0-x235.google.com [IPv6:2607:f8b0:400e:c00::235]) (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 4A7511A1E0B for ; Mon, 26 Sep 2016 15:59:20 -0700 (PDT) Received: by mail-pf0-x235.google.com with SMTP id s13so35909326pfd.2 for ; Mon, 26 Sep 2016 15:59:20 -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; bh=Jy3lMcDV5K5dOk8gnP8/mtbbtDRwHlOt5kvcWpMQJ44=; b=hQKOcrDaHmcWWbw2Jc8mRyVVWRDmgThnpTGLA376J3nCiD1AgfWLARHRfUExVsMxxm JO5QHy8wncvuR65V+fIKYR/gFTQOFnZtofJ5/PhhJtGO5F2jt3h/7pby18EwcG3y3Hdb 7U87usMl7b9pgGFBfxdwOXY+hqy4MaPQFBuxE= 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; bh=Jy3lMcDV5K5dOk8gnP8/mtbbtDRwHlOt5kvcWpMQJ44=; b=UjKwuQtJ8Auwd46eu0WoisApRytjnz/RnL4Aa/wKwAgJaudcAScE1Ba56MDlZyt2IV +HuxIfVFLYfmYpZB0KiPvYMVMwDUr+tGvpyMgMpEJtYcjLhS7t4LdIs01Zl3BfiuPy5A OfqbyERrFiWWk3mHju0xFFCez9kolHK+/vVgj+cehXnZCJTPwUkw7vNIKYLXOGMn8yoA 52sQqNNH1CNXCZhBGkKhXUJ0TQetAdBagaYVtG9xIV3dfUpgXpVpm0V9UV/23Z1nj7L4 D1YGpmtlh3o2XuYkQkDMv65qn5NCtCtqjIuk5+7T7+QBQwSRHMspun75cVpKcwlfQ+da 23cQ== X-Gm-Message-State: AE9vXwPYczdKm2RufO0V2rSlRHqz5Hx6m3yZjfervd1qkAd21TzU/JvOgccwHE0wZjxv75Ob X-Received: by 10.98.59.146 with SMTP id w18mr41728693pfj.153.1474930759948; Mon, 26 Sep 2016 15:59:19 -0700 (PDT) Received: from localhost.localdomain ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id d2sm27356238pfe.94.2016.09.26.15.59.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Sep 2016 15:59:18 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, liming.gao@intel.com Date: Mon, 26 Sep 2016 15:59:15 -0700 Message-Id: <1474930756-6536-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [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: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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. 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 61: pop {r4-r7}