2005-04-17 06:20:36 +08:00
|
|
|
/* copy_in_user.S: Copy from userspace to userspace.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999, 2000, 2004 David S. Miller (davem@redhat.com)
|
|
|
|
*/
|
|
|
|
|
2009-02-09 14:32:31 +08:00
|
|
|
#include <linux/linkage.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/asi.h>
|
2016-01-17 10:39:30 +08:00
|
|
|
#include <asm/export.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define XCC xcc
|
|
|
|
|
2016-08-16 06:08:18 +08:00
|
|
|
#define EX(x,y,z) \
|
2005-04-17 06:20:36 +08:00
|
|
|
98: x,y; \
|
2006-03-05 15:23:56 +08:00
|
|
|
.section __ex_table,"a";\
|
2005-04-17 06:20:36 +08:00
|
|
|
.align 4; \
|
2016-08-16 06:08:18 +08:00
|
|
|
.word 98b, z; \
|
2005-04-17 06:20:36 +08:00
|
|
|
.text; \
|
|
|
|
.align 4;
|
|
|
|
|
2016-08-16 06:08:18 +08:00
|
|
|
#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)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
.register %g2,#scratch
|
|
|
|
.register %g3,#scratch
|
|
|
|
|
|
|
|
.text
|
2016-08-16 06:08:18 +08:00
|
|
|
__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
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
.align 32
|
|
|
|
|
|
|
|
/* Don't try to get too fancy here, just nice and
|
|
|
|
* simple. This is predominantly used for well aligned
|
|
|
|
* small copies in the compat layer. It is also used
|
|
|
|
* to copy register windows around during thread cloning.
|
|
|
|
*/
|
|
|
|
|
2017-03-22 05:04:45 +08:00
|
|
|
ENTRY(raw_copy_in_user) /* %o0=dst, %o1=src, %o2=len */
|
2005-04-17 06:20:36 +08:00
|
|
|
cmp %o2, 0
|
|
|
|
be,pn %XCC, 85f
|
|
|
|
or %o0, %o1, %o3
|
|
|
|
cmp %o2, 16
|
|
|
|
bleu,a,pn %XCC, 80f
|
|
|
|
or %o3, %o2, %o3
|
|
|
|
|
|
|
|
/* 16 < len <= 64 */
|
|
|
|
andcc %o3, 0x7, %g0
|
|
|
|
bne,pn %XCC, 90f
|
2009-02-09 14:32:31 +08:00
|
|
|
nop
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
andn %o2, 0x7, %o4
|
|
|
|
and %o2, 0x7, %o2
|
|
|
|
1: subcc %o4, 0x8, %o4
|
2016-08-16 06:08:18 +08:00
|
|
|
EX_O4(ldxa [%o1] %asi, %o5)
|
|
|
|
EX_O4(stxa %o5, [%o0] %asi)
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o1, 0x8, %o1
|
2005-04-17 06:20:36 +08:00
|
|
|
bgu,pt %XCC, 1b
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o0, 0x8, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
andcc %o2, 0x4, %g0
|
|
|
|
be,pt %XCC, 1f
|
|
|
|
nop
|
|
|
|
sub %o2, 0x4, %o2
|
2016-08-16 06:08:18 +08:00
|
|
|
EX_O2_4(lduwa [%o1] %asi, %o5)
|
|
|
|
EX_O2_4(stwa %o5, [%o0] %asi)
|
2005-04-17 06:20:36 +08:00
|
|
|
add %o1, 0x4, %o1
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o0, 0x4, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
1: cmp %o2, 0
|
|
|
|
be,pt %XCC, 85f
|
|
|
|
nop
|
|
|
|
ba,pt %xcc, 90f
|
|
|
|
nop
|
|
|
|
|
|
|
|
80: /* 0 < len <= 16 */
|
|
|
|
andcc %o3, 0x3, %g0
|
|
|
|
bne,pn %XCC, 90f
|
2009-02-09 14:32:31 +08:00
|
|
|
nop
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
82:
|
|
|
|
subcc %o2, 4, %o2
|
2016-08-16 06:08:18 +08:00
|
|
|
EX_O2_4(lduwa [%o1] %asi, %g1)
|
|
|
|
EX_O2_4(stwa %g1, [%o0] %asi)
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o1, 4, %o1
|
2005-04-17 06:20:36 +08:00
|
|
|
bgu,pt %XCC, 82b
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o0, 4, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
85: retl
|
|
|
|
clr %o0
|
|
|
|
|
|
|
|
.align 32
|
|
|
|
90:
|
|
|
|
subcc %o2, 1, %o2
|
2016-08-16 06:08:18 +08:00
|
|
|
EX_O2_1(lduba [%o1] %asi, %g1)
|
|
|
|
EX_O2_1(stba %g1, [%o0] %asi)
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o1, 1, %o1
|
2005-04-17 06:20:36 +08:00
|
|
|
bgu,pt %XCC, 90b
|
2009-02-09 14:32:31 +08:00
|
|
|
add %o0, 1, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
retl
|
|
|
|
clr %o0
|
2017-03-22 05:04:45 +08:00
|
|
|
ENDPROC(raw_copy_in_user)
|
|
|
|
EXPORT_SYMBOL(raw_copy_in_user)
|