2005-04-17 02:20:36 +04:00
/ *
* This f i l e i s s u b j e c t t o t h e t e r m s a n d c o n d i t i o n s o f t h e G N U G e n e r a l P u b l i c
* License. S e e t h e f i l e " C O P Y I N G " i n t h e m a i n d i r e c t o r y o f t h i s a r c h i v e
* for m o r e d e t a i l s .
*
* Copyright ( c ) 1 9 9 6 , 1 9 9 9 b y R a l f B a e c h l e
* /
# include < l i n u x / e r r n o . h >
# include < a s m / a s m . h >
2005-09-10 00:32:31 +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
# include < a s m / r e g d e f . h >
# define E X ( i n s n ,r e g ,a d d r ,h a n d l e r ) \
9 : insn r e g , a d d r ; \
.section _ _ ex_ t a b l e ," a " ; \
PTR 9 b , h a n d l e r ; \
.previous
/ *
* Returns : - EFAULT i f e x c e p t i o n b e f o r e t e r m i n a t o r , N i f t h e e n t i r e
* buffer f i l l e d , e l s e s t r l e n .
* /
/ *
* Ugly s p e c i a l c a s e h a v e t o c h e c k : w e m i g h t g e t p a s s e d a u s e r s p a c e
* pointer w h i c h w r a p s i n t o t h e k e r n e l s p a c e . W e d o n ' t d e a l w i t h t h a t . I f
* it h a p p e n s a t m o s t s o m e b y t e s o f t h e e x c e p t i o n s h a n d l e r s w i l l b e c o p i e d .
* /
LEAF( _ _ s t r n c p y _ f r o m _ u s e r _ a s m )
LONG_ L v0 , T I _ A D D R _ L I M I T ( $ 2 8 ) # p o i n t e r o k ?
and v0 , a1
2008-01-29 13:14:59 +03:00
bnez v0 , . L f a u l t
2005-04-17 02:20:36 +04:00
FEXPORT( _ _ s t r n c p y _ f r o m _ u s e r _ n o c h e c k _ a s m )
move v0 , z e r o
move v1 , a1
.set noreorder
2008-01-29 13:14:59 +03:00
1 : EX( l b u , t 0 , ( v1 ) , . L f a u l t )
2005-04-17 02:20:36 +04:00
PTR_ A D D I U v1 , 1
2007-11-25 13:47:56 +03:00
R1 0 K C B A R R I E R ( 0 ( r a ) )
2005-04-17 02:20:36 +04:00
beqz t 0 , 2 f
sb t 0 , ( a0 )
PTR_ A D D I U v0 , 1
.set reorder
2007-10-23 15:43:25 +04:00
PTR_ A D D I U a0 , 1
bne v0 , a2 , 1 b
2005-04-17 02:20:36 +04:00
2 : PTR_ A D D U t 0 , a1 , v0
xor t 0 , a1
2008-01-29 13:14:59 +03:00
bltz t 0 , . L f a u l t
2005-04-17 02:20:36 +04:00
jr r a # r e t u r n n
END( _ _ s t r n c p y _ f r o m _ u s e r _ a s m )
2008-01-29 13:14:59 +03:00
.Lfault : li v0 , - E F A U L T
2005-04-17 02:20:36 +04:00
jr r a
.section _ _ ex_ t a b l e ," a "
2008-01-29 13:14:59 +03:00
PTR 1 b , . L f a u l t
2005-04-17 02:20:36 +04:00
.previous