summaryrefslogtreecommitdiff
path: root/arch/s390/lib/uaccess.c
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2023-03-24 15:00:23 +0100
committerVasily Gorbik <gor@linux.ibm.com>2023-04-04 18:27:24 +0200
commitc3bd834328a6b642cfebc8a1a6cd5e5447cbbd12 (patch)
tree31a64c6a16637c89dda77d75f15410bb320a85ef /arch/s390/lib/uaccess.c
parent7f65d18329a2546ce6f64ac6bf141c38b15c2ab3 (diff)
s390/uaccess: get rid of not needed local variable
Get rid of the not needed val local variable and pass the constant value directly as operand value. In addition this turns the val operand into an input operand, since it is not changed within the inline assemblies. This in turn requires also to add the earlyclobber contraint modifier to all output operands, since the (former) val operand is used after all output variants have been modified. The usercopy kunit tests still pass after this change. Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/lib/uaccess.c')
-rw-r--r--arch/s390/lib/uaccess.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c
index a89f6639818a..1cd5a3768fcd 100644
--- a/arch/s390/lib/uaccess.c
+++ b/arch/s390/lib/uaccess.c
@@ -34,7 +34,7 @@ void debug_user_asce(int exit)
static unsigned long raw_copy_from_user_key(void *to, const void __user *from,
unsigned long size, unsigned long key)
{
- unsigned long val, rem;
+ unsigned long rem;
union oac spec = {
.oac2.key = key,
.oac2.as = PSW_BITS_AS_SECONDARY,
@@ -42,7 +42,6 @@ static unsigned long raw_copy_from_user_key(void *to, const void __user *from,
.oac2.a = 1,
};
- val = -4096UL;
asm volatile(
" lr 0,%[spec]\n"
"0: mvcos 0(%[to]),0(%[from]),%[size]\n"
@@ -65,9 +64,8 @@ static unsigned long raw_copy_from_user_key(void *to, const void __user *from,
EX_TABLE(1b, 2b)
EX_TABLE(3b, 6b)
EX_TABLE(4b, 6b)
- : [size] "+a" (size), [from] "+a" (from), [to] "+a" (to),
- [val] "+a" (val), [rem] "=a" (rem)
- : [spec] "d" (spec.val)
+ : [size] "+&a" (size), [from] "+&a" (from), [to] "+&a" (to), [rem] "=&a" (rem)
+ : [val] "a" (-4096UL), [spec] "d" (spec.val)
: "cc", "memory", "0");
return size;
}
@@ -98,7 +96,7 @@ EXPORT_SYMBOL(_copy_from_user_key);
static unsigned long raw_copy_to_user_key(void __user *to, const void *from,
unsigned long size, unsigned long key)
{
- unsigned long val, rem;
+ unsigned long rem;
union oac spec = {
.oac1.key = key,
.oac1.as = PSW_BITS_AS_SECONDARY,
@@ -106,7 +104,6 @@ static unsigned long raw_copy_to_user_key(void __user *to, const void *from,
.oac1.a = 1,
};
- val = -4096UL;
asm volatile(
" lr 0,%[spec]\n"
"0: mvcos 0(%[to]),0(%[from]),%[size]\n"
@@ -129,9 +126,8 @@ static unsigned long raw_copy_to_user_key(void __user *to, const void *from,
EX_TABLE(1b, 2b)
EX_TABLE(3b, 6b)
EX_TABLE(4b, 6b)
- : [size] "+a" (size), [to] "+a" (to), [from] "+a" (from),
- [val] "+a" (val), [rem] "=a" (rem)
- : [spec] "d" (spec.val)
+ : [size] "+&a" (size), [to] "+&a" (to), [from] "+&a" (from), [rem] "=&a" (rem)
+ : [val] "a" (-4096UL), [spec] "d" (spec.val)
: "cc", "memory", "0");
return size;
}
@@ -155,13 +151,12 @@ EXPORT_SYMBOL(_copy_to_user_key);
unsigned long __clear_user(void __user *to, unsigned long size)
{
- unsigned long val, rem;
+ unsigned long rem;
union oac spec = {
.oac1.as = PSW_BITS_AS_SECONDARY,
.oac1.a = 1,
};
- val = -4096UL;
asm volatile(
" lr 0,%[spec]\n"
"0: mvcos 0(%[to]),0(%[zeropg]),%[size]\n"
@@ -183,9 +178,8 @@ unsigned long __clear_user(void __user *to, unsigned long size)
EX_TABLE(1b, 2b)
EX_TABLE(3b, 6b)
EX_TABLE(4b, 6b)
- : [size] "+&a" (size), [to] "+&a" (to),
- [val] "+a" (val), [rem] "=&a" (rem)
- : [zeropg] "a" (empty_zero_page), [spec] "d" (spec.val)
+ : [size] "+&a" (size), [to] "+&a" (to), [rem] "=&a" (rem)
+ : [val] "a" (-4096UL), [zeropg] "a" (empty_zero_page), [spec] "d" (spec.val)
: "cc", "memory", "0");
return size;
}