2009-01-09 03:46:40 +03: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 4 , 1 9 9 5 , 1 9 9 6 , 1 9 9 8 , 1 9 9 9 , 2 0 0 2 , 2 0 0 3 R a l f B a e c h l e
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)
2009-01-09 03:46:40 +03:00
* 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
* Copyright ( C ) 1 9 9 9 S i l i c o n G r a p h i c s , I n c .
* Copyright ( C ) 2 0 0 0 M I P S T e c h n o l o g i e s , I n c .
* written b y C a r s t e n L a n g g a a r d , c a r s t e n l @mips.com
* /
2014-05-29 01:52:04 +04:00
# define U S E _ A L T E R N A T E _ R E S U M E _ I M P L 1
.set push
.set arch=mips64r2
# include " r4 k _ s w i t c h . S "
.set pop
2009-01-09 03:46:40 +03:00
/ *
* 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:41 +03:00
* struct t h r e a d _ i n f o * n e x t _ t i )
2009-01-09 03:46:40 +03:00
* /
.align 7
LEAF( r e s u m e )
.set arch=octeon
mfc0 t 1 , C P 0 _ S T A T U S
LONG_ S t 1 , T H R E A D _ S T A T U S ( a0 )
cpu_ s a v e _ n o n s c r a t c h a0
LONG_ S r a , T H R E A D _ R E G 3 1 ( a0 )
# if C O N F I G _ C A V I U M _ O C T E O N _ C V M S E G _ S I Z E > 0
/* Check if we need to store CVMSEG state */
2015-01-15 16:11:08 +03:00
dmfc0 t 0 , $ 1 1 ,7 / * C v m M e m C t l * /
2009-01-09 03:46:40 +03:00
bbit0 t 0 , 6 , 3 f / * I s u s e r a c c e s s e n a b l e d ? * /
/* Store the CVMSEG state */
/* Extract the size of CVMSEG */
andi t 0 , 0 x3 f
/* Multiply * (cache line size/sizeof(long)/2) */
sll t 0 , 7 - L O N G L O G - 1
2013-01-22 15:59:30 +04:00
li t 1 , - 3 2 7 6 8 / * B a s e a d d r e s s o f C V M S E G * /
LONG_ A D D I t 2 , a0 , T H R E A D _ C V M S E G / * W h e r e t o s t o r e C V M S E G t o * /
2009-01-09 03:46:40 +03:00
synciobdma
2 :
.set noreorder
LONG_ L t 8 , 0 ( t 1 ) / * L o a d f r o m C V M S E G * /
subu t 0 , 1 / * D e c r e m e n t l o o p v a r * /
LONG_ L t 9 , L O N G S I Z E ( t 1 ) / * L o a d f r o m C V M S E G * /
LONG_ A D D U t 1 , L O N G S I Z E * 2 / * I n c r e m e n t l o c i n C V M S E G * /
LONG_ S t 8 , 0 ( t 2 ) / * S t o r e C V M S E G t o t h r e a d s t o r a g e * /
LONG_ A D D U t 2 , L O N G S I Z E * 2 / * I n c r e m e n t l o c i n t h r e a d s t o r a g e * /
bnez t 0 , 2 b / * L o o p u n t i l w e ' v e c o p i e d i t a l l * /
2013-01-22 15:59:30 +04:00
LONG_ S t 9 , - L O N G S I Z E ( t 2 ) / * S t o r e C V M S E G t o t h r e a d s t o r a g e * /
2009-01-09 03:46:40 +03:00
.set reorder
/* Disable access to CVMSEG */
2015-01-15 16:11:08 +03:00
dmfc0 t 0 , $ 1 1 ,7 / * C v m M e m C t l * /
2009-01-09 03:46:40 +03:00
xori t 0 , t 0 , 0 x40 / * B i t 6 i s C V M S E G u s e r e n a b l e * /
2015-01-15 16:11:08 +03:00
dmtc0 t 0 , $ 1 1 ,7 / * C v m M e m C t l * /
2009-01-09 03:46:40 +03:00
# endif
3 :
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
2009-01-09 03:46:40 +03: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
2014-05-29 01:52:04 +04:00
PTR_ A D D U t 0 , $ 2 8 , _ T H R E A D _ S I Z E - 3 2
2009-01-09 03:46:40 +03:00
set_ s a v e d _ s p t 0 , t 1 , t 2
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
LONG_ L 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 )
/ *
* void o c t e o n _ c o p2 _ s a v e ( s t r u c t o c t e o n _ c o p2 _ s t a t e * a0 )
* /
.align 7
2015-01-15 16:11:07 +03:00
.set push
.set noreorder
2009-01-09 03:46:40 +03:00
LEAF( o c t e o n _ c o p2 _ s a v e )
dmfc0 t 9 , $ 9 ,7 / * C v m C t l r e g i s t e r . * /
2013-01-22 15:59:30 +04:00
/* Save the COP2 CRC state */
2009-01-09 03:46:40 +03:00
dmfc2 t 0 , 0 x02 0 1
dmfc2 t 1 , 0 x02 0 2
dmfc2 t 2 , 0 x02 0 0
sd t 0 , O C T E O N _ C P 2 _ C R C _ I V ( a0 )
sd t 1 , O C T E O N _ C P 2 _ C R C _ L E N G T H ( a0 )
/* Skip next instructions if CvmCtl[NODFA_CP2] set */
bbit1 t 9 , 2 8 , 1 f
2015-01-15 16:11:07 +03:00
sd t 2 , O C T E O N _ C P 2 _ C R C _ P O L Y ( a0 )
2009-01-09 03:46:40 +03:00
/* Save the LLM state */
dmfc2 t 0 , 0 x04 0 2
dmfc2 t 1 , 0 x04 0 A
sd t 0 , O C T E O N _ C P 2 _ L L M _ D A T ( a0 )
2013-01-22 15:59:30 +04:00
1 : bbit1 t 9 , 2 6 , 3 f / * d o n e i f C v m C t l [ N O C R Y P T O ] s e t * /
2015-01-15 16:11:07 +03:00
sd t 1 , O C T E O N _ C P 2 _ L L M _ D A T + 8 ( a0 )
2009-01-09 03:46:40 +03:00
/* Save the COP2 crypto state */
2013-01-22 15:59:30 +04:00
/* this part is mostly common to both pass 1 and later revisions */
dmfc2 t 0 , 0 x00 8 4
dmfc2 t 1 , 0 x00 8 0
dmfc2 t 2 , 0 x00 8 1
dmfc2 t 3 , 0 x00 8 2
2009-01-09 03:46:40 +03:00
sd t 0 , O C T E O N _ C P 2 _ 3 D E S _ I V ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 0 , 0 x00 8 8
2009-01-09 03:46:40 +03:00
sd t 1 , O C T E O N _ C P 2 _ 3 D E S _ K E Y ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 1 , 0 x01 1 1 / * o n l y n e c e s s a r y f o r p a s s 1 * /
2009-01-09 03:46:40 +03:00
sd t 2 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 8 ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 2 , 0 x01 0 2
2009-01-09 03:46:40 +03:00
sd t 3 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 1 6 ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 3 , 0 x01 0 3
2009-01-09 03:46:40 +03:00
sd t 0 , O C T E O N _ C P 2 _ 3 D E S _ R E S U L T ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 0 , 0 x01 0 4
sd t 1 , O C T E O N _ C P 2 _ A E S _ I N P 0 ( a0 ) / * o n l y n e c e s s a r y f o r p a s s 1 * /
dmfc2 t 1 , 0 x01 0 5
2009-01-09 03:46:40 +03:00
sd t 2 , O C T E O N _ C P 2 _ A E S _ I V ( a0 )
dmfc2 t 2 , 0 x01 0 6
sd t 3 , O C T E O N _ C P 2 _ A E S _ I V + 8 ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 3 , 0 x01 0 7
2009-01-09 03:46:40 +03:00
sd t 0 , O C T E O N _ C P 2 _ A E S _ K E Y ( a0 )
dmfc2 t 0 , 0 x01 1 0
sd t 1 , O C T E O N _ C P 2 _ A E S _ K E Y + 8 ( a0 )
dmfc2 t 1 , 0 x01 0 0
sd t 2 , O C T E O N _ C P 2 _ A E S _ K E Y + 1 6 ( a0 )
dmfc2 t 2 , 0 x01 0 1
sd t 3 , O C T E O N _ C P 2 _ A E S _ K E Y + 2 4 ( a0 )
2015-01-15 16:11:07 +03:00
mfc0 v0 , $ 1 5 ,0 / * G e t t h e p r o c e s s o r I D r e g i s t e r * /
2009-01-09 03:46:40 +03:00
sd t 0 , O C T E O N _ C P 2 _ A E S _ K E Y L E N ( a0 )
2015-01-15 16:11:07 +03:00
li v1 , 0 x00 0 d00 0 0 / * T h i s i s t h e p r o c e s s o r I D o f O c t e o n P a s s1 * /
2009-01-09 03:46:40 +03:00
sd t 1 , O C T E O N _ C P 2 _ A E S _ R E S U L T ( a0 )
/* Skip to the Pass1 version of the remainder of the COP2 state */
2015-01-15 16:11:07 +03:00
beq v0 , v1 , 2 f
sd t 2 , O C T E O N _ C P 2 _ A E S _ R E S U L T + 8 ( a0 )
2009-01-09 03:46:40 +03:00
2013-01-22 15:59:30 +04:00
/* the non-pass1 state when !CvmCtl[NOCRYPTO] */
2009-01-09 03:46:40 +03:00
dmfc2 t 1 , 0 x02 4 0
dmfc2 t 2 , 0 x02 4 1
2015-01-15 16:11:07 +03:00
ori v1 , v1 , 0 x95 0 0 / * l o w e s t O C T E O N I I I P r I d * /
2009-01-09 03:46:40 +03:00
dmfc2 t 3 , 0 x02 4 2
2015-01-15 16:11:07 +03:00
subu v1 , v0 , v1 / * p r i d - l o w e s t O C T E O N I I I P r I d * /
2009-01-09 03:46:40 +03:00
dmfc2 t 0 , 0 x02 4 3
sd t 1 , O C T E O N _ C P 2 _ H S H _ D A T W ( a0 )
dmfc2 t 1 , 0 x02 4 4
sd t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 ( a0 )
dmfc2 t 2 , 0 x02 4 5
sd t 3 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 6 ( a0 )
dmfc2 t 3 , 0 x02 4 6
sd t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 2 4 ( a0 )
dmfc2 t 0 , 0 x02 4 7
sd t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 3 2 ( a0 )
dmfc2 t 1 , 0 x02 4 8
sd t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 0 ( a0 )
dmfc2 t 2 , 0 x02 4 9
sd t 3 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 8 ( a0 )
dmfc2 t 3 , 0 x02 4 A
sd t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 5 6 ( a0 )
dmfc2 t 0 , 0 x02 4 B
sd t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 6 4 ( a0 )
dmfc2 t 1 , 0 x02 4 C
sd t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 7 2 ( a0 )
dmfc2 t 2 , 0 x02 4 D
sd t 3 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 0 ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 3 , 0 x02 4 E
2009-01-09 03:46:40 +03:00
sd t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 8 ( a0 )
dmfc2 t 0 , 0 x02 5 0
sd t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 9 6 ( a0 )
dmfc2 t 1 , 0 x02 5 1
sd t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 0 4 ( a0 )
dmfc2 t 2 , 0 x02 5 2
sd t 3 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 1 2 ( a0 )
dmfc2 t 3 , 0 x02 5 3
sd t 0 , O C T E O N _ C P 2 _ H S H _ I V W ( a0 )
dmfc2 t 0 , 0 x02 5 4
sd t 1 , O C T E O N _ C P 2 _ H S H _ I V W + 8 ( a0 )
dmfc2 t 1 , 0 x02 5 5
sd t 2 , O C T E O N _ C P 2 _ H S H _ I V W + 1 6 ( a0 )
dmfc2 t 2 , 0 x02 5 6
sd t 3 , O C T E O N _ C P 2 _ H S H _ I V W + 2 4 ( a0 )
dmfc2 t 3 , 0 x02 5 7
sd t 0 , O C T E O N _ C P 2 _ H S H _ I V W + 3 2 ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 0 , 0 x02 5 8
2009-01-09 03:46:40 +03:00
sd t 1 , O C T E O N _ C P 2 _ H S H _ I V W + 4 0 ( a0 )
2013-01-22 15:59:30 +04:00
dmfc2 t 1 , 0 x02 5 9
2009-01-09 03:46:40 +03:00
sd t 2 , O C T E O N _ C P 2 _ H S H _ I V W + 4 8 ( a0 )
dmfc2 t 2 , 0 x02 5 E
sd t 3 , O C T E O N _ C P 2 _ H S H _ I V W + 5 6 ( a0 )
dmfc2 t 3 , 0 x02 5 A
sd t 0 , O C T E O N _ C P 2 _ G F M _ M U L T ( a0 )
dmfc2 t 0 , 0 x02 5 B
sd t 1 , O C T E O N _ C P 2 _ G F M _ M U L T + 8 ( a0 )
sd t 2 , O C T E O N _ C P 2 _ G F M _ P O L Y ( a0 )
sd t 3 , O C T E O N _ C P 2 _ G F M _ R E S U L T ( a0 )
2015-01-15 16:11:07 +03:00
bltz v1 , 4 f
sd t 0 , O C T E O N _ C P 2 _ G F M _ R E S U L T + 8 ( a0 )
/* OCTEON III things*/
dmfc2 t 0 , 0 x02 4 F
dmfc2 t 1 , 0 x00 5 0
sd t 0 , O C T E O N _ C P 2 _ S H A 3 ( a0 )
sd t 1 , O C T E O N _ C P 2 _ S H A 3 + 8 ( a0 )
4 :
2009-01-09 03:46:40 +03:00
jr r a
2015-01-15 16:11:07 +03:00
nop
2009-01-09 03:46:40 +03:00
2013-01-22 15:59:30 +04:00
2 : /* pass 1 special stuff when !CvmCtl[NOCRYPTO] */
2009-01-09 03:46:40 +03:00
dmfc2 t 3 , 0 x00 4 0
dmfc2 t 0 , 0 x00 4 1
dmfc2 t 1 , 0 x00 4 2
dmfc2 t 2 , 0 x00 4 3
sd t 3 , O C T E O N _ C P 2 _ H S H _ D A T W ( a0 )
dmfc2 t 3 , 0 x00 4 4
sd t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 ( a0 )
dmfc2 t 0 , 0 x00 4 5
sd t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 6 ( a0 )
dmfc2 t 1 , 0 x00 4 6
sd t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 2 4 ( a0 )
dmfc2 t 2 , 0 x00 4 8
sd t 3 , O C T E O N _ C P 2 _ H S H _ D A T W + 3 2 ( a0 )
dmfc2 t 3 , 0 x00 4 9
sd t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 0 ( a0 )
dmfc2 t 0 , 0 x00 4 A
sd t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 8 ( a0 )
sd t 2 , O C T E O N _ C P 2 _ H S H _ I V W ( a0 )
sd t 3 , O C T E O N _ C P 2 _ H S H _ I V W + 8 ( a0 )
sd t 0 , O C T E O N _ C P 2 _ H S H _ I V W + 1 6 ( a0 )
2013-01-22 15:59:30 +04:00
3 : /* pass 1 or CvmCtl[NOCRYPTO] set */
2009-01-09 03:46:40 +03:00
jr r a
2015-01-15 16:11:07 +03:00
nop
2009-01-09 03:46:40 +03:00
END( o c t e o n _ c o p2 _ s a v e )
2015-01-15 16:11:07 +03:00
.set pop
2009-01-09 03:46:40 +03:00
/ *
* void o c t e o n _ c o p2 _ r e s t o r e ( s t r u c t o c t e o n _ c o p2 _ s t a t e * a0 )
* /
.align 7
.set push
.set noreorder
LEAF( o c t e o n _ c o p2 _ r e s t o r e )
2013-01-22 15:59:30 +04:00
/* First cache line was prefetched before the call */
pref 4 , 1 2 8 ( a0 )
2009-01-09 03:46:40 +03:00
dmfc0 t 9 , $ 9 ,7 / * C v m C t l r e g i s t e r . * /
2013-01-22 15:59:30 +04:00
pref 4 , 2 5 6 ( a0 )
2009-01-09 03:46:40 +03:00
ld t 0 , O C T E O N _ C P 2 _ C R C _ I V ( a0 )
2013-01-22 15:59:30 +04:00
pref 4 , 3 8 4 ( a0 )
2009-01-09 03:46:40 +03:00
ld t 1 , O C T E O N _ C P 2 _ C R C _ L E N G T H ( a0 )
ld t 2 , O C T E O N _ C P 2 _ C R C _ P O L Y ( a0 )
/* Restore the COP2 CRC state */
dmtc2 t 0 , 0 x02 0 1
2013-01-22 15:59:30 +04:00
dmtc2 t 1 , 0 x12 0 2
2009-01-09 03:46:40 +03:00
bbit1 t 9 , 2 8 , 2 f / * S k i p L L M i f C v m C t l [ N O D F A _ C P 2 ] i s s e t * /
dmtc2 t 2 , 0 x42 0 0
/* Restore the LLM state */
ld t 0 , O C T E O N _ C P 2 _ L L M _ D A T ( a0 )
ld t 1 , O C T E O N _ C P 2 _ L L M _ D A T + 8 ( a0 )
dmtc2 t 0 , 0 x04 0 2
dmtc2 t 1 , 0 x04 0 A
2 :
bbit1 t 9 , 2 6 , d o n e _ r e s t o r e / * d o n e i f C v m C t l [ N O C R Y P T O ] s e t * /
nop
/* Restore the COP2 crypto state common to pass 1 and pass 2 */
ld t 0 , O C T E O N _ C P 2 _ 3 D E S _ I V ( a0 )
ld t 1 , O C T E O N _ C P 2 _ 3 D E S _ K E Y ( a0 )
ld t 2 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 8 ( a0 )
2013-01-22 15:59:30 +04:00
dmtc2 t 0 , 0 x00 8 4
2009-01-09 03:46:40 +03:00
ld t 0 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 1 6 ( a0 )
2013-01-22 15:59:30 +04:00
dmtc2 t 1 , 0 x00 8 0
2009-01-09 03:46:40 +03:00
ld t 1 , O C T E O N _ C P 2 _ 3 D E S _ R E S U L T ( a0 )
2013-01-22 15:59:30 +04:00
dmtc2 t 2 , 0 x00 8 1
2009-01-09 03:46:40 +03:00
ld t 2 , O C T E O N _ C P 2 _ A E S _ I N P 0 ( a0 ) / * o n l y r e a l l y n e e d e d f o r p a s s 1 * /
dmtc2 t 0 , 0 x00 8 2
ld t 0 , O C T E O N _ C P 2 _ A E S _ I V ( a0 )
2013-01-22 15:59:30 +04:00
dmtc2 t 1 , 0 x00 9 8
2009-01-09 03:46:40 +03:00
ld t 1 , O C T E O N _ C P 2 _ A E S _ I V + 8 ( a0 )
2013-01-22 15:59:30 +04:00
dmtc2 t 2 , 0 x01 0 A / * o n l y r e a l l y n e e d e d f o r p a s s 1 * /
2009-01-09 03:46:40 +03:00
ld t 2 , O C T E O N _ C P 2 _ A E S _ K E Y ( a0 )
2013-01-22 15:59:30 +04:00
dmtc2 t 0 , 0 x01 0 2
2009-01-09 03:46:40 +03:00
ld t 0 , O C T E O N _ C P 2 _ A E S _ K E Y + 8 ( a0 )
dmtc2 t 1 , 0 x01 0 3
ld t 1 , O C T E O N _ C P 2 _ A E S _ K E Y + 1 6 ( a0 )
dmtc2 t 2 , 0 x01 0 4
ld t 2 , O C T E O N _ C P 2 _ A E S _ K E Y + 2 4 ( a0 )
dmtc2 t 0 , 0 x01 0 5
ld t 0 , O C T E O N _ C P 2 _ A E S _ K E Y L E N ( a0 )
dmtc2 t 1 , 0 x01 0 6
ld t 1 , O C T E O N _ C P 2 _ A E S _ R E S U L T ( a0 )
dmtc2 t 2 , 0 x01 0 7
ld t 2 , O C T E O N _ C P 2 _ A E S _ R E S U L T + 8 ( a0 )
2013-01-22 15:59:30 +04:00
mfc0 t 3 , $ 1 5 ,0 / * G e t t h e p r o c e s s o r I D r e g i s t e r * /
2009-01-09 03:46:40 +03:00
dmtc2 t 0 , 0 x01 1 0
2015-01-15 16:11:07 +03:00
li v0 , 0 x00 0 d00 0 0 / * T h i s i s t h e p r o c e s s o r I D o f O c t e o n P a s s1 * /
2009-01-09 03:46:40 +03:00
dmtc2 t 1 , 0 x01 0 0
2015-01-15 16:11:07 +03:00
bne v0 , t 3 , 3 f / * S k i p t h e n e x t s t u f f f o r n o n - p a s s1 * /
2009-01-09 03:46:40 +03:00
dmtc2 t 2 , 0 x01 0 1
2013-01-22 15:59:30 +04:00
/* this code is specific for pass 1 */
2009-01-09 03:46:40 +03:00
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W ( a0 )
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 ( a0 )
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 6 ( a0 )
dmtc2 t 0 , 0 x00 4 0
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 2 4 ( a0 )
dmtc2 t 1 , 0 x00 4 1
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 3 2 ( a0 )
dmtc2 t 2 , 0 x00 4 2
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 0 ( a0 )
dmtc2 t 0 , 0 x00 4 3
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 8 ( a0 )
dmtc2 t 1 , 0 x00 4 4
ld t 1 , O C T E O N _ C P 2 _ H S H _ I V W ( a0 )
dmtc2 t 2 , 0 x00 4 5
ld t 2 , O C T E O N _ C P 2 _ H S H _ I V W + 8 ( a0 )
dmtc2 t 0 , 0 x00 4 6
ld t 0 , O C T E O N _ C P 2 _ H S H _ I V W + 1 6 ( a0 )
dmtc2 t 1 , 0 x00 4 8
dmtc2 t 2 , 0 x00 4 9
2013-01-22 15:59:30 +04:00
b d o n e _ r e s t o r e / * u n c o n d i t i o n a l b r a n c h * /
2009-01-09 03:46:40 +03:00
dmtc2 t 0 , 0 x00 4 A
2013-01-22 15:59:30 +04:00
3 : /* this is post-pass1 code */
2009-01-09 03:46:40 +03:00
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W ( a0 )
2015-01-15 16:11:07 +03:00
ori v0 , v0 , 0 x95 0 0 / * l o w e s t O C T E O N I I I P r I d * /
2009-01-09 03:46:40 +03:00
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 ( a0 )
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 6 ( a0 )
dmtc2 t 2 , 0 x02 4 0
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 2 4 ( a0 )
dmtc2 t 0 , 0 x02 4 1
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 3 2 ( a0 )
dmtc2 t 1 , 0 x02 4 2
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 0 ( a0 )
dmtc2 t 2 , 0 x02 4 3
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 4 8 ( a0 )
dmtc2 t 0 , 0 x02 4 4
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 5 6 ( a0 )
dmtc2 t 1 , 0 x02 4 5
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 6 4 ( a0 )
dmtc2 t 2 , 0 x02 4 6
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 7 2 ( a0 )
dmtc2 t 0 , 0 x02 4 7
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 0 ( a0 )
dmtc2 t 1 , 0 x02 4 8
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 8 8 ( a0 )
dmtc2 t 2 , 0 x02 4 9
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W + 9 6 ( a0 )
dmtc2 t 0 , 0 x02 4 A
ld t 0 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 0 4 ( a0 )
dmtc2 t 1 , 0 x02 4 B
ld t 1 , O C T E O N _ C P 2 _ H S H _ D A T W + 1 1 2 ( a0 )
dmtc2 t 2 , 0 x02 4 C
ld t 2 , O C T E O N _ C P 2 _ H S H _ I V W ( a0 )
dmtc2 t 0 , 0 x02 4 D
ld t 0 , O C T E O N _ C P 2 _ H S H _ I V W + 8 ( a0 )
dmtc2 t 1 , 0 x02 4 E
ld t 1 , O C T E O N _ C P 2 _ H S H _ I V W + 1 6 ( a0 )
dmtc2 t 2 , 0 x02 5 0
ld t 2 , O C T E O N _ C P 2 _ H S H _ I V W + 2 4 ( a0 )
dmtc2 t 0 , 0 x02 5 1
ld t 0 , O C T E O N _ C P 2 _ H S H _ I V W + 3 2 ( a0 )
dmtc2 t 1 , 0 x02 5 2
ld t 1 , O C T E O N _ C P 2 _ H S H _ I V W + 4 0 ( a0 )
dmtc2 t 2 , 0 x02 5 3
ld t 2 , O C T E O N _ C P 2 _ H S H _ I V W + 4 8 ( a0 )
dmtc2 t 0 , 0 x02 5 4
ld t 0 , O C T E O N _ C P 2 _ H S H _ I V W + 5 6 ( a0 )
dmtc2 t 1 , 0 x02 5 5
ld t 1 , O C T E O N _ C P 2 _ G F M _ M U L T ( a0 )
dmtc2 t 2 , 0 x02 5 6
ld t 2 , O C T E O N _ C P 2 _ G F M _ M U L T + 8 ( a0 )
dmtc2 t 0 , 0 x02 5 7
ld t 0 , O C T E O N _ C P 2 _ G F M _ P O L Y ( a0 )
dmtc2 t 1 , 0 x02 5 8
ld t 1 , O C T E O N _ C P 2 _ G F M _ R E S U L T ( a0 )
dmtc2 t 2 , 0 x02 5 9
ld t 2 , O C T E O N _ C P 2 _ G F M _ R E S U L T + 8 ( a0 )
dmtc2 t 0 , 0 x02 5 E
2015-01-15 16:11:07 +03:00
subu v0 , t 3 , v0 / * p r i d - l o w e s t O C T E O N I I I P r I d * /
2009-01-09 03:46:40 +03:00
dmtc2 t 1 , 0 x02 5 A
2015-01-15 16:11:07 +03:00
bltz v0 , d o n e _ r e s t o r e
dmtc2 t 2 , 0 x02 5 B
/* OCTEON III things*/
ld t 0 , O C T E O N _ C P 2 _ S H A 3 ( a0 )
ld t 1 , O C T E O N _ C P 2 _ S H A 3 + 8 ( a0 )
dmtc2 t 0 , 0 x00 5 1
dmtc2 t 1 , 0 x00 5 0
2009-01-09 03:46:40 +03:00
done_restore :
jr r a
nop
END( o c t e o n _ c o p2 _ r e s t o r e )
.set pop
/ *
* void o c t e o n _ m u l t _ s a v e ( )
* sp i s a s s u m e d t o p o i n t t o a s t r u c t p t _ r e g s
*
2015-01-15 16:11:05 +03:00
* NOTE : This i s c a l l e d i n S A V E _ T E M P i n s t a c k f r a m e . h . I t c a n
* safely m o d i f y v1 ,k 0 , k 1 ,$ 1 0 - $ 1 5 , a n d $ 2 4 . I t w i l l
* be o v e r w r i t t e n w i t h a p r o c e s s o r s p e c i f i c v e r s i o n o f t h e c o d e .
2009-01-09 03:46:40 +03:00
* /
2015-01-15 16:11:05 +03:00
.p2align 7
2009-01-09 03:46:40 +03:00
.set push
.set noreorder
LEAF( o c t e o n _ m u l t _ s a v e )
2015-01-15 16:11:05 +03:00
jr r a
2009-01-09 03:46:40 +03:00
nop
2015-01-15 16:11:05 +03:00
.space 30 * 4 , 0
octeon_mult_save_end :
EXPORT( o c t e o n _ m u l t _ s a v e _ e n d )
END( o c t e o n _ m u l t _ s a v e )
2009-01-09 03:46:40 +03:00
2015-01-15 16:11:05 +03:00
LEAF( o c t e o n _ m u l t _ s a v e 2 )
/* Save the multiplier state OCTEON II and earlier*/
2009-01-09 03:46:40 +03:00
v3 m u l u k 0 , $ 0 , $ 0
v3 m u l u k 1 , $ 0 , $ 0
2013-01-22 15:59:30 +04:00
sd k 0 , P T _ M T P ( s p ) / * P T _ M T P h a s P 0 * /
2009-01-09 03:46:40 +03:00
v3 m u l u k 0 , $ 0 , $ 0
sd k 1 , P T _ M T P + 8 ( s p ) / * P T _ M T P + 8 h a s P 1 * /
ori k 1 , $ 0 , 1
v3 m u l u k 1 , k 1 , $ 0
sd k 0 , P T _ M T P + 1 6 ( s p ) / * P T _ M T P + 1 6 h a s P 2 * /
v3 m u l u k 0 , $ 0 , $ 0
2013-01-22 15:59:30 +04:00
sd k 1 , P T _ M P L ( s p ) / * P T _ M P L h a s M P L 0 * /
2009-01-09 03:46:40 +03:00
v3 m u l u k 1 , $ 0 , $ 0
sd k 0 , P T _ M P L + 8 ( s p ) / * P T _ M P L + 8 h a s M P L 1 * /
jr r a
sd k 1 , P T _ M P L + 1 6 ( s p ) / * P T _ M P L + 1 6 h a s M P L 2 * /
2015-01-15 16:11:05 +03:00
octeon_mult_save2_end :
EXPORT( o c t e o n _ m u l t _ s a v e 2 _ e n d )
END( o c t e o n _ m u l t _ s a v e 2 )
LEAF( o c t e o n _ m u l t _ s a v e 3 )
/* Save the multiplier state OCTEON III */
v3 m u l u $ 1 0 , $ 0 , $ 0 / * r e a d P 0 * /
v3 m u l u $ 1 1 , $ 0 , $ 0 / * r e a d P 1 * /
v3 m u l u $ 1 2 , $ 0 , $ 0 / * r e a d P 2 * /
sd $ 1 0 , P T _ M T P + ( 0 * 8 ) ( s p ) / * s t o r e P 0 * /
v3 m u l u $ 1 0 , $ 0 , $ 0 / * r e a d P 3 * /
sd $ 1 1 , P T _ M T P + ( 1 * 8 ) ( s p ) / * s t o r e P 1 * /
v3 m u l u $ 1 1 , $ 0 , $ 0 / * r e a d P 4 * /
sd $ 1 2 , P T _ M T P + ( 2 * 8 ) ( s p ) / * s t o r e P 2 * /
ori $ 1 3 , $ 0 , 1
v3 m u l u $ 1 2 , $ 0 , $ 0 / * r e a d P 5 * /
sd $ 1 0 , P T _ M T P + ( 3 * 8 ) ( s p ) / * s t o r e P 3 * /
v3 m u l u $ 1 3 , $ 1 3 , $ 0 / * P 4 - P 0 = M P L 5 - M P L 1 , $ 1 3 = M P L 0 * /
sd $ 1 1 , P T _ M T P + ( 4 * 8 ) ( s p ) / * s t o r e P 4 * /
v3 m u l u $ 1 0 , $ 0 , $ 0 / * r e a d M P L 1 * /
sd $ 1 2 , P T _ M T P + ( 5 * 8 ) ( s p ) / * s t o r e P 5 * /
v3 m u l u $ 1 1 , $ 0 , $ 0 / * r e a d M P L 2 * /
sd $ 1 3 , P T _ M P L + ( 0 * 8 ) ( s p ) / * s t o r e M P L 0 * /
v3 m u l u $ 1 2 , $ 0 , $ 0 / * r e a d M P L 3 * /
sd $ 1 0 , P T _ M P L + ( 1 * 8 ) ( s p ) / * s t o r e M P L 1 * /
v3 m u l u $ 1 0 , $ 0 , $ 0 / * r e a d M P L 4 * /
sd $ 1 1 , P T _ M P L + ( 2 * 8 ) ( s p ) / * s t o r e M P L 2 * /
v3 m u l u $ 1 1 , $ 0 , $ 0 / * r e a d M P L 5 * /
sd $ 1 2 , P T _ M P L + ( 3 * 8 ) ( s p ) / * s t o r e M P L 3 * /
sd $ 1 0 , P T _ M P L + ( 4 * 8 ) ( s p ) / * s t o r e M P L 4 * /
2009-01-09 03:46:40 +03:00
jr r a
2015-01-15 16:11:05 +03:00
sd $ 1 1 , P T _ M P L + ( 5 * 8 ) ( s p ) / * s t o r e M P L 5 * /
octeon_mult_save3_end :
EXPORT( o c t e o n _ m u l t _ s a v e 3 _ e n d )
END( o c t e o n _ m u l t _ s a v e 3 )
2009-01-09 03:46:40 +03:00
.set pop
/ *
* void o c t e o n _ m u l t _ r e s t o r e ( )
* sp i s a s s u m e d t o p o i n t t o a s t r u c t p t _ r e g s
*
2015-01-15 16:11:05 +03:00
* NOTE : This i s c a l l e d i n R E S T O R E _ T E M P i n s t a c k f r a m e . h .
2009-01-09 03:46:40 +03:00
* /
2015-01-15 16:11:05 +03:00
.p2align 7
2009-01-09 03:46:40 +03:00
.set push
.set noreorder
LEAF( o c t e o n _ m u l t _ r e s t o r e )
2015-01-15 16:11:05 +03:00
jr r a
nop
.space 30 * 4 , 0
octeon_mult_restore_end :
EXPORT( o c t e o n _ m u l t _ r e s t o r e _ e n d )
END( o c t e o n _ m u l t _ r e s t o r e )
2009-01-09 03:46:40 +03:00
2015-01-15 16:11:05 +03:00
LEAF( o c t e o n _ m u l t _ r e s t o r e 2 )
ld v0 , P T _ M P L ( s p ) / * M P L 0 * /
ld v1 , P T _ M P L + 8 ( s p ) / * M P L 1 * /
ld k 0 , P T _ M P L + 1 6 ( s p ) / * M P L 2 * /
2009-01-09 03:46:40 +03:00
/* Restore the multiplier state */
2015-01-15 16:11:05 +03:00
ld k 1 , P T _ M T P + 1 6 ( s p ) / * P 2 * /
mtm0 v0 / * M P L 0 * /
2009-01-09 03:46:40 +03:00
ld v0 , P T _ M T P + 8 ( s p ) / * P 1 * /
2015-01-15 16:11:05 +03:00
mtm1 v1 / * M P L 1 * /
ld v1 , P T _ M T P ( s p ) / * P 0 * /
mtm2 k 0 / * M P L 2 * /
mtp2 k 1 / * P 2 * /
mtp1 v0 / * P 1 * /
2009-01-09 03:46:40 +03:00
jr r a
2015-01-15 16:11:05 +03:00
mtp0 v1 / * P 0 * /
octeon_mult_restore2_end :
EXPORT( o c t e o n _ m u l t _ r e s t o r e 2 _ e n d )
END( o c t e o n _ m u l t _ r e s t o r e 2 )
LEAF( o c t e o n _ m u l t _ r e s t o r e 3 )
ld $ 1 2 , P T _ M P L + ( 0 * 8 ) ( s p ) / * r e a d M P L 0 * /
ld $ 1 3 , P T _ M P L + ( 3 * 8 ) ( s p ) / * r e a d M P L 3 * /
ld $ 1 0 , P T _ M P L + ( 1 * 8 ) ( s p ) / * r e a d M P L 1 * /
ld $ 1 1 , P T _ M P L + ( 4 * 8 ) ( s p ) / * r e a d M P L 4 * /
.word 0x718d0008
/* mtm0 $12, $13 restore MPL0 and MPL3 */
ld $ 1 2 , P T _ M P L + ( 2 * 8 ) ( s p ) / * r e a d M P L 2 * /
.word 0x714b000c
/* mtm1 $10, $11 restore MPL1 and MPL4 */
ld $ 1 3 , P T _ M P L + ( 5 * 8 ) ( s p ) / * r e a d M P L 5 * /
ld $ 1 0 , P T _ M T P + ( 0 * 8 ) ( s p ) / * r e a d P 0 * /
ld $ 1 1 , P T _ M T P + ( 3 * 8 ) ( s p ) / * r e a d P 3 * /
.word 0x718d000d
/* mtm2 $12, $13 restore MPL2 and MPL5 */
ld $ 1 2 , P T _ M T P + ( 1 * 8 ) ( s p ) / * r e a d P 1 * /
.word 0x714b0009
/* mtp0 $10, $11 restore P0 and P3 */
ld $ 1 3 , P T _ M T P + ( 4 * 8 ) ( s p ) / * r e a d P 4 * /
ld $ 1 0 , P T _ M T P + ( 2 * 8 ) ( s p ) / * r e a d P 2 * /
ld $ 1 1 , P T _ M T P + ( 5 * 8 ) ( s p ) / * r e a d P 5 * /
.word 0x718d000a
/* mtp1 $12, $13 restore P1 and P4 */
2009-01-09 03:46:40 +03:00
jr r a
2015-01-15 16:11:05 +03:00
.word 0x714b000b
/* mtp2 $10, $11 restore P2 and P5 */
octeon_mult_restore3_end :
EXPORT( o c t e o n _ m u l t _ r e s t o r e 3 _ e n d )
END( o c t e o n _ m u l t _ r e s t o r e 3 )
2009-01-09 03:46:40 +03:00
.set pop