2005-04-16 15:20:36 -07:00
/ *
* linux/ a r c h / a r m / l i b / p u t u s e r . S
*
* Copyright ( C ) 2 0 0 1 R u s s e l l K i n g
*
* 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 .
*
* Idea f r o m x86 v e r s i o n , ( C ) C o p y r i g h t 1 9 9 8 L i n u s T o r v a l d s
*
* These f u n c t i o n s h a v e a n o n - s t a n d a r d c a l l i n t e r f a c e t o m a k e
* them m o r e e f f i c i e n t , e s p e c i a l l y a s t h e y r e t u r n a n e r r o r
* value i n a d d i t i o n t o t h e " r e a l " r e t u r n v a l u e .
*
* _ _ put_ u s e r _ X
*
* Inputs : r0 c o n t a i n s t h e a d d r e s s
* r2 , r3 c o n t a i n s t h e v a l u e
* Outputs : r0 i s t h e e r r o r c o d e
* lr c o r r u p t e d
*
2008-08-02 10:55:55 +01:00
* No o t h e r r e g i s t e r s m u s t b e a l t e r e d . ( s e e < a s m / u a c c e s s . h >
2005-04-16 15:20:36 -07:00
* for s p e c i f i c A S M r e g i s t e r u s a g e ) .
*
* Note t h a t A D D R _ L I M I T i s e i t h e r 0 o r 0 x c00 0 0 0 0 0
* Note a l s o t h a t i t i s i n t e n d e d t h a t _ _ p u t _ u s e r _ b a d i s n o t g l o b a l .
* /
2008-08-28 11:22:32 +01:00
# include < l i n u x / l i n k a g e . h >
2005-04-16 15:20:36 -07:00
# include < a s m / e r r n o . h >
2008-08-28 11:22:32 +01:00
ENTRY( _ _ p u t _ u s e r _ 1 )
2005-04-16 15:20:36 -07:00
1 : strbt r2 , [ r0 ]
mov r0 , #0
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ p u t _ u s e r _ 1 )
2005-04-16 15:20:36 -07:00
2008-08-28 11:22:32 +01:00
ENTRY( _ _ p u t _ u s e r _ 2 )
2005-04-16 15:20:36 -07:00
mov i p , r2 , l s r #8
2009-07-24 12:32:57 +01:00
# ifdef C O N F I G _ T H U M B 2 _ K E R N E L
# ifndef _ _ A R M E B _ _
2 : strbt r2 , [ r0 ]
3 : strbt i p , [ r0 , #1 ]
# else
2 : strbt i p , [ r0 ]
3 : strbt r2 , [ r0 , #1 ]
# endif
# else / * ! C O N F I G _ T H U M B 2 _ K E R N E L * /
2005-04-16 15:20:36 -07:00
# ifndef _ _ A R M E B _ _
2 : strbt r2 , [ r0 ] , #1
3 : strbt i p , [ r0 ]
# else
2 : strbt i p , [ r0 ] , #1
3 : strbt r2 , [ r0 ]
# endif
2009-07-24 12:32:57 +01:00
# endif / * C O N F I G _ T H U M B 2 _ K E R N E L * /
2005-04-16 15:20:36 -07:00
mov r0 , #0
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ p u t _ u s e r _ 2 )
2005-04-16 15:20:36 -07:00
2008-08-28 11:22:32 +01:00
ENTRY( _ _ p u t _ u s e r _ 4 )
2005-04-16 15:20:36 -07:00
4 : strt r2 , [ r0 ]
mov r0 , #0
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ p u t _ u s e r _ 4 )
2005-04-16 15:20:36 -07:00
2008-08-28 11:22:32 +01:00
ENTRY( _ _ p u t _ u s e r _ 8 )
2009-07-24 12:32:57 +01:00
# ifdef C O N F I G _ T H U M B 2 _ K E R N E L
5 : strt r2 , [ r0 ]
6 : strt r3 , [ r0 , #4 ]
# else
2005-04-16 15:20:36 -07:00
5 : strt r2 , [ r0 ] , #4
6 : strt r3 , [ r0 ]
2009-07-24 12:32:57 +01:00
# endif
2005-04-16 15:20:36 -07:00
mov r0 , #0
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ p u t _ u s e r _ 8 )
2005-04-16 15:20:36 -07:00
__put_user_bad :
mov r0 , #- E F A U L T
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ p u t _ u s e r _ b a d )
2005-04-16 15:20:36 -07:00
2010-04-19 10:15:03 +01:00
.pushsection _ _ ex_ t a b l e , " a "
2005-04-16 15:20:36 -07:00
.long 1 b, _ _ p u t _ u s e r _ b a d
.long 2 b, _ _ p u t _ u s e r _ b a d
.long 3 b, _ _ p u t _ u s e r _ b a d
.long 4 b, _ _ p u t _ u s e r _ b a d
.long 5 b, _ _ p u t _ u s e r _ b a d
.long 6 b, _ _ p u t _ u s e r _ b a d
2010-04-19 10:15:03 +01:00
.popsection