From patchwork Mon Jan 13 22:30:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Kamensky X-Patchwork-Id: 3481111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DD841C02DC for ; Mon, 13 Jan 2014 22:32:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2443020160 for ; Mon, 13 Jan 2014 22:32:07 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2955E20136 for ; Mon, 13 Jan 2014 22:32:06 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2q37-00026L-Oq; Mon, 13 Jan 2014 22:32:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2q35-0007C3-1V; Mon, 13 Jan 2014 22:31:59 +0000 Received: from mail-pd0-f171.google.com ([209.85.192.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2q31-0007A4-MI for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2014 22:31:56 +0000 Received: by mail-pd0-f171.google.com with SMTP id x10so3293946pdj.2 for ; Mon, 13 Jan 2014 14:31:31 -0800 (PST) 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=kqOtoiMMnRuScjXBZIouLaXFomxU8F9ISWQkxIIlHTw=; b=dClqhumr3FT18UkdhYGWmAgMCGUYYptCFFszR42CkLb+dp/X4jZUyGlckNFdY9PnxS qV//NVlw2rVAtES/6vEpadQc/cyI+HL1P0inI/y6ckh5WDznEg10eRhDg8BMHzXE6icq a8TddwJ5QFbWbi0IrAQq+XFNa0FWnPNP21+WeLZLYtVPrsV2KWp+NjXRzoIRQEne2viI lVd3VBMDfEXZDqOE7/kzwR2s/RWJZl7ayJ9tA1ZdoQRhJzPZ58Tbf3Zo61M0LbZmWHrk ye9aBDO7X7dMuHpGwRJt8ai2BZllA7pqHp/HgqmlREm0i4eKHx0RWiyU2oxoG550k/sv 6EOg== X-Gm-Message-State: ALoCoQk//KeOBgmzJHwmsVIxDNG4bhTHsYd3M1JzmHX2fZn3uZqifyjfktng1DYb9C/n6bMloCn2 X-Received: by 10.68.66.1 with SMTP id b1mr32405718pbt.43.1389652291853; Mon, 13 Jan 2014 14:31:31 -0800 (PST) Received: from kamensky-w530.cisco.com (128-107-239-233.cisco.com. [128.107.239.233]) by mx.google.com with ESMTPSA id qq5sm40537862pbb.24.2014.01.13.14.31.29 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 13 Jan 2014 14:31:30 -0800 (PST) From: Victor Kamensky To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: asm: __und_usr_thumb need byteswap instructions in BE case Date: Mon, 13 Jan 2014 14:30:51 -0800 Message-Id: <1389652251-18298-1-git-send-email-victor.kamensky@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140113_173155_795130_8AABCDA3 X-CRM114-Status: UNSURE ( 8.81 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, taras.kondratiuk@linaro.org, Victor Kamensky , will.deacon@arm.com, ben.dooks@codethink.co.uk, comelton@cisco.com, Dave.Martin@arm.com, rmk@arm.linux.org.uk X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __und_usr_thumb function deals with thumb2 opcodes. In case of BE image, it needs to byteswap half word thumb2 encoded instructions before further processing them. Without this fix BE image user-land thread executing first VFP instruction encoded in thumb2 fails with SIGILL, because kernel does not recognize instruction and does not enable VFP. Reported-by: Corey Melton Signed-off-by: Victor Kamensky Acked-by: Dave Martin Tested-by: Stephen Boyd --- arch/arm/kernel/entry-armv.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index b3fb8c9..1879e8d 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -451,9 +451,11 @@ __und_usr_thumb: .arch armv6t2 #endif 2: ldrht r5, [r4] +ARM_BE8(rev16 r5, r5) @ little endian instruction cmp r5, #0xe800 @ 32bit instruction if xx != 0 blo __und_usr_fault_16 @ 16bit undefined instruction 3: ldrht r0, [r2] +ARM_BE8(rev16 r0, r0) @ little endian instruction add r2, r2, #2 @ r2 is PC + 2, make it PC + 4 str r2, [sp, #S_PC] @ it's a 2x16bit instr, update orr r0, r0, r5, lsl #16