2008-04-28 11:47:20 +04:00
/ * We n e e d t o c a r e f u l l y r e a d t h e e r r o r s t a t u s , A C K t h e e r r o r s ,
* prevent r e c u r s i v e t r a p s , a n d p a s s t h e i n f o r m a t i o n o n t o C
* code f o r l o g g i n g .
*
* We p a s s t h e A F A R i n a s - i s , a n d w e e n c o d e t h e s t a t u s
* information a s d e s c r i b e d i n a s m - s p a r c64 / s f a f s r . h
* /
.type _ _ spitfire_ a c c e s s _ e r r o r ,#f u n c t i o n
__spitfire_access_error :
/ * Disable E S T A T E e r r o r r e p o r t i n g s o t h a t w e d o n o t t a k e
* recursive t r a p s a n d R E D s t a t e t h e p r o c e s s o r .
* /
stxa % g 0 , [ % g 0 ] A S I _ E S T A T E _ E R R O R _ E N
membar #S y n c
mov U D B E _ U E , % g 1
ldxa [ % g 0 ] A S I _ A F S R , % g 4 ! G e t A F S R
/ * _ _ spitfire_ c e e _ t r a p b r a n c h e s h e r e w i t h A F S R i n % g 4 a n d
* UDBE_ C E i n % g 1 . I t o n l y c l e a r s E S T A T E _ E R R _ C E i n t h e E S T A T E
* Error E n a b l e r e g i s t e r .
* /
__spitfire_cee_trap_continue :
ldxa [ % g 0 ] A S I _ A F A R , % g 5 ! G e t A F A R
rdpr % t t , % g 3
and % g 3 , 0 x1 f f , % g 3 ! P a r a n o i a
sllx % g 3 , S F S T A T _ T R A P _ T Y P E _ S H I F T , % g 3
or % g 4 , % g 3 , % g 4
rdpr % t l , % g 3
cmp % g 3 , 1
mov 1 , % g 3
bleu % x c c , 1 f
sllx % g 3 , S F S T A T _ T L _ G T _ O N E _ S H I F T , % g 3
or % g 4 , % g 3 , % g 4
/ * Read i n t h e U D B e r r o r r e g i s t e r s t a t e , c l e a r i n g t h e s t i c k y
* error b i t s a s - n e e d e d . W e o n l y c l e a r t h e m i f t h e U E b i t i s
* set. L i k e w i s e , _ _ s p i t f i r e _ c e e _ t r a p b e l o w w i l l o n l y d o s o
* if t h e C E b i t i s s e t .
*
* NOTE : UltraSparc- I / I I h a v e h i g h a n d l o w U D B e r r o r
* registers, c o r r e s p o n d i n g t o t h e t w o U D B u n i t s
* present o n t h o s e c h i p s . U l t r a S p a r c - I I i o n l y
* has a s i n g l e U D B , c a l l e d " S D B " i n t h e m a n u a l .
* For I I i t h e u p p e r U D B r e g i s t e r a l w a y s r e a d s
* as z e r o s o f o r o u r p u r p o s e s t h i n g s w i l l j u s t
* work w i t h t h e c h e c k s b e l o w .
* /
1 : ldxa [ % g 0 ] A S I _ U D B H _ E R R O R _ R , % g 3
and % g 3 , 0 x3 f f , % g 7 ! P a r a n o i a
sllx % g 7 , S F S T A T _ U D B H _ S H I F T , % g 7
or % g 4 , % g 7 , % g 4
andcc % g 3 , % g 1 , % g 3 ! U D B E _ U E o r U D B E _ C E
be,p n % x c c , 1 f
nop
stxa % g 3 , [ % g 0 ] A S I _ U D B _ E R R O R _ W
membar #S y n c
1 : mov 0 x18 , % g 3
ldxa [ % g 3 ] A S I _ U D B L _ E R R O R _ R , % g 3
and % g 3 , 0 x3 f f , % g 7 ! P a r a n o i a
sllx % g 7 , S F S T A T _ U D B L _ S H I F T , % g 7
or % g 4 , % g 7 , % g 4
andcc % g 3 , % g 1 , % g 3 ! U D B E _ U E o r U D B E _ C E
be,p n % x c c , 1 f
nop
mov 0 x18 , % g 7
stxa % g 3 , [ % g 7 ] A S I _ U D B _ E R R O R _ W
membar #S y n c
1 : / * Ok, n o w t h a t w e ' v e l a t c h e d t h e e r r o r s t a t e , c l e a r t h e
* sticky b i t s i n t h e A F S R .
* /
stxa % g 4 , [ % g 0 ] A S I _ A F S R
membar #S y n c
rdpr % t l , % g 2
cmp % g 2 , 1
rdpr % p i l , % g 2
bleu,p t % x c c , 1 f
2008-11-24 08:55:29 +03:00
wrpr % g 0 , P I L _ N O R M A L _ M A X , % p i l
2008-04-28 11:47:20 +04:00
ba,p t % x c c , e t r a p t l 1
rd % p c , % g 7
ba,p t % x c c , 2 f
nop
1 : ba,p t % x c c , e t r a p _ i r q
rd % p c , % g 7
2 :
# ifdef C O N F I G _ T R A C E _ I R Q F L A G S
call t r a c e _ h a r d i r q s _ o f f
nop
# endif
mov % l 4 , % o 1
mov % l 5 , % o 2
call s p i t f i r e _ a c c e s s _ e r r o r
add % s p , P T R E G S _ O F F , % o 0
ba,p t % x c c , r t r a p
nop
.size _ _ spitfire_ a c c e s s _ e r r o r ,. - _ _ s p i t f i r e _ a c c e s s _ e r r o r
/ * This i s t h e t r a p h a n d l e r e n t r y p o i n t f o r E C C c o r r e c t a b l e
* errors. T h e y a r e c o r r e c t e d , b u t w e l i s t e n f o r t h e t r a p s o
* that t h e e v e n t c a n b e l o g g e d .
*
* Disrupting e r r o r s a r e e i t h e r :
* 1 ) single- b i t E C C e r r o r s d u r i n g U D B r e a d s t o s y s t e m
* memory
* 2 ) data p a r i t y e r r o r s d u r i n g w r i t e - b a c k e v e n t s
*
* As f a r a s I c a n m a k e o u t f r o m t h e m a n u a l , t h e C E E t r a p i s
* only f o r c o r r e c t a b l e e r r o r s d u r i n g m e m o r y r e a d a c c e s s e s b y
* the f r o n t - e n d o f t h e p r o c e s s o r .
*
* The c o d e b e l o w i s o n l y f o r t r a p l e v e l 1 C E E e v e n t s , a s i t
* is t h e o n l y s i t u a t i o n w h e r e w e c a n s a f e l y r e c o r d a n d l o g .
* For t r a p l e v e l > 1 w e j u s t c l e a r t h e C E b i t i n t h e A F S R a n d
* return.
*
* This i s j u s t l i k e _ _ s p i f t i r e _ a c c e s s _ e r r o r a b o v e , b u t i t
* specifically h a n d l e s c o r r e c t a b l e e r r o r s . I f a n
* uncorrectable e r r o r i s i n d i c a t e d i n t h e A F S R w e w i l l b r a n c h
* directly a b o v e t o _ _ s p i t f i r e _ a c c e s s _ e r r o r t o h a n d l e i t
* instead. U n c o r r e c t a b l e t h e r e f o r e t a k e s p r i o r i t y o v e r
* correctable, a n d t h e e r r o r l o g g i n g C c o d e w i l l n o t i c e t h i s
* case b y i n s p e c t i n g t h e t r a p t y p e .
* /
.type _ _ spitfire_ c e e _ t r a p ,#f u n c t i o n
__spitfire_cee_trap :
ldxa [ % g 0 ] A S I _ A F S R , % g 4 ! G e t A F S R
mov 1 , % g 3
sllx % g 3 , S F A F S R _ U E _ S H I F T , % g 3
andcc % g 4 , % g 3 , % g 0 ! C h e c k f o r U E
bne,p n % x c c , _ _ s p i t f i r e _ a c c e s s _ e r r o r
nop
/ * Ok, i n t h i s c a s e w e o n l y h a v e a c o r r e c t a b l e e r r o r .
* Indicate w e o n l y w i s h t o c a p t u r e t h a t s t a t e i n r e g i s t e r
* % g1 , a n d w e o n l y d i s a b l e C E e r r o r r e p o r t i n g u n l i k e U E
* handling w h i c h d i s a b l e s a l l e r r o r s .
* /
ldxa [ % g 0 ] A S I _ E S T A T E _ E R R O R _ E N , % g 3
andn % g 3 , E S T A T E _ E R R _ C E , % g 3
stxa % g 3 , [ % g 0 ] A S I _ E S T A T E _ E R R O R _ E N
membar #S y n c
/* Preserve AFSR in %g4, indicate UDB state to capture in %g1 */
ba,p t % x c c , _ _ s p i t f i r e _ c e e _ t r a p _ c o n t i n u e
mov U D B E _ C E , % g 1
.size _ _ spitfire_ c e e _ t r a p ,. - _ _ s p i t f i r e _ c e e _ t r a p
.type _ _ spitfire_ d a t a _ a c c e s s _ e x c e p t i o n _ t l 1 ,#f u n c t i o n
__spitfire_data_access_exception_tl1 :
rdpr % p s t a t e , % g 4
wrpr % g 4 , P S T A T E _ M G | P S T A T E _ A G , % p s t a t e
mov T L B _ S F S R , % g 3
mov D M M U _ S F A R , % g 5
ldxa [ % g 3 ] A S I _ D M M U , % g 4 ! G e t S F S R
ldxa [ % g 5 ] A S I _ D M M U , % g 5 ! G e t S F A R
stxa % g 0 , [ % g 3 ] A S I _ D M M U ! C l e a r S F S R . F a u l t V a l i d b i t
membar #S y n c
rdpr % t t , % g 3
cmp % g 3 , 0 x80 ! f i r s t w i n s p i l l / f i l l t r a p
blu,p n % x c c , 1 f
cmp % g 3 , 0 x f f ! l a s t w i n s p i l l / f i l l t r a p
bgu,p n % x c c , 1 f
nop
ba,p t % x c c , w i n f i x _ d a x
rdpr % t p c , % g 3
1 : sethi % h i ( 1 0 9 f ) , % g 7
ba,p t % x c c , e t r a p t l 1
109 : or % g 7 , % l o ( 1 0 9 b ) , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s p i t f i r e _ d a t a _ a c c e s s _ e x c e p t i o n _ t l 1
add % s p , P T R E G S _ O F F , % o 0
ba,p t % x c c , r t r a p
nop
.size _ _ spitfire_ d a t a _ a c c e s s _ e x c e p t i o n _ t l 1 ,. - _ _ s p i t f i r e _ d a t a _ a c c e s s _ e x c e p t i o n _ t l 1
.type _ _ spitfire_ d a t a _ a c c e s s _ e x c e p t i o n ,#f u n c t i o n
__spitfire_data_access_exception :
rdpr % p s t a t e , % g 4
wrpr % g 4 , P S T A T E _ M G | P S T A T E _ A G , % p s t a t e
mov T L B _ S F S R , % g 3
mov D M M U _ S F A R , % g 5
ldxa [ % g 3 ] A S I _ D M M U , % g 4 ! G e t S F S R
ldxa [ % g 5 ] A S I _ D M M U , % g 5 ! G e t S F A R
stxa % g 0 , [ % g 3 ] A S I _ D M M U ! C l e a r S F S R . F a u l t V a l i d b i t
membar #S y n c
sethi % h i ( 1 0 9 f ) , % g 7
ba,p t % x c c , e t r a p
109 : or % g 7 , % l o ( 1 0 9 b ) , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s p i t f i r e _ d a t a _ a c c e s s _ e x c e p t i o n
add % s p , P T R E G S _ O F F , % o 0
ba,p t % x c c , r t r a p
nop
.size _ _ spitfire_ d a t a _ a c c e s s _ e x c e p t i o n ,. - _ _ s p i t f i r e _ d a t a _ a c c e s s _ e x c e p t i o n
.type _ _ spitfire_ i n s n _ a c c e s s _ e x c e p t i o n _ t l 1 ,#f u n c t i o n
__spitfire_insn_access_exception_tl1 :
rdpr % p s t a t e , % g 4
wrpr % g 4 , P S T A T E _ M G | P S T A T E _ A G , % p s t a t e
mov T L B _ S F S R , % g 3
ldxa [ % g 3 ] A S I _ I M M U , % g 4 ! G e t S F S R
rdpr % t p c , % g 5 ! I M M U h a s n o S F A R , u s e T P C
stxa % g 0 , [ % g 3 ] A S I _ I M M U ! C l e a r F a u l t V a l i d b i t
membar #S y n c
sethi % h i ( 1 0 9 f ) , % g 7
ba,p t % x c c , e t r a p t l 1
109 : or % g 7 , % l o ( 1 0 9 b ) , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s p i t f i r e _ i n s n _ a c c e s s _ e x c e p t i o n _ t l 1
add % s p , P T R E G S _ O F F , % o 0
ba,p t % x c c , r t r a p
nop
.size _ _ spitfire_ i n s n _ a c c e s s _ e x c e p t i o n _ t l 1 ,. - _ _ s p i t f i r e _ i n s n _ a c c e s s _ e x c e p t i o n _ t l 1
.type _ _ spitfire_ i n s n _ a c c e s s _ e x c e p t i o n ,#f u n c t i o n
__spitfire_insn_access_exception :
rdpr % p s t a t e , % g 4
wrpr % g 4 , P S T A T E _ M G | P S T A T E _ A G , % p s t a t e
mov T L B _ S F S R , % g 3
ldxa [ % g 3 ] A S I _ I M M U , % g 4 ! G e t S F S R
rdpr % t p c , % g 5 ! I M M U h a s n o S F A R , u s e T P C
stxa % g 0 , [ % g 3 ] A S I _ I M M U ! C l e a r F a u l t V a l i d b i t
membar #S y n c
sethi % h i ( 1 0 9 f ) , % g 7
ba,p t % x c c , e t r a p
109 : or % g 7 , % l o ( 1 0 9 b ) , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s p i t f i r e _ i n s n _ a c c e s s _ e x c e p t i o n
add % s p , P T R E G S _ O F F , % o 0
ba,p t % x c c , r t r a p
nop
.size _ _ spitfire_ i n s n _ a c c e s s _ e x c e p t i o n ,. - _ _ s p i t f i r e _ i n s n _ a c c e s s _ e x c e p t i o n