Commit c3bd8343 authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

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: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 7f65d183
...@@ -34,7 +34,7 @@ void debug_user_asce(int exit) ...@@ -34,7 +34,7 @@ void debug_user_asce(int exit)
static unsigned long raw_copy_from_user_key(void *to, const void __user *from, static unsigned long raw_copy_from_user_key(void *to, const void __user *from,
unsigned long size, unsigned long key) unsigned long size, unsigned long key)
{ {
unsigned long val, rem; unsigned long rem;
union oac spec = { union oac spec = {
.oac2.key = key, .oac2.key = key,
.oac2.as = PSW_BITS_AS_SECONDARY, .oac2.as = PSW_BITS_AS_SECONDARY,
...@@ -42,7 +42,6 @@ static unsigned long raw_copy_from_user_key(void *to, const void __user *from, ...@@ -42,7 +42,6 @@ static unsigned long raw_copy_from_user_key(void *to, const void __user *from,
.oac2.a = 1, .oac2.a = 1,
}; };
val = -4096UL;
asm volatile( asm volatile(
" lr 0,%[spec]\n" " lr 0,%[spec]\n"
"0: mvcos 0(%[to]),0(%[from]),%[size]\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, ...@@ -65,9 +64,8 @@ static unsigned long raw_copy_from_user_key(void *to, const void __user *from,
EX_TABLE(1b, 2b) EX_TABLE(1b, 2b)
EX_TABLE(3b, 6b) EX_TABLE(3b, 6b)
EX_TABLE(4b, 6b) EX_TABLE(4b, 6b)
: [size] "+a" (size), [from] "+a" (from), [to] "+a" (to), : [size] "+&a" (size), [from] "+&a" (from), [to] "+&a" (to), [rem] "=&a" (rem)
[val] "+a" (val), [rem] "=a" (rem) : [val] "a" (-4096UL), [spec] "d" (spec.val)
: [spec] "d" (spec.val)
: "cc", "memory", "0"); : "cc", "memory", "0");
return size; return size;
} }
...@@ -98,7 +96,7 @@ EXPORT_SYMBOL(_copy_from_user_key); ...@@ -98,7 +96,7 @@ EXPORT_SYMBOL(_copy_from_user_key);
static unsigned long raw_copy_to_user_key(void __user *to, const void *from, static unsigned long raw_copy_to_user_key(void __user *to, const void *from,
unsigned long size, unsigned long key) unsigned long size, unsigned long key)
{ {
unsigned long val, rem; unsigned long rem;
union oac spec = { union oac spec = {
.oac1.key = key, .oac1.key = key,
.oac1.as = PSW_BITS_AS_SECONDARY, .oac1.as = PSW_BITS_AS_SECONDARY,
...@@ -106,7 +104,6 @@ static unsigned long raw_copy_to_user_key(void __user *to, const void *from, ...@@ -106,7 +104,6 @@ static unsigned long raw_copy_to_user_key(void __user *to, const void *from,
.oac1.a = 1, .oac1.a = 1,
}; };
val = -4096UL;
asm volatile( asm volatile(
" lr 0,%[spec]\n" " lr 0,%[spec]\n"
"0: mvcos 0(%[to]),0(%[from]),%[size]\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, ...@@ -129,9 +126,8 @@ static unsigned long raw_copy_to_user_key(void __user *to, const void *from,
EX_TABLE(1b, 2b) EX_TABLE(1b, 2b)
EX_TABLE(3b, 6b) EX_TABLE(3b, 6b)
EX_TABLE(4b, 6b) EX_TABLE(4b, 6b)
: [size] "+a" (size), [to] "+a" (to), [from] "+a" (from), : [size] "+&a" (size), [to] "+&a" (to), [from] "+&a" (from), [rem] "=&a" (rem)
[val] "+a" (val), [rem] "=a" (rem) : [val] "a" (-4096UL), [spec] "d" (spec.val)
: [spec] "d" (spec.val)
: "cc", "memory", "0"); : "cc", "memory", "0");
return size; return size;
} }
...@@ -155,13 +151,12 @@ EXPORT_SYMBOL(_copy_to_user_key); ...@@ -155,13 +151,12 @@ EXPORT_SYMBOL(_copy_to_user_key);
unsigned long __clear_user(void __user *to, unsigned long size) unsigned long __clear_user(void __user *to, unsigned long size)
{ {
unsigned long val, rem; unsigned long rem;
union oac spec = { union oac spec = {
.oac1.as = PSW_BITS_AS_SECONDARY, .oac1.as = PSW_BITS_AS_SECONDARY,
.oac1.a = 1, .oac1.a = 1,
}; };
val = -4096UL;
asm volatile( asm volatile(
" lr 0,%[spec]\n" " lr 0,%[spec]\n"
"0: mvcos 0(%[to]),0(%[zeropg]),%[size]\n" "0: mvcos 0(%[to]),0(%[zeropg]),%[size]\n"
...@@ -183,9 +178,8 @@ unsigned long __clear_user(void __user *to, unsigned long size) ...@@ -183,9 +178,8 @@ unsigned long __clear_user(void __user *to, unsigned long size)
EX_TABLE(1b, 2b) EX_TABLE(1b, 2b)
EX_TABLE(3b, 6b) EX_TABLE(3b, 6b)
EX_TABLE(4b, 6b) EX_TABLE(4b, 6b)
: [size] "+&a" (size), [to] "+&a" (to), : [size] "+&a" (size), [to] "+&a" (to), [rem] "=&a" (rem)
[val] "+a" (val), [rem] "=&a" (rem) : [val] "a" (-4096UL), [zeropg] "a" (empty_zero_page), [spec] "d" (spec.val)
: [zeropg] "a" (empty_zero_page), [spec] "d" (spec.val)
: "cc", "memory", "0"); : "cc", "memory", "0");
return size; return size;
} }
......
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