2005-11-01 19:52:24 +00: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 14:44:52 +01: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 19:52:24 +00: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 .
* /
.macro ldr1w ptr r e g a b o r t
ldr \ r e g , [ \ p t r ] , #4
.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
100 : strt \ r e g , [ \ p t r ] , #4
.section _ _ ex_ t a b l e , " a "
.long 1 0 0 b, \ a b o r t
.previous
.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
100 : str\ c o n d \ ( ) b t \ r e g , [ \ p t r ] , #1
.section _ _ ex_ t a b l e , " a "
.long 1 0 0 b, \ a b o r t
.previous
.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
2006-06-21 14:44:52 +01:00
ENTRY( _ _ c o p y _ t o _ u s e r )
2005-11-01 19:52:24 +00:00
# include " c o p y _ t e m p l a t e . S "
.section .fixup , " ax"
.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
.previous