2005-11-01 22:52:24 +03:00
/ *
* linux/ a r c h / a r m / l i b / c o p y _ t o _ u s e r . S
*
* Author : Nicolas P i t r e
* Created : Sep 2 9 , 2 0 0 5
* Copyright : MontaVista S o f t w a r e , I n c .
*
* 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 .
* /
# 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 :
*
2006-06-21 17:44:52 +04:00
* size_ t _ _ c o p y _ t o _ 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 )
2005-11-01 22:52:24 +03:00
*
* Purpose :
*
* copy a b l o c k t o u s e r m e m o r y f r o m k e r n e l m e m o r y
*
* Params :
*
* to = u s e r m e m o r y
* from = k e r n e l 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 .
* /
2009-07-24 15:32:57 +04:00
# define L D R 1 W _ S H I F T 0
# ifndef C O N F I G _ T H U M B 2 _ K E R N E L
# define S T R 1 W _ S H I F T 0
# else
# define S T R 1 W _ S H I F T 1
# endif
2005-11-01 22:52:24 +03:00
.macro ldr1w ptr r e g a b o r t
2009-07-24 15:32:57 +04:00
W( l d r ) \ r e g , [ \ p t r ] , #4
2005-11-01 22:52:24 +03:00
.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
ldmia \ p t r ! , { \ r e g 1 , \ r e g 2 , \ r e g 3 , \ r e g 4 }
.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
ldmia \ p t r ! , { \ 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 }
.endm
.macro ldr1b ptr r e g c o n d =al a b o r t
ldr\ c o n d \ ( ) b \ r e g , [ \ p t r ] , #1
.endm
.macro str1w ptr r e g a b o r t
2009-07-24 15:32:57 +04:00
strusr \ r e g , \ p t r , 4 , a b o r t = \ a b o r t
2005-11-01 22:52:24 +03:00
.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
str1 w \ p t r , \ r e g 1 , \ a b o r t
str1 w \ p t r , \ r e g 2 , \ a b o r t
str1 w \ p t r , \ r e g 3 , \ a b o r t
str1 w \ p t r , \ r e g 4 , \ a b o r t
str1 w \ p t r , \ r e g 5 , \ a b o r t
str1 w \ p t r , \ r e g 6 , \ a b o r t
str1 w \ p t r , \ r e g 7 , \ a b o r t
str1 w \ p t r , \ r e g 8 , \ a b o r t
.endm
.macro str1b ptr r e g c o n d =al a b o r t
2009-07-24 15:32:57 +04:00
strusr \ r e g , \ p t r , 1 , \ c o n d , a b o r t = \ a b o r t
2005-11-01 22:52:24 +03:00
.endm
.macro enter reg1 r e g 2
mov r3 , #0
stmdb s p ! , { r0 , r2 , r3 , \ r e g 1 , \ r e g 2 }
.endm
.macro exit reg1 r e g 2
add s p , s p , #8
ldmfd s p ! , { r0 , \ r e g 1 , \ r e g 2 }
.endm
.text
2009-03-09 05:34:45 +03:00
ENTRY( _ _ c o p y _ t o _ u s e r _ s t d )
WEAK( _ _ c o p y _ t o _ u s e r )
2005-11-01 22:52:24 +03:00
# include " c o p y _ t e m p l a t e . S "
2008-08-28 14:22:32 +04:00
ENDPROC( _ _ c o p y _ t o _ u s e r )
2010-05-07 13:52:32 +04:00
ENDPROC( _ _ c o p y _ t o _ u s e r _ s t d )
2008-08-28 14:22:32 +04:00
2010-04-19 13:15:03 +04:00
.pushsection .fixup , " ax"
2005-11-01 22:52:24 +03:00
.align 0
copy_ a b o r t _ p r e a m b l e
ldmfd s p ! , { r1 , r2 , r3 }
sub r0 , r0 , r1
rsb r0 , r0 , r2
copy_ a b o r t _ e n d
2010-04-19 13:15:03 +04:00
.popsection
2005-11-01 22:52:24 +03:00