Commit cbc6e287 authored by Max Filippov's avatar Max Filippov

xtensa: use "m" constraint instead of "a" in uaccess.h assembly

Use "m" constraint instead of "r" for the address, as "m" allows
compiler to access adjacent locations using base + offset, while "r"
requires updating the base register every time.
Use %[mem] * 0 + v to replace offset part of %[mem] expansion with v.
It is impossible to change address alignment through the offset part on
xtensa, so just ignore offset in alignment checks.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent f5fae679
...@@ -132,13 +132,13 @@ do { \ ...@@ -132,13 +132,13 @@ do { \
#define __check_align_1 "" #define __check_align_1 ""
#define __check_align_2 \ #define __check_align_2 \
" _bbci.l %[addr], 0, 1f \n" \ " _bbci.l %[mem] * 0, 1f \n" \
" movi %[err], %[efault] \n" \ " movi %[err], %[efault] \n" \
" _j 2f \n" " _j 2f \n"
#define __check_align_4 \ #define __check_align_4 \
" _bbsi.l %[addr], 0, 0f \n" \ " _bbsi.l %[mem] * 0, 0f \n" \
" _bbci.l %[addr], 1, 1f \n" \ " _bbci.l %[mem] * 0 + 1, 1f \n" \
"0: movi %[err], %[efault] \n" \ "0: movi %[err], %[efault] \n" \
" _j 2f \n" " _j 2f \n"
...@@ -154,7 +154,7 @@ do { \ ...@@ -154,7 +154,7 @@ do { \
#define __put_user_asm(x_, addr_, err_, align, insn, cb)\ #define __put_user_asm(x_, addr_, err_, align, insn, cb)\
__asm__ __volatile__( \ __asm__ __volatile__( \
__check_align_##align \ __check_align_##align \
"1: "insn" %[x], %[addr], 0 \n" \ "1: "insn" %[x], %[mem] \n" \
"2: \n" \ "2: \n" \
" .section .fixup,\"ax\" \n" \ " .section .fixup,\"ax\" \n" \
" .align 4 \n" \ " .align 4 \n" \
...@@ -167,8 +167,8 @@ __asm__ __volatile__( \ ...@@ -167,8 +167,8 @@ __asm__ __volatile__( \
" .section __ex_table,\"a\" \n" \ " .section __ex_table,\"a\" \n" \
" .long 1b, 5b \n" \ " .long 1b, 5b \n" \
" .previous" \ " .previous" \
:[err] "+r"(err_), [tmp] "=r"(cb) \ :[err] "+r"(err_), [tmp] "=r"(cb), [mem] "=m"(*(addr_)) \
:[x] "r"(x_), [addr] "r"(addr_), [efault] "i"(-EFAULT)) :[x] "r"(x_), [efault] "i"(-EFAULT))
#define __get_user_nocheck(x, ptr, size) \ #define __get_user_nocheck(x, ptr, size) \
({ \ ({ \
...@@ -222,7 +222,7 @@ do { \ ...@@ -222,7 +222,7 @@ do { \
u32 __x = 0; \ u32 __x = 0; \
__asm__ __volatile__( \ __asm__ __volatile__( \
__check_align_##align \ __check_align_##align \
"1: "insn" %[x], %[addr], 0 \n" \ "1: "insn" %[x], %[mem] \n" \
"2: \n" \ "2: \n" \
" .section .fixup,\"ax\" \n" \ " .section .fixup,\"ax\" \n" \
" .align 4 \n" \ " .align 4 \n" \
...@@ -236,7 +236,7 @@ do { \ ...@@ -236,7 +236,7 @@ do { \
" .long 1b, 5b \n" \ " .long 1b, 5b \n" \
" .previous" \ " .previous" \
:[err] "+r"(err_), [tmp] "=r"(cb), [x] "+r"(__x) \ :[err] "+r"(err_), [tmp] "=r"(cb), [x] "+r"(__x) \
:[addr] "r"(addr_), [efault] "i"(-EFAULT)); \ :[mem] "m"(*(addr_)), [efault] "i"(-EFAULT)); \
(x_) = (__force __typeof__(*(addr_)))__x; \ (x_) = (__force __typeof__(*(addr_)))__x; \
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment