From patchwork Tue Apr 21 09:09:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 47389 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 226192121F for ; Tue, 21 Apr 2015 09:12:01 +0000 (UTC) Received: by layy10 with SMTP id y10sf45179592lay.0 for ; Tue, 21 Apr 2015 02:12:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=sdAULJEWr6TYreLQSV6JTxRD58drYsTiB4XoakxTcv4=; b=VQjLs1g9ZGWTimWWoyMsZ2MmXwRG/02VT7mRoHZ5mFH+ALpGfj8DdvSJoi3jTlaEfr gdfpMzGmnW8OFsoIWmKCRyZKmCi6sJmPTyTwN3GGL+xjV5Lzuzh+k2+NyECQ4ORVa9Zu Gd8IFrHRzOd4uKo4Y7Piem9pdKpBSxWChcJlb4dvLZCyNLVn0LSTxnGLqkSwoGnCT3Ag vLCJQZpA+iQlzlo0ziU3qqk9Bh1rvOcmEVQmyQuFVAwTPyku4/s78PieQ9A0MucnbaVD rURdvD8BJvFY/7blauL1nDVHSPFDPulwnhkP/+ofL8CGylqcoWzmg7AcHHc2kvWzO0z0 1d7w== X-Gm-Message-State: ALoCoQmPOB8qb1sHldtkgoa0Qk8MNUxaqEtCylQxUOKkI+L2aLGdPO21sEbQbwMN0Z8KexF7SNNT X-Received: by 10.152.88.73 with SMTP id be9mr8902389lab.2.1429607520120; Tue, 21 Apr 2015 02:12:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.98 with SMTP id ln2ls16863lac.61.gmail; Tue, 21 Apr 2015 02:12:00 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr19267412laj.88.1429607519973; Tue, 21 Apr 2015 02:11:59 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id bd7si875489lab.77.2015.04.21.02.11.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2015 02:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbcga7 with SMTP id ga7so150837051lbc.1 for ; Tue, 21 Apr 2015 02:11:59 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr18936392lac.41.1429607519841; Tue, 21 Apr 2015 02:11:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp510024lbt; Tue, 21 Apr 2015 02:11:59 -0700 (PDT) X-Received: by 10.68.248.8 with SMTP id yi8mr35983283pbc.56.1429607518092; Tue, 21 Apr 2015 02:11:58 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id vd13si2059553pac.43.2015.04.21.02.11.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2015 02:11:58 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YkUCG-000533-GT; Tue, 21 Apr 2015 09:10:24 +0000 Received: from mail-wg0-f47.google.com ([74.125.82.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YkUC8-0003mC-3U for linux-arm-kernel@lists.infradead.org; Tue, 21 Apr 2015 09:10:19 +0000 Received: by wgsk9 with SMTP id k9so205884847wgs.3 for ; Tue, 21 Apr 2015 02:09:53 -0700 (PDT) X-Received: by 10.194.122.105 with SMTP id lr9mr39964022wjb.153.1429607393783; Tue, 21 Apr 2015 02:09:53 -0700 (PDT) Received: from ards-macbook-pro.local ([90.174.5.83]) by mx.google.com with ESMTPSA id cf12sm1704199wjb.10.2015.04.21.02.09.52 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Apr 2015 02:09:52 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, dave.martin@arm.com Subject: [PATCH 2/2] ARM: prefer "bx reg" over "mov pc, reg" for all registers Date: Tue, 21 Apr 2015 11:09:32 +0200 Message-Id: <1429607372-7598-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1429607205-7501-1-git-send-email-ard.biesheuvel@linaro.org> References: <1429607205-7501-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150421_021016_336212_596B0EA7 X-CRM114-Status: UNSURE ( 8.64 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.47 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.47 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel , nico@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Commit 6ebbf2ce437b (ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+) replaced all occurrences of 'mov pc, ' with the 'ret' macro. However, this macro only emits the 'bx' instruction when used with the 'lr' register, but still uses 'mov pc, ' for everything else. Since ARM/Thumb2 interworking is allowed in the static kernel (i.e., inside vmlinux), this is potentially unsafe, since the mov instruction will not switch modes based on the Thumb bit. So instead, emit the 'bx' instruction in all cases, and not just for the 'lr' register. Signed-off-by: Ard Biesheuvel --- arch/arm/include/asm/assembler.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 186270b3e194..6dda6e3378ea 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -435,11 +435,7 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) #if __LINUX_ARM_ARCH__ < 6 mov\c pc, \reg #else - .ifeqs "\reg", "lr" bx\c \reg - .else - mov\c pc, \reg - .endif #endif .endm .endr