2005-04-17 02:20:36 +04:00
/ * copy_ i n _ u s e r . S : C o p y f r o m u s e r s p a c e t o u s e r s p a c e .
*
* Copyright ( C ) 1 9 9 9 , 2 0 0 0 , 2 0 0 4 D a v i d S . M i l l e r ( d a v e m @redhat.com)
* /
2009-02-09 09:32:31 +03:00
# include < l i n u x / l i n k a g e . h >
2005-04-17 02:20:36 +04:00
# include < a s m / a s i . h >
# define X C C x c c
# define E X ( x ,y ) \
98 : x,y ; \
2006-03-05 10:23:56 +03:00
.section _ _ ex_ t a b l e ," a " ;\
2005-04-17 02:20:36 +04:00
.align 4 ; \
2009-02-09 09:00:55 +03:00
.word 9 8 b, _ _ r e t l _ o n e ; \
2005-04-17 02:20:36 +04:00
.text ; \
.align 4 ;
.register % g2 ,#s c r a t c h
.register % g3 ,#s c r a t c h
.text
.align 32
/ * Don' t t r y t o g e t t o o f a n c y h e r e , j u s t n i c e a n d
* simple. T h i s i s p r e d o m i n a n t l y u s e d f o r w e l l a l i g n e d
* small c o p i e s i n t h e c o m p a t l a y e r . I t i s a l s o u s e d
* to c o p y r e g i s t e r w i n d o w s a r o u n d d u r i n g t h r e a d c l o n i n g .
* /
2009-02-09 09:32:31 +03:00
ENTRY( _ _ _ c o p y _ i n _ u s e r ) / * % o 0 =dst , % o 1 =src , % o 2 =len * /
2005-04-17 02:20:36 +04:00
cmp % o 2 , 0
be,p n % X C C , 8 5 f
or % o 0 , % o 1 , % o 3
cmp % o 2 , 1 6
bleu,a ,p n % X C C , 8 0 f
or % o 3 , % o 2 , % o 3
/* 16 < len <= 64 */
andcc % o 3 , 0 x7 , % g 0
bne,p n % X C C , 9 0 f
2009-02-09 09:32:31 +03:00
nop
2005-04-17 02:20:36 +04:00
andn % o 2 , 0 x7 , % o 4
and % o 2 , 0 x7 , % o 2
1 : subcc % o 4 , 0 x8 , % o 4
EX( l d x a [ % o 1 ] % a s i , % o 5 )
2009-02-09 09:32:31 +03:00
EX( s t x a % o 5 , [ % o 0 ] % a s i )
add % o 1 , 0 x8 , % o 1
2005-04-17 02:20:36 +04:00
bgu,p t % X C C , 1 b
2009-02-09 09:32:31 +03:00
add % o 0 , 0 x8 , % o 0
2005-04-17 02:20:36 +04:00
andcc % o 2 , 0 x4 , % g 0
be,p t % X C C , 1 f
nop
sub % o 2 , 0 x4 , % o 2
EX( l d u w a [ % o 1 ] % a s i , % o 5 )
2009-02-09 09:32:31 +03:00
EX( s t w a % o 5 , [ % o 0 ] % a s i )
2005-04-17 02:20:36 +04:00
add % o 1 , 0 x4 , % o 1
2009-02-09 09:32:31 +03:00
add % o 0 , 0 x4 , % o 0
2005-04-17 02:20:36 +04:00
1 : cmp % o 2 , 0
be,p t % X C C , 8 5 f
nop
ba,p t % x c c , 9 0 f
nop
80 : /* 0 < len <= 16 */
andcc % o 3 , 0 x3 , % g 0
bne,p n % X C C , 9 0 f
2009-02-09 09:32:31 +03:00
nop
2005-04-17 02:20:36 +04:00
82 :
subcc % o 2 , 4 , % o 2
EX( l d u w a [ % o 1 ] % a s i , % g 1 )
2009-02-09 09:32:31 +03:00
EX( s t w a % g 1 , [ % o 0 ] % a s i )
add % o 1 , 4 , % o 1
2005-04-17 02:20:36 +04:00
bgu,p t % X C C , 8 2 b
2009-02-09 09:32:31 +03:00
add % o 0 , 4 , % o 0
2005-04-17 02:20:36 +04:00
85 : retl
clr % o 0
.align 32
90 :
subcc % o 2 , 1 , % o 2
EX( l d u b a [ % o 1 ] % a s i , % g 1 )
2009-02-09 09:32:31 +03:00
EX( s t b a % g 1 , [ % o 0 ] % a s i )
add % o 1 , 1 , % o 1
2005-04-17 02:20:36 +04:00
bgu,p t % X C C , 9 0 b
2009-02-09 09:32:31 +03:00
add % o 0 , 1 , % o 0
2005-04-17 02:20:36 +04:00
retl
clr % o 0
2009-02-09 09:32:31 +03:00
ENDPROC( _ _ _ c o p y _ i n _ u s e r )