2011-10-31 18:48:07 -05:00
/ *
* User m e m o r y c o p y f u n c t i o n s f o r k e r n e l
*
2012-09-19 16:22:02 -05: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-10-31 18:48:07 -05: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 f r o m u s e r : l o a d 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
# define F U N C N A M E _ _ c o p y _ f r o m _ u s e r _ h e x a g o n
# include " c o p y _ u s e r _ t e m p l a t e . S "
/* LOAD FAULTS from COPY_FROM_USER */
/* Alignment loop. r2 has been updated. Return it. */
.falign
1009 :
2009 :
4009 :
{
r0 = r2
jumpr r31
}
/* Normal copy loops. Do epilog. Use src-src_sav to compute distance */
/* X - (A - B) == X + B - A */
.falign
8089 :
{
memd( d s t ) = d _ d b u f
r2 + = s u b ( s r c _ s a v ,s r c )
}
{
r0 = r2
jumpr r31
}
.falign
4089 :
{
memw( d s t ) = w _ d b u f
r2 + = s u b ( s r c _ s a v ,s r c )
}
{
r0 = r2
jumpr r31
}
.falign
2089 :
{
memh( d s t ) = w _ d b u f
r2 + = s u b ( s r c _ s a v ,s r c )
}
{
r0 = r2
jumpr r31
}
.falign
1089 :
{
memb( d s t ) = w _ d b u f
r2 + = s u b ( s r c _ s a v ,s r c )
}
{
r0 = r2
jumpr r31
}
/* COPY FROM USER: only loads can fail */
.section _ _ ex_ t a b l e ," a "
.long 1 0 0 0 b,1 0 0 9 b
.long 2 0 0 0 b,2 0 0 9 b
.long 4 0 0 0 b,4 0 0 9 b
.long 8 0 8 0 b,8 0 8 9 b
.long 4 0 8 0 b,4 0 8 9 b
.long 2 0 8 0 b,2 0 8 9 b
.long 1 0 8 0 b,1 0 8 9 b
.previous