2019-06-04 11:11:33 +03:00
/* SPDX-License-Identifier: GPL-2.0-only */
2011-02-26 13:49:26 +03:00
/ *
* linux/ a r c h / u n i c o r e 3 2 / l i b / c o p y _ f r o m _ u s e r . S
*
* Code s p e c i f i c t o P K U n i t y S o C a n d U n i C o r e I S A
*
* Copyright ( C ) 2 0 0 1 - 2 0 1 0 G U A N X u e - t a o
* /
# 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 >
/ *
* Prototype :
*
2017-03-28 08:37:07 +03:00
* size_ t r a w _ c o p y _ f r o m _ u s e r ( v o i d * t o , c o n s t v o i d * f r o m , s i z e _ t n )
2011-02-26 13:49:26 +03:00
*
* Purpose :
*
* copy a b l o c k t o k e r n e l m e m o r y f r o m u s e r m e m o r y
*
* Params :
*
* to = k e r n e l m e m o r y
* from = u s e r m e m o r y
* n = n u m b e r o f b y t e s t o c o p y
*
* Return v a l u e :
*
* Number o f b y t e s N O T c o p i e d .
* /
.macro ldr1w ptr r e g a b o r t
ldrusr \ r e g , \ p t r , 4 , a b o r t = \ a b o r t
.endm
.macro ldr4w ptr r e g 1 r e g 2 r e g 3 r e g 4 a b o r t
100 : ldm. w ( \ r e g 1 , \ r e g 2 , \ r e g 3 , \ r e g 4 ) , [ \ p t r ] +
.pushsection _ _ ex_ t a b l e , " a "
.align 3
.long 1 0 0 b, \ a b o r t
.popsection
.endm
.macro ldr8w ptr r e g 1 r e g 2 r e g 3 r e g 4 r e g 5 r e g 6 r e g 7 r e g 8 a b o r t
100 : ldm. w ( \ r e g 1 , \ r e g 2 , \ r e g 3 , \ r e g 4 , \ r e g 5 , \ r e g 6 , \ r e g 7 , \ r e g 8 ) , [ \ p t r ] +
.pushsection _ _ ex_ t a b l e , " a "
.align 3
.long 1 0 0 b, \ a b o r t
.popsection
.endm
.macro ldr1b ptr r e g c o n d =al a b o r t
ldrusr \ r e g , \ p t r , 1 , \ c o n d , a b o r t = \ a b o r t
.endm
.macro str1w ptr r e g a b o r t
stw. w \ r e g , [ \ p t r ] + , #4
.endm
.macro str8w ptr r e g 1 r e g 2 r e g 3 r e g 4 r e g 5 r e g 6 r e g 7 r e g 8 a b o r t
stm. w ( \ r e g 1 , \ r e g 2 , \ r e g 3 , \ r e g 4 , \ r e g 5 , \ r e g 6 , \ r e g 7 , \ r e g 8 ) , [ \ p t r ] +
.endm
.macro str1b ptr r e g c o n d =al a b o r t
.ifnc \ cond, a l
b\ c o n d 2 0 1 f
b 2 0 2 f
.endif
201 : stb. w \ r e g , [ \ p t r ] + , #1
202 :
.endm
.macro enter
mov r3 , #0
stm. w ( r0 , r2 , r3 ) , [ s p - ]
.endm
.macro exit
add s p , s p , #8
ldm. w ( r0 ) , [ s p ] +
mov p c , l r
.endm
.text
2017-03-28 08:37:07 +03:00
ENTRY( r a w _ c o p y _ f r o m _ u s e r )
2011-02-26 13:49:26 +03:00
# include " c o p y _ t e m p l a t e . S "
2017-03-28 08:37:07 +03:00
ENDPROC( r a w _ c o p y _ f r o m _ u s e r )
2011-02-26 13:49:26 +03:00
.pushsection .fixup , " ax"
.align 0
copy_ a b o r t _ p r e a m b l e
2017-03-28 08:37:07 +03:00
ldm. w ( r1 , r2 , r3 ) , [ s p ] +
sub r0 , r0 , r1
rsub r0 , r0 , r2
2011-02-26 13:49:26 +03:00
copy_ a b o r t _ e n d
.popsection