2005-04-16 15:20:36 -07: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 8 b y R a l f B a e c h l e
*
* Multi- a r c h a b s t r a c t i o n a n d a s m m a c r o s f o r e a s i e r r e a d i n g :
2011-04-04 14:15:29 -07:00
* Copyright ( C ) 1 9 9 6 D a v i d S . M i l l e r ( d a v e m @davemloft.net)
2005-04-16 15:20:36 -07:00
*
* Further m o d i f i c a t i o n s t o m a k e t h i s w o r k :
* Copyright ( c ) 1 9 9 8 H a r a l d K o e r f g e n
* /
# include < a s m / a s m . h >
2017-06-05 11:21:29 -07:00
# include < a s m / a s m m a c r o . h >
2005-04-16 15:20:36 -07:00
# include < a s m / e r r n o . h >
2017-06-05 11:21:29 -07:00
# include < a s m / e x p o r t . h >
2005-04-16 15:20:36 -07:00
# include < a s m / f p r e g d e f . h >
# include < a s m / m i p s r e g s . h >
2005-09-09 22:32:31 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07:00
# include < a s m / r e g d e f . h >
# define E X ( a ,b ) \
9 : a,## b ; \
.section _ _ ex_ t a b l e ," a " ; \
2016-10-31 16:25:44 +00:00
PTR 9 b ,f a u l t ; \
2005-04-16 15:20:36 -07:00
.previous
2016-10-31 16:27:40 +00:00
# define E X 2 ( a ,b ) \
9 : a,## b ; \
.section _ _ ex_ t a b l e ," a " ; \
PTR 9 b ,b a d _ s t a c k ; \
PTR 9 b + 4 ,b a d _ s t a c k ; \
.previous
2005-04-16 15:20:36 -07:00
.set mips1
2016-10-31 16:27:01 +00:00
2017-06-05 11:21:29 -07:00
/ *
* Save a t h r e a d ' s f p c o n t e x t .
* /
LEAF( _ s a v e _ f p )
EXPORT_ S Y M B O L ( _ s a v e _ f p )
fpu_ s a v e _ s i n g l e a0 , t 1 # c l o b b e r s t 1
jr r a
END( _ s a v e _ f p )
/ *
* Restore a t h r e a d ' s f p c o n t e x t .
* /
LEAF( _ r e s t o r e _ f p )
fpu_ r e s t o r e _ s i n g l e a0 , t 1 # c l o b b e r s t 1
jr r a
END( _ r e s t o r e _ f p )
.set noreorder
2016-10-31 16:27:01 +00:00
/ * *
* _ save_ f p _ c o n t e x t ( ) - s a v e F P c o n t e x t f r o m t h e F P U
* @a0 - pointer to fpregs field of sigcontext
* @a1 - pointer to fpc_csr field of sigcontext
*
* Save F P c o n t e x t , i n c l u d i n g t h e 3 2 F P d a t a r e g i s t e r s a n d t h e F P
* control & s t a t u s r e g i s t e r , f r o m t h e F P U t o s i g n a l c o n t e x t .
* /
2005-04-16 15:20:36 -07:00
LEAF( _ s a v e _ f p _ c o n t e x t )
2014-11-07 14:13:54 +01:00
.set push
SET_ H A R D F L O A T
2005-04-16 15:20:36 -07:00
li v0 , 0 # a s s u m e s u c c e s s
2016-10-31 16:27:01 +00:00
cfc1 t 1 , f c r31
2016-10-31 16:27:40 +00:00
EX2 ( s . d $ f0 , 0 ( a0 ) )
EX2 ( s . d $ f2 , 1 6 ( a0 ) )
EX2 ( s . d $ f4 , 3 2 ( a0 ) )
EX2 ( s . d $ f6 , 4 8 ( a0 ) )
EX2 ( s . d $ f8 , 6 4 ( a0 ) )
EX2 ( s . d $ f10 , 8 0 ( a0 ) )
EX2 ( s . d $ f12 , 9 6 ( a0 ) )
EX2 ( s . d $ f14 , 1 1 2 ( a0 ) )
EX2 ( s . d $ f16 , 1 2 8 ( a0 ) )
EX2 ( s . d $ f18 , 1 4 4 ( a0 ) )
EX2 ( s . d $ f20 , 1 6 0 ( a0 ) )
EX2 ( s . d $ f22 , 1 7 6 ( a0 ) )
EX2 ( s . d $ f24 , 1 9 2 ( a0 ) )
EX2 ( s . d $ f26 , 2 0 8 ( a0 ) )
EX2 ( s . d $ f28 , 2 2 4 ( a0 ) )
EX2 ( s . d $ f30 , 2 4 0 ( a0 ) )
2005-04-16 15:20:36 -07:00
jr r a
2016-10-31 16:27:01 +00:00
EX( s w t 1 , ( a1 ) )
2014-11-07 14:13:54 +01:00
.set pop
2005-04-16 15:20:36 -07:00
END( _ s a v e _ f p _ c o n t e x t )
2016-10-31 16:27:01 +00:00
/ * *
* _ restore_ f p _ c o n t e x t ( ) - r e s t o r e F P c o n t e x t t o t h e F P U
* @a0 - pointer to fpregs field of sigcontext
* @a1 - pointer to fpc_csr field of sigcontext
2005-04-16 15:20:36 -07:00
*
2016-10-31 16:27:01 +00:00
* Restore F P c o n t e x t , i n c l u d i n g t h e 3 2 F P d a t a r e g i s t e r s a n d t h e F P
* control & s t a t u s r e g i s t e r , f r o m s i g n a l c o n t e x t t o t h e F P U .
2005-04-16 15:20:36 -07:00
* /
LEAF( _ r e s t o r e _ f p _ c o n t e x t )
2014-11-07 14:13:54 +01:00
.set push
SET_ H A R D F L O A T
2005-04-16 15:20:36 -07:00
li v0 , 0 # a s s u m e s u c c e s s
2016-10-31 16:27:01 +00:00
EX( l w t 0 , ( a1 ) )
2016-10-31 16:27:40 +00:00
EX2 ( l . d $ f0 , 0 ( a0 ) )
EX2 ( l . d $ f2 , 1 6 ( a0 ) )
EX2 ( l . d $ f4 , 3 2 ( a0 ) )
EX2 ( l . d $ f6 , 4 8 ( a0 ) )
EX2 ( l . d $ f8 , 6 4 ( a0 ) )
EX2 ( l . d $ f10 , 8 0 ( a0 ) )
EX2 ( l . d $ f12 , 9 6 ( a0 ) )
EX2 ( l . d $ f14 , 1 1 2 ( a0 ) )
EX2 ( l . d $ f16 , 1 2 8 ( a0 ) )
EX2 ( l . d $ f18 , 1 4 4 ( a0 ) )
EX2 ( l . d $ f20 , 1 6 0 ( a0 ) )
EX2 ( l . d $ f22 , 1 7 6 ( a0 ) )
EX2 ( l . d $ f24 , 1 9 2 ( a0 ) )
EX2 ( l . d $ f26 , 2 0 8 ( a0 ) )
EX2 ( l . d $ f28 , 2 2 4 ( a0 ) )
EX2 ( l . d $ f30 , 2 4 0 ( a0 ) )
2005-04-16 15:20:36 -07:00
jr r a
2016-10-31 16:27:01 +00:00
ctc1 t 0 , f c r31
2014-11-07 14:13:54 +01:00
.set pop
2005-04-16 15:20:36 -07:00
END( _ r e s t o r e _ f p _ c o n t e x t )
.set reorder
2016-02-23 10:29:20 +00:00
.type fault, @function
2005-04-16 15:20:36 -07:00
.ent fault
fault : li v0 , - E F A U L T
jr r a
.end fault