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
* /
# include < a s m / a s m . h >
# include < a s m / c a c h e c t l . h >
# 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 >
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / p a g e . h >
# include < a s m / p g t a b l e - b i t s . h >
# 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 >
/ *
* Offset t o t h e c u r r e n t p r o c e s s s t a t u s f l a g s , t h e f i r s t 3 2 b y t e s o f t h e
* stack a r e n o t u s e d .
* /
# define S T _ O F F ( _ T H R E A D _ S I Z E - 3 2 - P T _ S I Z E + P T _ S T A T U S )
/ *
* 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 ,
* struct t h r e a d _ i n f o * n e x t _ t i )
* /
.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 )
/* check if we need to save COP2 registers */
PTR_ L t 2 , T A S K _ T H R E A D _ I N F O ( a0 )
LONG_ L t 0 , S T _ O F F ( t 2 )
bbit0 t 0 , 3 0 , 1 f
/* Disable COP2 in the stored process state */
li t 1 , S T 0 _ C U 2
xor t 0 , t 1
LONG_ S t 0 , S T _ O F F ( t 2 )
/* Enable COP2 so we can save it */
mfc0 t 0 , C P 0 _ S T A T U S
or t 0 , t 1
mtc0 t 0 , C P 0 _ S T A T U S
/* Save COP2 */
daddu a0 , T H R E A D _ C P 2
jal o c t e o n _ c o p2 _ s a v e
dsubu a0 , T H R E A D _ C P 2
/* Disable COP2 now that we are done */
mfc0 t 0 , C P 0 _ S T A T U S
li t 1 , S T 0 _ C U 2
xor t 0 , t 1
mtc0 t 0 , C P 0 _ S T A T U S
1 :
# 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 */
mfc0 t 0 , $ 1 1 ,7 / * C v m M e m C t l * /
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
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 * /
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 * /
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 * /
.set reorder
/* Disable access to CVMSEG */
mfc0 t 0 , $ 1 1 ,7 / * C v m M e m C t l * /
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 * /
mtc0 t 0 , $ 1 1 ,7 / * C v m M e m C t l * /
# endif
3 :
/ *
* 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
# if ( _ T H R E A D _ S I Z E - 3 2 ) < 0 x80 0 0
PTR_ A D D I U t 0 , $ 2 8 , _ T H R E A D _ S I Z E - 3 2
# else
PTR_ L I t 0 , _ T H R E A D _ S I Z E - 3 2
PTR_ A D D U t 0 , $ 2 8
# endif
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
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 . * /
/* Save the COP2 CRC state */
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 )
sd t 2 , O C T E O N _ C P 2 _ C R C _ P O L Y ( a0 )
/* Skip next instructions if CvmCtl[NODFA_CP2] set */
bbit1 t 9 , 2 8 , 1 f
/* 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 )
sd t 1 , O C T E O N _ C P 2 _ L L M _ D A T + 8 ( a0 )
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 * /
/* Save the COP2 crypto state */
/* 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
sd t 0 , O C T E O N _ C P 2 _ 3 D E S _ I V ( a0 )
dmfc2 t 0 , 0 x00 8 8
sd t 1 , O C T E O N _ C P 2 _ 3 D E S _ K E Y ( a0 )
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 * /
sd t 2 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 8 ( a0 )
dmfc2 t 2 , 0 x01 0 2
sd t 3 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 1 6 ( a0 )
dmfc2 t 3 , 0 x01 0 3
sd t 0 , O C T E O N _ C P 2 _ 3 D E S _ R E S U L T ( a0 )
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
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 )
dmfc2 t 3 , 0 x01 0 7
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 )
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 * /
sd t 0 , O C T E O N _ C P 2 _ A E S _ K E Y L E N ( a0 )
li t 0 , 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 * /
sd t 1 , O C T E O N _ C P 2 _ A E S _ R E S U L T ( a0 )
sd t 2 , O C T E O N _ C P 2 _ A E S _ R E S U L T + 8 ( a0 )
/* Skip to the Pass1 version of the remainder of the COP2 state */
beq t 3 , t 0 , 2 f
/* the non-pass1 state when !CvmCtl[NOCRYPTO] */
dmfc2 t 1 , 0 x02 4 0
dmfc2 t 2 , 0 x02 4 1
dmfc2 t 3 , 0 x02 4 2
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 )
dmfc2 t 3 , 0 x02 4 E
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 )
dmfc2 t 0 , 0 x02 5 8
sd t 1 , O C T E O N _ C P 2 _ H S H _ I V W + 4 0 ( a0 )
dmfc2 t 1 , 0 x02 5 9
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 )
sd t 0 , O C T E O N _ C P 2 _ G F M _ R E S U L T + 8 ( a0 )
jr r a
2 : /* pass 1 special stuff when !CvmCtl[NOCRYPTO] */
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 )
3 : /* pass 1 or CvmCtl[NOCRYPTO] set */
jr r a
END( o c t e o n _ c o p2 _ s a v e )
/ *
* 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 )
/* First cache line was prefetched before the call */
pref 4 , 1 2 8 ( a0 )
dmfc0 t 9 , $ 9 ,7 / * C v m C t l r e g i s t e r . * /
pref 4 , 2 5 6 ( a0 )
ld t 0 , O C T E O N _ C P 2 _ C R C _ I V ( a0 )
pref 4 , 3 8 4 ( a0 )
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
dmtc2 t 1 , 0 x12 0 2
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 )
dmtc2 t 0 , 0 x00 8 4
ld t 0 , O C T E O N _ C P 2 _ 3 D E S _ K E Y + 1 6 ( a0 )
dmtc2 t 1 , 0 x00 8 0
ld t 1 , O C T E O N _ C P 2 _ 3 D E S _ R E S U L T ( a0 )
dmtc2 t 2 , 0 x00 8 1
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 )
dmtc2 t 1 , 0 x00 9 8
ld t 1 , O C T E O N _ C P 2 _ A E S _ I V + 8 ( a0 )
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 * /
ld t 2 , O C T E O N _ C P 2 _ A E S _ K E Y ( a0 )
dmtc2 t 0 , 0 x01 0 2
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 )
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 * /
dmtc2 t 0 , 0 x01 1 0
li t 0 , 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 * /
dmtc2 t 1 , 0 x01 0 0
bne t 0 , 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 * /
dmtc2 t 2 , 0 x01 0 1
/* this code is specific for pass 1 */
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
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 * /
dmtc2 t 0 , 0 x00 4 A
3 : /* this is post-pass1 code */
ld t 2 , O C T E O N _ C P 2 _ H S H _ D A T W ( a0 )
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
dmtc2 t 1 , 0 x02 5 A
dmtc2 t 2 , 0 x02 5 B
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
*
* NOTE : This i s c a l l e d i n S A V E _ S O M E i n s t a c k f r a m e . h . I t c a n o n l y
* safely m o d i f y k 0 a n d k 1 .
* /
.align 7
.set push
.set noreorder
LEAF( o c t e o n _ m u l t _ s a v e )
dmfc0 k 0 , $ 9 ,7 / * C v m C t l r e g i s t e r . * /
bbit1 k 0 , 2 7 , 1 f / * S k i p C v m C t l [ N O M U L ] * /
nop
/* Save the multiplier state */
v3 m u l u k 0 , $ 0 , $ 0
v3 m u l u k 1 , $ 0 , $ 0
sd k 0 , P T _ M T P ( s p ) / * P T _ M T P h a s P 0 * /
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
sd k 1 , P T _ M P L ( s p ) / * P T _ M P L h a s M P L 0 * /
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 * /
1 : /* Resume here if CvmCtl[NOMUL] */
jr r a
END( o c t e o n _ m u l t _ s a v e )
.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
*
* NOTE : This i s c a l l e d i n R E S T O R E _ S O M E i n s t a c k f r a m e . h .
* /
.align 7
.set push
.set noreorder
LEAF( o c t e o n _ m u l t _ r e s t o r e )
dmfc0 k 1 , $ 9 ,7 / * C v m C t l r e g i s t e r . * /
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 * /
bbit1 k 1 , 2 7 , 1 f / * S k i p C v m C t l [ N O M U L ] * /
/* Normally falls through, so no time wasted here */
nop
/* Restore the multiplier state */
ld k 1 , P T _ M T P + 1 6 ( s p ) / * P 2 * /
MTM0 v0 / * M P L 0 * /
ld v0 , P T _ M T P + 8 ( s p ) / * P 1 * /
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 * /
jr r a
MTP0 v1 / * P 0 * /
1 : /* Resume here if CvmCtl[NOMUL] */
jr r a
nop
END( o c t e o n _ m u l t _ r e s t o r e )
.set pop