2005-11-01 19:52:22 +00:00
/ *
* linux/ a r c h / a r m / l i b / c l e a r _ u s e r . S
*
* Copyright ( C ) 1 9 9 5 , 1 9 9 6 ,1 9 9 7 ,1 9 9 8 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 .
* /
# 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 >
.text
2006-06-21 14:44:52 +01:00
/ * Prototype : int _ _ c l e a r _ u s e r ( v o i d * a d d r , s i z e _ t s z )
2005-11-01 19:52:22 +00:00
* Purpose : c l e a r s o m e u s e r m e m o r y
* Params : a d d r - u s e r m e m o r y a d d r e s s t o c l e a r
* : sz - n u m b e r o f b y t e s t o c l e a r
* Returns : n u m b e r o f b y t e s N O T c l e a r e d
* /
2009-03-08 22:34:45 -04:00
ENTRY( _ _ c l e a r _ u s e r _ s t d )
WEAK( _ _ c l e a r _ u s e r )
2005-11-01 19:52:22 +00:00
stmfd s p ! , { r1 , l r }
mov r2 , #0
cmp r1 , #4
blt 2 f
ands i p , r0 , #3
beq 1 f
cmp i p , #2
2009-07-24 12:32:57 +01:00
strusr r2 , r0 , 1
strusr r2 , r0 , 1 , l e
strusr r2 , r0 , 1 , l t
2005-11-01 19:52:22 +00:00
rsb i p , i p , #4
sub r1 , r1 , i p @ 7 6 5 4 3 2 1
1 : subs r1 , r1 , #8 @ -1 -2 -3 -4 -5 -6 -7
2009-07-24 12:32:57 +01:00
strusr r2 , r0 , 4 , p l , r e p t =2
2005-11-01 19:52:22 +00:00
bpl 1 b
adds r1 , r1 , #4 @ 3 2 1 0 -1 -2 -3
2009-07-24 12:32:57 +01:00
strusr r2 , r0 , 4 , p l
2005-11-01 19:52:22 +00:00
2 : tst r1 , #2 @ 1x 1x 0x 0x 1x 1x 0x
2009-07-24 12:32:57 +01:00
strusr r2 , r0 , 1 , n e , r e p t =2
2005-11-01 19:52:22 +00:00
tst r1 , #1 @ x1 x0 x1 x0 x1 x0 x1
2009-07-24 12:32:57 +01:00
it n e @ explicit IT needed for the label
2008-08-29 18:31:21 +01:00
USER( s t r n e b t r2 , [ r0 ] )
2005-11-01 19:52:22 +00:00
mov r0 , #0
2006-06-25 11:23:45 +01:00
ldmfd s p ! , { r1 , p c }
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ c l e a r _ u s e r )
2005-11-01 19:52:22 +00:00
.section .fixup , " ax"
.align 0
2006-06-25 11:23:45 +01:00
9001 : ldmfd s p ! , { r0 , p c }
2005-11-01 19:52:22 +00:00
.previous