linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: david.vrabel@citrix.com (David Vrabel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv6 1/3] arm: make __get_user() work for 8 byte values
Date: Fri, 6 Mar 2015 12:58:33 +0000	[thread overview]
Message-ID: <1425646715-20834-2-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1425646715-20834-1-git-send-email-david.vrabel@citrix.com>

get_user(), __put_user(), and put_user() all worked with 8-byte values
but __get_user() did not.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel at 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;						\
-- 
1.7.10.4

       reply	other threads:[~2015-03-06 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1425646715-20834-1-git-send-email-david.vrabel@citrix.com>
2015-03-06 12:58 ` David Vrabel [this message]
2015-03-09 19:04   ` [PATCHv6 1/3] arm: make __get_user() work for 8 byte values Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425646715-20834-2-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).