Commit 620ec410 authored by David S. Miller's avatar David S. Miller Committed by Greg Kroah-Hartman

sparc64: Convert copy_in_user to accurate exception reporting.

[ Upstream commit 0096ac9f ]

Report the exact number of bytes which have not been successfully
copied when an exception occurs, using the running remaining length.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bf4d0da8
...@@ -8,18 +8,33 @@ ...@@ -8,18 +8,33 @@
#define XCC xcc #define XCC xcc
#define EX(x,y) \ #define EX(x,y,z) \
98: x,y; \ 98: x,y; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_mone; \ .word 98b, z; \
.text; \ .text; \
.align 4; .align 4;
#define EX_O4(x,y) EX(x,y,__retl_o4_plus_8)
#define EX_O2_4(x,y) EX(x,y,__retl_o2_plus_4)
#define EX_O2_1(x,y) EX(x,y,__retl_o2_plus_1)
.register %g2,#scratch .register %g2,#scratch
.register %g3,#scratch .register %g3,#scratch
.text .text
__retl_o4_plus_8:
add %o4, %o2, %o4
retl
add %o4, 8, %o0
__retl_o2_plus_4:
retl
add %o2, 4, %o0
__retl_o2_plus_1:
retl
add %o2, 1, %o0
.align 32 .align 32
/* Don't try to get too fancy here, just nice and /* Don't try to get too fancy here, just nice and
...@@ -44,8 +59,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */ ...@@ -44,8 +59,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */
andn %o2, 0x7, %o4 andn %o2, 0x7, %o4
and %o2, 0x7, %o2 and %o2, 0x7, %o2
1: subcc %o4, 0x8, %o4 1: subcc %o4, 0x8, %o4
EX(ldxa [%o1] %asi, %o5) EX_O4(ldxa [%o1] %asi, %o5)
EX(stxa %o5, [%o0] %asi) EX_O4(stxa %o5, [%o0] %asi)
add %o1, 0x8, %o1 add %o1, 0x8, %o1
bgu,pt %XCC, 1b bgu,pt %XCC, 1b
add %o0, 0x8, %o0 add %o0, 0x8, %o0
...@@ -53,8 +68,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */ ...@@ -53,8 +68,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */
be,pt %XCC, 1f be,pt %XCC, 1f
nop nop
sub %o2, 0x4, %o2 sub %o2, 0x4, %o2
EX(lduwa [%o1] %asi, %o5) EX_O2_4(lduwa [%o1] %asi, %o5)
EX(stwa %o5, [%o0] %asi) EX_O2_4(stwa %o5, [%o0] %asi)
add %o1, 0x4, %o1 add %o1, 0x4, %o1
add %o0, 0x4, %o0 add %o0, 0x4, %o0
1: cmp %o2, 0 1: cmp %o2, 0
...@@ -70,8 +85,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */ ...@@ -70,8 +85,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */
82: 82:
subcc %o2, 4, %o2 subcc %o2, 4, %o2
EX(lduwa [%o1] %asi, %g1) EX_O2_4(lduwa [%o1] %asi, %g1)
EX(stwa %g1, [%o0] %asi) EX_O2_4(stwa %g1, [%o0] %asi)
add %o1, 4, %o1 add %o1, 4, %o1
bgu,pt %XCC, 82b bgu,pt %XCC, 82b
add %o0, 4, %o0 add %o0, 4, %o0
...@@ -82,8 +97,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */ ...@@ -82,8 +97,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */
.align 32 .align 32
90: 90:
subcc %o2, 1, %o2 subcc %o2, 1, %o2
EX(lduba [%o1] %asi, %g1) EX_O2_1(lduba [%o1] %asi, %g1)
EX(stba %g1, [%o0] %asi) EX_O2_1(stba %g1, [%o0] %asi)
add %o1, 1, %o1 add %o1, 1, %o1
bgu,pt %XCC, 90b bgu,pt %XCC, 90b
add %o0, 1, %o0 add %o0, 1, %o0
......
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