Skip to content

Commit

Permalink
parisc: Add 64bit get_user() and put_user() for 32bit kernel
Browse files Browse the repository at this point in the history
Allow accessing 64-bit values in userspace from a 32-bit kernel.
The access is not atomic.

Signed-off-by: Helge Deller <deller@gmx.de>
  • Loading branch information
Helge Deller committed May 22, 2016
1 parent 06bff6b commit d2ad824
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion arch/parisc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static inline long access_ok(int type, const void __user * addr,
#define get_user __get_user

#if !defined(CONFIG_64BIT)
#define LDD_USER(ptr) BUILD_BUG()
#define LDD_USER(ptr) __get_user_asm64(ptr)
#define STD_USER(x, ptr) __put_user_asm64(x, ptr)
#else
#define LDD_USER(ptr) __get_user_asm("ldd", ptr)
Expand Down Expand Up @@ -114,6 +114,20 @@ struct exception_data {
: "r"(ptr), "1"(__gu_err) \
: "r1");

#if !defined(CONFIG_64BIT)

#define __get_user_asm64(ptr) \
__asm__("\n1:\tldw 0(%%sr2,%2),%0" \
"\n2:\tldw 4(%%sr2,%2),%R0\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_2)\
ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_get_user_skip_1)\
: "=r"(__gu_val), "=r"(__gu_err) \
: "r"(ptr), "1"(__gu_err) \
: "r1");

#endif /* !defined(CONFIG_64BIT) */


#define __put_user(x, ptr) \
({ \
register long __pu_err __asm__ ("r8") = 0; \
Expand Down

0 comments on commit d2ad824

Please sign in to comment.