2019-06-03 07:44:50 +02:00
/* SPDX-License-Identifier: GPL-2.0-only */
2012-03-05 11:49:32 +00:00
/ *
* Copyright ( C ) 2 0 1 2 A R M L t d .
* /
# include < l i n u x / l i n k a g e . h >
2015-07-22 19:05:54 +01:00
2016-12-26 04:10:19 -05:00
# include < a s m / a s m - u a c c e s s . h >
2018-12-07 18:08:20 +00:00
# include < a s m / a s s e m b l e r . h >
# include < a s m / c a c h e . h >
2012-03-05 11:49:32 +00:00
/ *
* Copy f r o m u s e r s p a c e t o 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
* /
2015-09-23 11:55:39 -07:00
2020-04-29 19:37:02 +01:00
.macro ldrb1 reg, p t r , v a l
2020-12-02 13:15:54 +00:00
user_ l d s t 9 9 9 8 f , l d t r b , \ r e g , \ p t r , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro strb1 reg, p t r , v a l
strb \ r e g , [ \ p t r ] , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro ldrh1 reg, p t r , v a l
2021-07-12 15:27:46 +01:00
user_ l d s t 9 9 9 7 f , l d t r h , \ r e g , \ p t r , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro strh1 reg, p t r , v a l
strh \ r e g , [ \ p t r ] , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro ldr1 reg, p t r , v a l
2021-07-12 15:27:46 +01:00
user_ l d s t 9 9 9 7 f , l d t r , \ r e g , \ p t r , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro str1 reg, p t r , v a l
str \ r e g , [ \ p t r ] , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro ldp1 reg1 , r e g 2 , p t r , v a l
2021-07-12 15:27:46 +01:00
user_ l d p 9 9 9 7 f , \ r e g 1 , \ r e g 2 , \ p t r , \ v a l
2015-09-23 11:55:39 -07:00
.endm
2020-04-29 19:37:02 +01:00
.macro stp1 reg1 , r e g 2 , p t r , v a l
stp \ r e g 1 , \ r e g 2 , [ \ p t r ] , \ v a l
2015-09-23 11:55:39 -07:00
.endm
end . r e q x5
2021-07-12 15:27:46 +01:00
srcin . r e q x15
2020-01-06 19:58:17 +00:00
SYM_ F U N C _ S T A R T ( _ _ a r c h _ c o p y _ f r o m _ u s e r )
2015-09-23 11:55:39 -07:00
add e n d , x0 , x2
2021-07-12 15:27:46 +01:00
mov s r c i n , x1
2015-09-23 11:55:39 -07:00
# include " c o p y _ t e m p l a t e . S "
mov x0 , #0 / / N o t h i n g t o c o p y
2012-03-05 11:49:32 +00:00
ret
2020-01-06 19:58:17 +00:00
SYM_ F U N C _ E N D ( _ _ a r c h _ c o p y _ f r o m _ u s e r )
2018-12-07 18:08:20 +00:00
EXPORT_ S Y M B O L ( _ _ a r c h _ c o p y _ f r o m _ u s e r )
2012-03-05 11:49:32 +00:00
.section .fixup , " ax"
.align 2
2021-07-12 15:27:46 +01:00
9997 : cmp d s t , d s t i n
b. n e 9 9 9 8 f
/ / Before b e i n g a b s o l u t e l y s u r e w e c o u l d n ' t c o p y a n y t h i n g , t r y h a r d e r
USER( 9 9 9 8 f , l d t r b t m p1 w , [ s r c i n ] )
strb t m p1 w , [ d s t ] , #1
2016-09-10 16:50:00 -04:00
9998 : sub x0 , e n d , d s t / / b y t e s n o t c o p i e d
2012-03-05 11:49:32 +00:00
ret
.previous