Skip to content

Commit d2ad824

Browse files
committed
parisc: Add 64bit get_user() and put_user() for 32bit kernel
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>
1 parent 06bff6b commit d2ad824

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

arch/parisc/include/asm/uaccess.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static inline long access_ok(int type, const void __user * addr,
4040
#define get_user __get_user
4141

4242
#if !defined(CONFIG_64BIT)
43-
#define LDD_USER(ptr) BUILD_BUG()
43+
#define LDD_USER(ptr) __get_user_asm64(ptr)
4444
#define STD_USER(x, ptr) __put_user_asm64(x, ptr)
4545
#else
4646
#define LDD_USER(ptr) __get_user_asm("ldd", ptr)
@@ -114,6 +114,20 @@ struct exception_data {
114114
: "r"(ptr), "1"(__gu_err) \
115115
: "r1");
116116

117+
#if !defined(CONFIG_64BIT)
118+
119+
#define __get_user_asm64(ptr) \
120+
__asm__("\n1:\tldw 0(%%sr2,%2),%0" \
121+
"\n2:\tldw 4(%%sr2,%2),%R0\n\t" \
122+
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_2)\
123+
ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_get_user_skip_1)\
124+
: "=r"(__gu_val), "=r"(__gu_err) \
125+
: "r"(ptr), "1"(__gu_err) \
126+
: "r1");
127+
128+
#endif /* !defined(CONFIG_64BIT) */
129+
130+
117131
#define __put_user(x, ptr) \
118132
({ \
119133
register long __pu_err __asm__ ("r8") = 0; \

0 commit comments

Comments
 (0)