2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / l i b / c o p y p a g e . S
*
* Copyright ( C ) 1 9 9 5 - 1 9 9 9 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 .
*
* ASM o p t i m i s e d s t r i n g f u n c t i o n s
* /
# include < l i n u x / l i n k a g e . h >
# include < l i n u x / i n i t . h >
2005-09-09 23:08:59 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
.text
.align 5
/ *
* ARMv4 o p t i m i s e d c o p y _ u s e r _ p a g e
*
* We f l u s h t h e d e s t i n a t i o n c a c h e l i n e s j u s t b e f o r e w e w r i t e t h e d a t a i n t o t h e
* corresponding a d d r e s s . S i n c e t h e D c a c h e i s r e a d - a l l o c a t e , t h i s r e m o v e s t h e
* Dcache a l i a s i n g i s s u e . T h e w r i t e s w i l l b e f o r w a r d e d t o t h e w r i t e b u f f e r ,
* and m e r g e d a s a p p r o p r i a t e .
*
* Note : We r e l y o n a l l A R M v4 p r o c e s s o r s i m p l e m e n t i n g t h e " i n v a l i d a t e D l i n e "
* instruction. I f y o u r p r o c e s s o r d o e s n o t s u p p l y t h i s , y o u h a v e t o w r i t e y o u r
* own c o p y _ u s e r _ p a g e t h a t d o e s t h e r i g h t t h i n g .
* /
ENTRY( v4 w b _ c o p y _ u s e r _ p a g e )
stmfd s p ! , { r4 , l r } @ 2
mov r2 , #P A G E _ S Z / 64 @ 1
ldmia r1 ! , { r3 , r4 , i p , l r } @ 4
1 : mcr p15 , 0 , r0 , c7 , c6 , 1 @ 1 invalidate D line
stmia r0 ! , { r3 , r4 , i p , l r } @ 4
ldmia r1 ! , { r3 , r4 , i p , l r } @ 4+1
stmia r0 ! , { r3 , r4 , i p , l r } @ 4
ldmia r1 ! , { r3 , r4 , i p , l r } @ 4
mcr p15 , 0 , r0 , c7 , c6 , 1 @ 1 invalidate D line
stmia r0 ! , { r3 , r4 , i p , l r } @ 4
ldmia r1 ! , { r3 , r4 , i p , l r } @ 4
subs r2 , r2 , #1 @ 1
stmia r0 ! , { r3 , r4 , i p , l r } @ 4
ldmneia r1 ! , { r3 , r4 , i p , l r } @ 4
bne 1 b @ 1
mcr p15 , 0 , r1 , c7 , c10 , 4 @ 1 drain WB
ldmfd s p ! , { r4 , p c } @ 3
.align 5
/ *
* ARMv4 o p t i m i s e d c l e a r _ u s e r _ p a g e
*
* Same s t o r y a s a b o v e .
* /
ENTRY( v4 w b _ c l e a r _ u s e r _ p a g e )
str l r , [ s p , #- 4 ] !
mov r1 , #P A G E _ S Z / 64 @ 1
mov r2 , #0 @ 1
mov r3 , #0 @ 1
mov i p , #0 @ 1
mov l r , #0 @ 1
1 : mcr p15 , 0 , r0 , c7 , c6 , 1 @ 1 invalidate D line
stmia r0 ! , { r2 , r3 , i p , l r } @ 4
stmia r0 ! , { r2 , r3 , i p , l r } @ 4
mcr p15 , 0 , r0 , c7 , c6 , 1 @ 1 invalidate D line
stmia r0 ! , { r2 , r3 , i p , l r } @ 4
stmia r0 ! , { r2 , r3 , i p , l r } @ 4
subs r1 , r1 , #1 @ 1
bne 1 b @ 1
mcr p15 , 0 , r1 , c7 , c10 , 4 @ 1 drain WB
ldr p c , [ s p ] , #4
_ _ INITDATA
.type v4 w b _ u s e r _ f n s , #o b j e c t
ENTRY( v4 w b _ u s e r _ f n s )
.long v4wb_clear_user_page
.long v4wb_copy_user_page
.size v4 w b _ u s e r _ f n s , . - v4 w b _ u s e r _ f n s