2005-04-17 02:20:36 +04:00
/ *
* r2 3 0 0 _ s w i t c h . S : R 2 3 0 0 s p e c i f i c t a s k s w i t c h i n g c o d e .
*
* Copyright ( C ) 1 9 9 4 , 1 9 9 5 , 1 9 9 6 , 1 9 9 9 b y R a l f B a e c h l e
* Copyright ( C ) 1 9 9 4 , 1 9 9 5 , 1 9 9 6 b y A n d r e a s B u s s e
*
* Multi- c p u a b s t r a c t i o n a n d m a c r o s f o r e a s i e r r e a d i n g :
2011-04-05 01:15:29 +04: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-17 02:20:36 +04: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 - 2 0 0 0 H a r a l d K o e r f g e n
* /
# include < a s m / a s m . h >
# include < a s m / c a c h e c t l . h >
2016-11-07 14:14:10 +03:00
# include < a s m / e x p o r t . h >
2005-04-17 02:20:36 +04: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-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 >
# include < a s m / s t a c k f r a m e . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / a s m m a c r o . h >
.set mips1
.align 5
/ *
* task_ s t r u c t * r e s u m e ( t a s k _ s t r u c t * p r e v , t a s k _ s t r u c t * n e x t ,
2015-09-21 20:07:42 +03:00
* struct t h r e a d _ i n f o * n e x t _ t i )
2005-04-17 02:20:36 +04:00
* /
LEAF( r e s u m e )
2007-04-13 21:37:26 +04:00
mfc0 t 1 , C P 0 _ S T A T U S
sw t 1 , T H R E A D _ S T A T U S ( a0 )
2005-04-17 02:20:36 +04:00
cpu_ s a v e _ n o n s c r a t c h a0
sw r a , T H R E A D _ R E G 3 1 ( a0 )
2013-06-17 23:36:07 +04:00
# if d e f i n e d ( C O N F I G _ C C _ S T A C K P R O T E C T O R ) & & ! d e f i n e d ( C O N F I G _ S M P )
2013-10-07 15:14:26 +04:00
PTR_ L A t 8 , _ _ s t a c k _ c h k _ g u a r d
2013-06-17 23:36:07 +04:00
LONG_ L t 9 , T A S K _ S T A C K _ C A N A R Y ( a1 )
LONG_ S t 9 , 0 ( t 8 )
# endif
2005-04-17 02:20:36 +04:00
/ *
* The o r d e r o f r e s t o r i n g t h e r e g i s t e r s t a k e s c a r e o f t h e r a c e
* updating $ 2 8 , $ 2 9 a n d k e r n e l s p w i t h o u t d i s a b l i n g i n t s .
* /
move $ 2 8 , a2
cpu_ r e s t o r e _ n o n s c r a t c h a1
addiu t 1 , $ 2 8 , _ T H R E A D _ S I Z E - 3 2
sw t 1 , k e r n e l s p
mfc0 t 1 , C P 0 _ S T A T U S / * D o w e r e a l l y n e e d t h i s ? * /
li a3 , 0 x f f01
and t 1 , a3
lw a2 , T H R E A D _ S T A T U S ( a1 )
nor a3 , $ 0 , a3
and a2 , a3
or a2 , t 1
mtc0 a2 , C P 0 _ S T A T U S
move v0 , a0
jr r a
END( r e s u m e )