2012-03-05 15:49:32 +04:00
/ *
* Based o n a r c h / a r m / l i b / c l e a r _ u s e r . S
*
* Copyright ( C ) 2 0 1 2 A R M L t d .
*
* 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 .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y 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
* along w i t h t h i s p r o g r a m . I f n o t , s e e < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > .
* /
# include < l i n u x / l i n k a g e . h >
2015-07-22 21:05:54 +03:00
2016-12-26 12:10:19 +03:00
# include < a s m / a s m - u a c c e s s . h >
2012-03-05 15:49:32 +04:00
.text
/ * 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 )
* 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
*
* Alignment f i x e d u p b y h a r d w a r e .
* /
ENTRY( _ _ c l e a r _ u s e r )
2016-07-01 16:58:21 +03:00
uaccess_ e n a b l e _ n o t _ u a o x2 , x3
2012-03-05 15:49:32 +04:00
mov x2 , x1 / / s a v e t h e s i z e f o r f i x u p r e t u r n
subs x1 , x1 , #8
b. m i 2 f
1 :
2016-02-05 17:58:48 +03:00
uao_ u s e r _ a l t e r n a t i v e 9 f , s t r , s t t r , x z r , x0 , 8
2012-03-05 15:49:32 +04:00
subs x1 , x1 , #8
b. p l 1 b
2 : adds x1 , x1 , #4
b. m i 3 f
2016-02-05 17:58:48 +03:00
uao_ u s e r _ a l t e r n a t i v e 9 f , s t r , s t t r , w z r , x0 , 4
2012-03-05 15:49:32 +04:00
sub x1 , x1 , #4
3 : adds x1 , x1 , #2
b. m i 4 f
2016-02-05 17:58:48 +03:00
uao_ u s e r _ a l t e r n a t i v e 9 f , s t r h , s t t r h , w z r , x0 , 2
2012-03-05 15:49:32 +04:00
sub x1 , x1 , #2
4 : adds x1 , x1 , #1
b. m i 5 f
2016-02-05 17:58:48 +03:00
uao_ u s e r _ a l t e r n a t i v e 9 f , s t r b , s t t r b , w z r , x0 , 0
2012-03-05 15:49:32 +04:00
5 : mov x0 , #0
2016-07-01 16:58:21 +03:00
uaccess_ d i s a b l e _ n o t _ u a o x2
2012-03-05 15:49:32 +04:00
ret
ENDPROC( _ _ c l e a r _ u s e r )
.section .fixup , " ax"
.align 2
9 : mov x0 , x2 / / r e t u r n t h e o r i g i n a l s i z e
ret
.previous