From patchwork Fri Mar 6 12:58:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vrabel X-Patchwork-Id: 5954851 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A8A98BF440 for ; Fri, 6 Mar 2015 13:03:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1E4F20351 for ; Fri, 6 Mar 2015 13:03:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 4511A200FE for ; Fri, 6 Mar 2015 13:03:48 +0000 (UTC) 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 1YTrrh-0000Xa-CU; Fri, 06 Mar 2015 13:00:29 +0000 Received: from smtp02.citrix.com ([66.165.176.63]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YTrqb-0006iW-RN for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2015 12:59:23 +0000 X-IronPort-AV: E=Sophos;i="5.11,352,1422921600"; d="scan'208";a="242449602" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.210.2; Fri, 6 Mar 2015 07:58:56 -0500 Received: from qabil.uk.xensource.com ([10.80.2.76]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1YTrqC-0004A8-Pd; Fri, 06 Mar 2015 12:58:56 +0000 From: David Vrabel To: , Stefano Stabellini Subject: [PATCHv6 1/3] arm: make __get_user() work for 8 byte values Date: Fri, 6 Mar 2015 12:58:33 +0000 Message-ID: <1425646715-20834-2-git-send-email-david.vrabel@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1425646715-20834-1-git-send-email-david.vrabel@citrix.com> References: <1425646715-20834-1-git-send-email-david.vrabel@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150306_045922_119509_5FFCC40D X-CRM114-Status: UNSURE ( 8.17 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) Cc: Boris Ostrovsky , Russell King , David Vrabel , linux-arm-kernel@lists.infradead.org, Konrad Rzeszutek Wilk 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: , 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 get_user(), __put_user(), and put_user() all worked with 8-byte values but __get_user() did not. Signed-off-by: David Vrabel --- Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org --- arch/arm/include/asm/uaccess.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index ce0786e..d8f535b 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -306,6 +306,7 @@ do { \ case 1: __get_user_asm_byte(__gu_val, __gu_addr, err); break; \ case 2: __get_user_asm_half(__gu_val, __gu_addr, err); break; \ case 4: __get_user_asm_word(__gu_val, __gu_addr, err); break; \ + case 8: __get_user_asm_dword(__gu_val, __gu_addr, err); break; \ default: (__gu_val) = __get_user_bad(); \ } \ (x) = (__typeof__(*(ptr)))__gu_val; \ @@ -365,6 +366,37 @@ do { \ : "r" (addr), "i" (-EFAULT) \ : "cc") +#ifndef __ARMEB__ +#define __reg_get0 "%R1" +#define __reg_get1 "%Q1" +#else +#define __reg_get0 "%Q1" +#define __reg_get1 "%R1" +#endif + +#define __get_user_asm_dword(x, addr, err) \ + __asm__ __volatile__( \ + ARM( "1: " TUSER(ldr) " " __reg_get1 ", [%2], #4\n" ) \ + ARM( "2: " TUSER(ldr) " " __reg_get0 ", [%2]\n" ) \ + THUMB( "1: " TUSER(ldr) " " __reg_get1 ", [%2]\n" ) \ + THUMB( "2: " TUSER(ldr) " " __reg_get0 ", [%2, #4]\n" ) \ + "3:\n" \ + " .pushsection .fixup,\"ax\"\n" \ + " .align 2\n" \ + "4: mov %0, %3\n" \ + " mov " __reg_get1 ", #0\n" \ + " mov " __reg_get0 ", #0\n" \ + " b 3b\n" \ + " .popsection\n" \ + " .pushsection __ex_table,\"a\"\n" \ + " .align 3\n" \ + " .long 1b, 4b\n" \ + " .long 2b, 4b\n" \ + " .popsection" \ + : "+r" (err), "=&r" (x) \ + : "r" (addr), "i" (-EFAULT) \ + : "cc") + #define __put_user(x, ptr) \ ({ \ long __pu_err = 0; \