2012-03-05 15:49:32 +04:00
/ *
* Copyright ( C ) 2 0 1 2 A R M L t d .
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m . I f n o t , s e e < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > .
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
/ *
* Copy t o u s e r s p a c e f r o m a k e r n e l b u f f e r ( a l i g n m e n t h a n d l e d b y t h e h a r d w a r e )
*
* Parameters :
* x0 - t o
* x1 - f r o m
* x2 - n
* Returns :
* x0 - b y t e s n o t c o p i e d
* /
ENTRY( _ _ c o p y _ t o _ u s e r )
2015-06-02 17:18:38 +03:00
add x5 , x0 , x2 / / u p p e r u s e r b u f f e r b o u n d a r y
subs x2 , x2 , #16
b. m i 1 f
0 :
ldp x3 , x4 , [ x1 ] , #16
subs x2 , x2 , #16
USER( 9 f , s t p x3 , x4 , [ x0 ] , #16 )
b. p l 0 b
1 : adds x2 , x2 , #8
2012-03-05 15:49:32 +04:00
b. m i 2 f
ldr x3 , [ x1 ] , #8
2015-06-02 17:18:38 +03:00
sub x2 , x2 , #8
2012-03-05 15:49:32 +04:00
USER( 9 f , s t r x3 , [ x0 ] , #8 )
2 : adds x2 , x2 , #4
b. m i 3 f
ldr w3 , [ x1 ] , #4
sub x2 , x2 , #4
USER( 9 f , s t r w3 , [ x0 ] , #4 )
3 : adds x2 , x2 , #2
b. m i 4 f
ldrh w3 , [ x1 ] , #2
sub x2 , x2 , #2
USER( 9 f , s t r h w3 , [ x0 ] , #2 )
4 : adds x2 , x2 , #1
b. m i 5 f
ldrb w3 , [ x1 ]
USER( 9 f , s t r b w3 , [ x0 ] )
5 : mov x0 , #0
ret
ENDPROC( _ _ c o p y _ t o _ u s e r )
.section .fixup , " ax"
.align 2
2015-06-02 17:18:38 +03:00
9 : sub x0 , x5 , x0 / / b y t e s n o t c o p i e d
2012-03-05 15:49:32 +04:00
ret
.previous