Skip to content

Commit 5613a93

Browse files
committed
parisc: Use SR_USER and SR_KERNEL in get_user() and put_user()
Instead of hardcoding the space registers as strings, use the SR_USER and SR_KERNEL constants to form the space register in the access functions. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 46b4016 commit 5613a93

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

arch/parisc/include/asm/uaccess.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,18 @@ struct exception_table_entry {
7979

8080
#define __get_user(val, ptr) \
8181
({ \
82-
__get_user_internal("%%sr3,", val, ptr); \
82+
__get_user_internal(SR_USER, val, ptr); \
8383
})
8484

8585
#define __get_user_asm(sr, val, ldx, ptr) \
8686
{ \
8787
register long __gu_val; \
8888
\
89-
__asm__("1: " ldx " 0(" sr "%2),%0\n" \
89+
__asm__("1: " ldx " 0(%%sr%2,%3),%0\n" \
9090
"9:\n" \
9191
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
9292
: "=r"(__gu_val), "+r"(__gu_err) \
93-
: "r"(ptr)); \
93+
: "i"(sr), "r"(ptr)); \
9494
\
9595
(val) = (__force __typeof__(*(ptr))) __gu_val; \
9696
}
@@ -100,7 +100,7 @@ struct exception_table_entry {
100100
{ \
101101
type __z; \
102102
long __err; \
103-
__err = __get_user_internal("%%sr0,", __z, (type *)(src)); \
103+
__err = __get_user_internal(SR_KERNEL, __z, (type *)(src)); \
104104
if (unlikely(__err)) \
105105
goto err_label; \
106106
else \
@@ -118,13 +118,13 @@ struct exception_table_entry {
118118
} __gu_tmp; \
119119
\
120120
__asm__(" copy %%r0,%R0\n" \
121-
"1: ldw 0(" sr "%2),%0\n" \
122-
"2: ldw 4(" sr "%2),%R0\n" \
121+
"1: ldw 0(%%sr%2,%3),%0\n" \
122+
"2: ldw 4(%%sr%2,%3),%R0\n" \
123123
"9:\n" \
124124
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
125125
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
126126
: "=&r"(__gu_tmp.l), "+r"(__gu_err) \
127-
: "r"(ptr)); \
127+
: "i"(sr), "r"(ptr)); \
128128
\
129129
(val) = __gu_tmp.t; \
130130
}
@@ -151,14 +151,14 @@ struct exception_table_entry {
151151
({ \
152152
__typeof__(&*(ptr)) __ptr = ptr; \
153153
__typeof__(*(__ptr)) __x = (__typeof__(*(__ptr)))(x); \
154-
__put_user_internal("%%sr3,", __x, __ptr); \
154+
__put_user_internal(SR_USER, __x, __ptr); \
155155
})
156156

157157
#define __put_kernel_nofault(dst, src, type, err_label) \
158158
{ \
159159
type __z = *(type *)(src); \
160160
long __err; \
161-
__err = __put_user_internal("%%sr0,", __z, (type *)(dst)); \
161+
__err = __put_user_internal(SR_KERNEL, __z, (type *)(dst)); \
162162
if (unlikely(__err)) \
163163
goto err_label; \
164164
}
@@ -178,24 +178,24 @@ struct exception_table_entry {
178178

179179
#define __put_user_asm(sr, stx, x, ptr) \
180180
__asm__ __volatile__ ( \
181-
"1: " stx " %2,0(" sr "%1)\n" \
181+
"1: " stx " %1,0(%%sr%2,%3)\n" \
182182
"9:\n" \
183183
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
184184
: "+r"(__pu_err) \
185-
: "r"(ptr), "r"(x))
185+
: "r"(x), "i"(sr), "r"(ptr))
186186

187187

188188
#if !defined(CONFIG_64BIT)
189189

190190
#define __put_user_asm64(sr, __val, ptr) do { \
191191
__asm__ __volatile__ ( \
192-
"1: stw %2,0(" sr "%1)\n" \
193-
"2: stw %R2,4(" sr "%1)\n" \
192+
"1: stw %1,0(%%sr%2,%3)\n" \
193+
"2: stw %R1,4(%%sr%2,%3)\n" \
194194
"9:\n" \
195195
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
196196
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
197197
: "+r"(__pu_err) \
198-
: "r"(ptr), "r"(__val)); \
198+
: "r"(__val), "i"(sr), "r"(ptr)); \
199199
} while (0)
200200

201201
#endif /* !defined(CONFIG_64BIT) */

0 commit comments

Comments
 (0)