2010-07-24 21:16:05 +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 .
*
2017-08-29 18:40:32 +03:00
* Copyright ( C ) 2 0 0 7 - 2 0 1 7 C a v i u m , I n c .
2010-07-24 21:16:05 +04:00
* /
# include < a s m / a s m . h >
# include < a s m / r e g d e f . h >
2017-08-29 18:40:32 +03:00
# define C V M S E G _ B A S E - 3 2 7 6 8
# define C V M S E G _ S I Z E 6 9 1 2
# define S A V E _ R E G ( r ) s d $ r , C V M S E G _ B A S E + C V M S E G _ S I Z E - ( ( 3 2 - r ) * 8 ) ( $ 0 )
2010-07-24 21:16:05 +04:00
NESTED( o c t e o n _ w d t _ n m i _ s t a g e 2 , 0 , s p )
.set push
.set noreorder
.set noat
2017-08-29 18:40:32 +03:00
/* Clear Dcache so cvmseg works right. */
cache 1 ,0 ( $ 0 )
/* Use K0 to do a read/modify/write of CVMMEMCTL */
dmfc0 k 0 , $ 1 1 , 7
/* Clear out the size of CVMSEG */
dins k 0 , $ 0 , 0 , 6
/* Set CVMSEG to its largest value */
ori k 0 , k 0 , 0 x1 c0 | 5 4
/* Store the CVMMEMCTL value */
dmtc0 k 0 , $ 1 1 , 7
/ *
* Restore K 0 f r o m t h e d e b u g s c r a t c h r e g i s t e r , i t w a s s a v e d i n
* the b o o t - v e c t o r c o d e .
* /
dmfc0 k 0 , $ 3 1
/ *
* Save a l l r e g i s t e r s t o t h e t o p C V M S E G . T h i s s h o u l d n ' t
2010-07-24 21:16:05 +04:00
* corrupt a n y s t a t e u s e d b y t h e k e r n e l . A l s o a l l r e g i s t e r s
2017-08-29 18:40:32 +03:00
* should h a v e t h e v a l u e r i g h t b e f o r e t h e N M I .
* /
2010-07-24 21:16:05 +04:00
SAVE_ R E G ( 0 )
SAVE_ R E G ( 1 )
SAVE_ R E G ( 2 )
SAVE_ R E G ( 3 )
SAVE_ R E G ( 4 )
SAVE_ R E G ( 5 )
SAVE_ R E G ( 6 )
SAVE_ R E G ( 7 )
SAVE_ R E G ( 8 )
SAVE_ R E G ( 9 )
SAVE_ R E G ( 1 0 )
SAVE_ R E G ( 1 1 )
SAVE_ R E G ( 1 2 )
SAVE_ R E G ( 1 3 )
SAVE_ R E G ( 1 4 )
SAVE_ R E G ( 1 5 )
SAVE_ R E G ( 1 6 )
SAVE_ R E G ( 1 7 )
SAVE_ R E G ( 1 8 )
SAVE_ R E G ( 1 9 )
SAVE_ R E G ( 2 0 )
SAVE_ R E G ( 2 1 )
SAVE_ R E G ( 2 2 )
SAVE_ R E G ( 2 3 )
SAVE_ R E G ( 2 4 )
SAVE_ R E G ( 2 5 )
SAVE_ R E G ( 2 6 )
SAVE_ R E G ( 2 7 )
SAVE_ R E G ( 2 8 )
SAVE_ R E G ( 2 9 )
SAVE_ R E G ( 3 0 )
SAVE_ R E G ( 3 1 )
2017-08-29 18:40:32 +03:00
/* Write zero to all CVMSEG locations per Core-15169 */
dli a0 , C V M S E G _ S I Z E - ( 3 3 * 8 )
1 : sd z e r o , C V M S E G _ B A S E ( a0 )
daddiu a0 , a0 , - 8
bgez a0 , 1 b
nop
2010-07-24 21:16:05 +04:00
/* Set the stack to begin right below the registers */
2017-08-29 18:40:32 +03:00
dli s p , C V M S E G _ B A S E + C V M S E G _ S I Z E - ( 3 2 * 8 )
2010-07-24 21:16:05 +04:00
/* Load the address of the third stage handler */
2017-08-29 18:40:32 +03:00
dla $ 2 5 , o c t e o n _ w d t _ n m i _ s t a g e 3
2010-07-24 21:16:05 +04:00
/* Call the third stage handler */
2017-08-29 18:40:32 +03:00
jal $ 2 5
2010-07-24 21:16:05 +04:00
/* a0 is the address of the saved registers */
move a0 , s p
/* Loop forvever if we get here. */
2017-08-29 18:40:32 +03:00
2 : b 2 b
2010-07-24 21:16:05 +04:00
nop
.set pop
END( o c t e o n _ w d t _ n m i _ s t a g e 2 )