2011-11-01 03:48:07 +04:00
/ *
* User m e m o r y c o p y i n g r o u t i n e s f o r t h e H e x a g o n K e r n e l
*
2012-09-20 01:22:02 +04:00
* Copyright ( c ) 2 0 1 0 - 2 0 1 1 , T h e L i n u x F o u n d a t i o n . A l l r i g h t s r e s e r v e d .
2011-11-01 03:48:07 +04:00
*
* 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 n d
* only v e r s i o n 2 a s p u b l i s h e d 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 ; if not, write to the Free Software
* Foundation, I n c . , 5 1 F r a n k l i n S t r e e t , F i f t h F l o o r , B o s t o n , M A
* 0 2 1 1 0 - 1 3 0 1 , USA.
* /
/ * The r i g h t w a y t o d o t h i s i n v o l v e s v a l i g n b
* The e a s y w a y t o d o t h i s i s o n l y s p e e d u p s r c / d e s t s i m i l a r a l i g n m e n t .
* /
/ *
* Copy t o / f r o m u s e r a r e t h e s a m e , e x c e p t t h a t f o r p a c k e t s w i t h a l o a d a n d
* a s t o r e , I d o n ' t k n o w h o w t o t e l l w h i c h k i n d o f e x c e p t i o n w e g o t .
* Therefore, w e d u p l i c a t e t h e f u n c t i o n , a n d h a n d l e f a u l t i n g a d d r e s s e s
* differently f o r e a c h f u n c t i o n
* /
/ *
* copy t o u s e r : s t o r e s c a n f a u l t
* /
# define s r c _ s a v r13
# define d s t _ s a v r12
# define s r c _ d s t _ s a v r13 : 1 2
# define d _ d b u f r15 : 1 4
# define w _ d b u f r15
# define d s t r0
# define s r c r1
# define b y t e s r2
# define l o o p c o u n t r5
2017-03-28 08:28:09 +03:00
# define F U N C N A M E r a w _ c o p y _ t o _ u s e r
2011-11-01 03:48:07 +04:00
# include " c o p y _ u s e r _ t e m p l a t e . S "
/* STORE FAULTS from COPY_TO_USER */
.falign
1109 :
2109 :
4109 :
/* Alignment loop. r2 has been updated. Return it. */
{
r0 = r2
jumpr r31
}
/* Normal copy loops. Use dst-dst_sav to compute distance */
/* dst holds best write, no need to unwind any loops */
/* X - (A - B) == X + B - A */
.falign
8189 :
8199 :
4189 :
4199 :
2189 :
2199 :
1189 :
1199 :
{
r2 + = s u b ( d s t _ s a v ,d s t )
}
{
r0 = r2
jumpr r31
}
/* COPY TO USER: only stores can fail */
.section _ _ ex_ t a b l e ," a "
.long 1 1 0 0 b,1 1 0 9 b
.long 2 1 0 0 b,2 1 0 9 b
.long 4 1 0 0 b,4 1 0 9 b
.long 8 1 8 0 b,8 1 8 9 b
.long 8 1 9 0 b,8 1 9 9 b
.long 4 1 8 0 b,4 1 8 9 b
.long 4 1 9 0 b,4 1 9 9 b
.long 2 1 8 0 b,2 1 8 9 b
.long 2 1 9 0 b,2 1 9 9 b
.long 1 1 8 0 b,1 1 8 9 b
.long 1 1 9 0 b,1 1 9 9 b
.previous