2005-06-24 09:01:16 +04:00
/ *
* arch/ x t e n s a / k e r n e l / v e c t o r s . S
*
* This f i l e c o n t a i n s a l l e x c e p t i o n v e c t o r s ( u s e r , k e r n e l , a n d d o u b l e ) ,
* as w e l l a s t h e w i n d o w v e c t o r s ( o v e r f l o w a n d u n d e r f l o w ) , a n d t h e d e b u g
* vector. T h e s e a r e t h e p r i m a r y v e c t o r s e x e c u t e d b y t h e p r o c e s s o r i f a n
* exception o c c u r s .
*
* 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
* Public L i c e n s e . 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
* this a r c h i v e f o r m o r e d e t a i l s .
*
2013-01-05 04:57:17 +04:00
* Copyright ( C ) 2 0 0 5 - 2 0 0 8 T e n s i l i c a , I n c .
2005-06-24 09:01:16 +04:00
*
* Chris Z a n k e l < c h r i s @zankel.net>
*
* /
/ *
* We u s e a t w o - l e v e l t a b l e a p p r o a c h . T h e u s e r a n d k e r n e l e x c e p t i o n v e c t o r s
* use a f i r s t - l e v e l d i s p a t c h t a b l e t o d i s p a t c h t h e e x c e p t i o n t o a r e g i s t e r e d
* fast h a n d l e r o r t h e d e f a u l t h a n d l e r , i f n o f a s t h a n d l e r w a s r e g i s t e r e d .
* The d e f a u l t h a n d l e r s e t s u p a C - s t a c k a n d d i s p a t c h e s t h e e x c e p t i o n t o a
* registerd C h a n d l e r i n t h e s e c o n d - l e v e l d i s p a t c h t a b l e .
*
* Fast h a n d l e r e n t r y c o n d i t i o n :
*
* a0 : trashed, o r i g i n a l v a l u e s a v e d o n s t a c k ( P T _ A R E G 0 )
* a1 : a1
* a2 : new s t a c k p o i n t e r , o r i g i n a l v a l u e i n d e p c
* a3 : dispatch t a b l e
* depc : a2 , o r i g i n a l v a l u e s a v e d o n s t a c k ( P T _ D E P C )
* excsave_1 : a3
*
* The v a l u e f o r P T _ D E P C s a v e d t o s t a c k a l s o f u n c t i o n s a s a b o o l e a n t o
* indicate t h a t t h e e x c e p t i o n i s e i t h e r a d o u b l e o r a r e g u l a r e x c e p t i o n :
*
* PT_ D E P C > = V A L I D _ D O U B L E _ E X C E P T I O N _ A D D R E S S : d o u b l e e x c e p t i o n
* < VALID_DOUBLE_EXCEPTION_ADDRESS : regular e x c e p t i o n
*
* Note : Neither t h e k e r n e l n o r t h e u s e r e x c e p t i o n h a n d l e r g e n e r a t e l i t e r a l s .
*
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / p t r a c e . h >
# include < a s m / c u r r e n t . h >
2005-09-09 22:57:26 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-06-24 09:01:16 +04:00
# include < a s m / p g t a b l e . h >
# include < a s m / p r o c e s s o r . h >
# include < a s m / p a g e . h >
# include < a s m / t h r e a d _ i n f o . h >
2012-12-03 15:01:43 +04:00
# include < a s m / v e c t o r s . h >
2005-06-24 09:01:16 +04:00
2006-12-10 13:18:48 +03:00
# define W I N D O W _ V E C T O R S _ S I Z E 0 x18 0
2005-06-24 09:01:16 +04:00
/ *
* User e x c e p t i o n v e c t o r . ( E x c e p t i o n s w i t h P S . U M = = 1 , P S . E X C M = = 0 )
*
* We g e t h e r e w h e n a n e x c e p t i o n o c c u r r e d w h i l e w e w e r e i n u s e r l a n d .
* We s w i t c h t o t h e k e r n e l s t a c k a n d j u m p t o t h e f i r s t l e v e l h a n d l e r
* associated t o t h e e x c e p t i o n c a u s e .
*
* Note : the s a v e d k e r n e l s t a c k p o i n t e r ( E X C _ T A B L E _ K S T K ) i s a l r e a d y
* decremented b y P T _ U S E R _ S I Z E .
* /
.section .UserExceptionVector .text , " ax"
ENTRY( _ U s e r E x c e p t i o n V e c t o r )
2012-10-15 03:55:38 +04:00
xsr a3 , e x c s a v e 1 # s a v e a 3 a n d g e t d i s p a t c h t a b l e
wsr a2 , d e p c # s a v e a 2
2005-06-24 09:01:16 +04:00
l3 2 i a2 , a3 , E X C _ T A B L E _ K S T K # l o a d k e r n e l s t a c k t o a 2
s3 2 i a0 , a2 , P T _ A R E G 0 # s a v e a 0 t o E S F
2012-10-15 03:55:38 +04:00
rsr a0 , e x c c a u s e # r e t r i e v e e x c e p t i o n c a u s e
2005-06-24 09:01:16 +04:00
s3 2 i a0 , a2 , P T _ D E P C # m a r k i t a s a r e g u l a r e x c e p t i o n
addx4 a0 , a0 , a3 # f i n d e n t r y i n t a b l e
l3 2 i a0 , a0 , E X C _ T A B L E _ F A S T _ U S E R # l o a d h a n d l e r
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1 # r e s t o r e a 3 a n d d i s p a t c h t a b l e
2005-06-24 09:01:16 +04:00
jx a0
2012-11-17 04:16:20 +04:00
ENDPROC( _ U s e r E x c e p t i o n V e c t o r )
2005-06-24 09:01:16 +04:00
/ *
* Kernel e x c e p t i o n v e c t o r . ( E x c e p t i o n s w i t h P S . U M = = 0 , P S . E X C M = = 0 )
*
* We g e t t h i s e x c e p t i o n w h e n w e w e r e a l r e a d y i n k e r n e l s p a c e .
* We d e c r e m e n t t h e c u r r e n t s t a c k p o i n t e r ( k e r n e l ) b y P T _ S I Z E a n d
* jump t o t h e f i r s t - l e v e l h a n d l e r a s s o c i a t e d w i t h t h e e x c e p t i o n c a u s e .
*
* Note : we n e e d t o p r e s e r v e s p a c e f o r t h e s p i l l r e g i o n .
* /
.section .KernelExceptionVector .text , " ax"
ENTRY( _ K e r n e l E x c e p t i o n V e c t o r )
2012-10-15 03:55:38 +04:00
xsr a3 , e x c s a v e 1 # s a v e a 3 , a n d g e t d i s p a t c h t a b l e
wsr a2 , d e p c # s a v e a 2
2005-06-24 09:01:16 +04:00
addi a2 , a1 , - 1 6 - P T _ S I Z E # a d j u s t s t a c k p o i n t e r
s3 2 i a0 , a2 , P T _ A R E G 0 # s a v e a 0 t o E S F
2012-10-15 03:55:38 +04:00
rsr a0 , e x c c a u s e # r e t r i e v e e x c e p t i o n c a u s e
2005-06-24 09:01:16 +04:00
s3 2 i a0 , a2 , P T _ D E P C # m a r k i t a s a r e g u l a r e x c e p t i o n
addx4 a0 , a0 , a3 # f i n d e n t r y i n t a b l e
l3 2 i a0 , a0 , E X C _ T A B L E _ F A S T _ K E R N E L # l o a d h a n d l e r a d d r e s s
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1 # r e s t o r e a 3 a n d d i s p a t c h t a b l e
2005-06-24 09:01:16 +04:00
jx a0
2012-11-17 04:16:20 +04:00
ENDPROC( _ K e r n e l E x c e p t i o n V e c t o r )
2005-06-24 09:01:16 +04:00
/ *
* Double e x c e p t i o n v e c t o r ( E x c e p t i o n s w i t h P S . E X C M = = 1 )
* We g e t t h i s e x c e p t i o n w h e n a n o t h e r e x c e p t i o n o c c u r s w h i l e w e r e a r e
* already i n a n e x c e p t i o n , s u c h a s w i n d o w o v e r f l o w / u n d e r f l o w e x c e p t i o n ,
* or ' e x p e c t e d ' e x c e p t i o n s , f o r e x a m p l e m e m o r y e x c e p t i o n w h e n w e w e r e t r y i n g
* to r e a d d a t a f r o m a n i n v a l i d a d d r e s s i n u s e r s p a c e .
*
* Note t h a t t h i s v e c t o r i s n e v e r i n v o k e d f o r l e v e l - 1 i n t e r r u p t s , b e c a u s e s u c h
* interrupts a r e d i s a b l e d ( m a s k e d ) w h e n P S . E X C M i s s e t .
*
* We d e c o d e t h e e x c e p t i o n a n d t a k e t h e a p p r o p r i a t e a c t i o n . H o w e v e r , t h e
* double e x c e p t i o n v e c t o r i s m u c h m o r e c a r e f u l , b e c a u s e a l o t m o r e e r r o r
* cases g o t h r o u g h t h e d o u b l e e x c e p t i o n v e c t o r t h a n t h r o u g h t h e u s e r a n d
* kernel e x c e p t i o n v e c t o r s .
*
* Occasionally, t h e k e r n e l e x p e c t s a d o u b l e e x c e p t i o n t o o c c u r . T h i s u s u a l l y
* happens w h e n a c c e s s i n g u s e r - s p a c e m e m o r y w i t h t h e u s e r ' s p e r m i s s i o n s
* ( l3 2 e / s32 e i n s t r u c t i o n s ) . T h e k e r n e l s t a t e , t h o u g h , i s n o t a l w a y s s u i t a b l e
* for i m m e d i a t e t r a n s f e r o f c o n t r o l t o h a n d l e _ d o u b l e , w h e r e " n o r m a l " e x c e p t i o n
* processing o c c u r s . A l s o i n k e r n e l m o d e , T L B m i s s e s c a n o c c u r i f a c c e s s i n g
* vmalloc m e m o r y , p o s s i b l y r e q u i r i n g r e p a i r i n a d o u b l e e x c e p t i o n h a n d l e r .
*
* The v a r i a b l e a t T A B L E _ F I X U P o f f s e t f r o m t h e p o i n t e r i n E X C S A V E _ 1 d o u b l e s a s
* a b o o l e a n v a r i a b l e a n d a p o i n t e r t o a f i x u p r o u t i n e . I f t h e v a r i a b l e
* EXC_ T A B L E _ F I X U P i s n o n - z e r o , t h i s h a n d l e r j u m p s t o t h a t a d d r e s s . A v a l u e o f
* zero i n d i c a t e s t o u s e t h e d e f a u l t k e r n e l / u s e r e x c e p t i o n h a n d l e r .
* There i s o n l y o n e e x c e p t i o n , w h e n t h e v a l u e i s i d e n t i c a l t o t h e e x c _ t a b l e
* label, t h e k e r n e l i s i n t r o u b l e . T h i s m e c h a n i s m i s u s e d t o p r o t e c t c r i t i c a l
* sections, m a i n l y w h e n t h e h a n d l e r w r i t e s t o t h e s t a c k t o a s s e r t t h e s t a c k
* pointer i s v a l i d . O n c e t h e f i x u p / d e f a u l t h a n d l e r l e a v e s t h a t a r e a , t h e
* EXC_ T A B L E _ F I X U P v a r i a b l e i s r e s e t t o t h e f i x u p h a n d l e r o r z e r o .
*
* Procedures w i s h i n g t o u s e t h i s m e c h a n i s m s h o u l d s e t E X C _ T A B L E _ F I X U P t o t h e
* nonzero a d d r e s s o f a f i x u p r o u t i n e b e f o r e i t c o u l d c a u s e a d o u b l e e x c e p t i o n
* and r e s e t i t b e f o r e i t r e t u r n s .
*
* Some o t h e r t h i n g s t o t a k e c a r e o f w h e n a f a s t e x c e p t i o n h a n d l e r d o e s n ' t
* specify a p a r t i c u l a r f i x u p h a n d l e r b u t w a n t s t o u s e t h e d e f a u l t h a n d l e r s :
*
* - The o r i g i n a l s t a c k p o i n t e r ( i n a1 ) m u s t n o t b e m o d i f i e d . T h e f a s t
* exception h a n d l e r s h o u l d o n l y u s e a2 a s t h e s t a c k p o i n t e r .
*
* - If t h e f a s t h a n d l e r m a n i p u l a t e s t h e s t a c k p o i n t e r ( i n a2 ) , i t h a s t o
* register a v a l i d f i x u p h a n d l e r a n d c a n n o t u s e t h e d e f a u l t h a n d l e r s .
*
* - The h a n d l e r c a n u s e a n y o t h e r g e n e r i c r e g i s t e r f r o m a3 t o a15 , b u t i t
* must s a v e t h e c o n t e n t o f t h e s e r e g i s t e r s t o s t a c k ( P T _ A R E G 3 . . . P T _ A R E G x )
*
* - These r e g i s t e r s m u s t b e s a v e d b e f o r e a d o u b l e e x c e p t i o n c a n o c c u r .
*
* - If w e e v e r i m p l e m e n t h a n d l i n g s i g n a l s w h i l e i n d o u b l e e x c e p t i o n s , t h e
* number o f r e g i s t e r s a f a s t h a n d l e r h a s s a v e d ( e x c l u d i n g a0 a n d a1 ) m u s t
* be w r i t t e n t o P T _ A R E G 1 . ( 1 i f o n l y a3 i s u s e d , 2 f o r a3 a n d a4 , e t c . )
*
* The f i x u p h a n d l e r s a r e s p e c i a l h a n d l e r s :
*
* - Fixup e n t r y c o n d i t i o n s d i f f e r f r o m r e g u l a r e x c e p t i o n s :
*
* a0 : DEPC
* a1 : a1
2013-07-03 20:23:28 +04:00
* a2 : trashed, o r i g i n a l v a l u e i n E X C _ T A B L E _ D O U B L E _ S A V E
2005-06-24 09:01:16 +04:00
* a3 : exctable
* depc : a0
* excsave_1 : a3
*
* - When t h e k e r n e l e n t e r s t h e f i x u p h a n d l e r , i t s t i l l a s s u m e s i t i s i n a
* critical s e c t i o n , s o E X C _ T A B L E _ F I X U P v a r i a b l e i s s e t t o e x c _ t a b l e .
* The f i x u p h a n d l e r , t h e r e f o r e , h a s t o r e - r e g i s t e r i t s e l f a s t h e f i x u p
* handler b e f o r e i t r e t u r n s f r o m t h e d o u b l e e x c e p t i o n .
*
* - Fixup h a n d l e r c a n s h a r e t h e s a m e e x c e p t i o n f r a m e w i t h t h e f a s t h a n d l e r .
* The k e r n e l s t a c k p o i n t e r i s n o t c h a n g e d w h e n e n t e r i n g t h e f i x u p h a n d l e r .
*
* - Fixup h a n d l e r s c a n j u m p t o t h e d e f a u l t k e r n e l a n d u s e r e x c e p t i o n
* handlers. B e f o r e i t j u m p s , t h o u g h , i t h a s t o s e t u p a e x c e p t i o n f r a m e
* on s t a c k . B e c a u s e t h e d e f a u l t h a n d l e r r e s e t s t h e r e g i s t e r f i x u p h a n d l e r
* the f i x u p h a n d l e r m u s t m a k e s u r e t h a t t h e d e f a u l t h a n d l e r r e t u r n s t o
* it i n s t e a d o f t h e e x c e p t i o n a d d r e s s , s o i t c a n r e - r e g i s t e r i t s e l f a s
* the f i x u p h a n d l e r .
*
* In c a s e o f a c r i t i c a l c o n d i t i o n w h e r e t h e k e r n e l c a n n o t r e c o v e r , w e j u m p
* to u n r e c o v e r a b l e _ e x c e p t i o n w i t h t h e f o l l o w i n g e n t r y c o n d i t i o n s .
* All r e g i s t e r s a0 . . . a15 a r e u n c h a n g e d f r o m t h e l a s t e x c e p t i o n , e x c e p t :
*
* a0 : last a d d r e s s b e f o r e w e j u m p e d t o t h e u n r e c o v e r a b l e _ e x c e p t i o n .
* excsave_1 : a0
*
*
* See t h e h a n d l e _ a l l o c a _ u s e r a n d s p i l l _ r e g i s t e r s r o u t i n e s f o r e x a m p l e c l i e n t s .
*
* FIXME : Note : we c u r r e n t l y d o n ' t a l l o w s i g n a l h a n d l i n g c o m i n g f r o m a d o u b l e
* exception, s o t h e i t e m m a r k t w i t h ( * ) i s n o t r e q u i r e d .
* /
.section .DoubleExceptionVector .text , " ax"
.begin literal_prefix .DoubleExceptionVector
2013-07-03 20:23:28 +04:00
.globl _DoubleExceptionVector_WindowUnderflow
.globl _DoubleExceptionVector_WindowOverflow
2005-06-24 09:01:16 +04:00
ENTRY( _ D o u b l e E x c e p t i o n V e c t o r )
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1
s3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
2005-06-24 09:01:16 +04:00
/* Check for kernel double exception (usually fatal). */
2013-07-03 20:23:28 +04:00
rsr a2 , p s
_ bbci. l a2 , P S _ U M _ B I T , . L k s p
2005-06-24 09:01:16 +04:00
/* Check if we are currently handling a window exception. */
/* Note: We don't need to indicate that we enter a critical section. */
2012-10-15 03:55:38 +04:00
xsr a0 , d e p c # g e t D E P C , s a v e a 0
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
movi a2 , W I N D O W _ V E C T O R S _ V A D D R
_ bltu a0 , a2 , . L f i x u p
addi a2 , a2 , W I N D O W _ V E C T O R S _ S I Z E
_ bgeu a0 , a2 , . L f i x u p
2005-06-24 09:01:16 +04:00
/* Window overflow/underflow exception. Get stack pointer. */
2013-07-03 20:23:28 +04:00
l3 2 i a2 , a3 , E X C _ T A B L E _ K S T K
2005-06-24 09:01:16 +04:00
/* Check for overflow/underflow exception, jump if overflow. */
2014-01-29 10:09:51 +04:00
bbci. l a0 , 6 , _ D o u b l e E x c e p t i o n V e c t o r _ W i n d o w O v e r f l o w
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
/ *
* Restart w i n d o w u n d e r f l o w e x c e p t i o n .
* Currently :
* depc = o r i g a0 ,
* a0 = o r i g D E P C ,
* a2 = n e w s p b a s e d o n K S T K f r o m e x c _ t a b l e
* a3 = e x c s a v e _ 1
* excsave_ 1 = o r i g a3
*
2005-06-24 09:01:16 +04:00
* We r e t u r n t o t h e i n s t r u c t i o n i n u s e r s p a c e t h a t c a u s e d t h e w i n d o w
* underflow e x c e p t i o n . T h e r e f o r e , w e c h a n g e w i n d o w b a s e t o t h e v a l u e
* before w e e n t e r e d t h e w i n d o w u n d e r f l o w e x c e p t i o n a n d p r e p a r e t h e
* registers t o r e t u r n a s i f w e w e r e c o m i n g f r o m a r e g u l a r e x c e p t i o n
* by c h a n g i n g d e p c ( i n a0 ) .
* Note : We c a n t r a s h t h e c u r r e n t w i n d o w f r a m e ( a0 . . . a3 ) a n d d e p c !
* /
2013-07-03 20:23:28 +04:00
_DoubleExceptionVector_WindowUnderflow :
xsr a3 , e x c s a v e 1
2012-10-15 03:55:38 +04:00
wsr a2 , d e p c # s a v e s t a c k p o i n t e r t e m p o r a r i l y
rsr a0 , p s
2013-07-03 20:23:28 +04:00
extui a0 , a0 , P S _ O W B _ S H I F T , P S _ O W B _ W I D T H
2012-10-15 03:55:38 +04:00
wsr a0 , w i n d o w b a s e
2005-06-24 09:01:16 +04:00
rsync
/* We are now in the previous window frame. Save registers again. */
2012-10-15 03:55:38 +04:00
xsr a2 , d e p c # s a v e a 2 a n d g e t s t a c k p o i n t e r
2005-06-24 09:01:16 +04:00
s3 2 i a0 , a2 , P T _ A R E G 0
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1
2012-10-15 03:55:38 +04:00
rsr a0 , e x c c a u s e
2005-06-24 09:01:16 +04:00
s3 2 i a0 , a2 , P T _ D E P C # m a r k i t a s a r e g u l a r e x c e p t i o n
addx4 a0 , a0 , a3
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1
2005-06-24 09:01:16 +04:00
l3 2 i a0 , a0 , E X C _ T A B L E _ F A S T _ U S E R
jx a0
2013-07-03 20:23:28 +04:00
/ *
* We o n l y a l l o w t h e I T L B m i s s e x c e p t i o n i f w e a r e i n k e r n e l s p a c e .
* All o t h e r e x c e p t i o n s a r e u n e x p e c t e d a n d t h u s u n r e c o v e r a b l e !
* /
# ifdef C O N F I G _ M M U
.extern fast_second_level_miss_double_kernel
.Lksp : /* a0: a0, a1: a1, a2: a2, a3: trashed, depc: depc, excsave: a3 */
rsr a3 , e x c c a u s e
beqi a3 , E X C C A U S E _ I T L B _ M I S S , 1 f
addi a3 , a3 , - E X C C A U S E _ D T L B _ M I S S
bnez a3 , . L u n r e c o v e r a b l e
1 : movi a3 , f a s t _ s e c o n d _ l e v e l _ m i s s _ d o u b l e _ k e r n e l
jx a3
# else
.equ .Lksp , .Lunrecoverable
# endif
/* Critical! We can't handle this situation. PANIC! */
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
.extern unrecoverable_exception
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
.Lunrecoverable_fixup :
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
xsr a0 , d e p c
.Lunrecoverable :
rsr a3 , e x c s a v e 1
wsr a0 , e x c s a v e 1
movi a0 , u n r e c o v e r a b l e _ e x c e p t i o n
callx0 a0
.Lfixup : /* Check for a fixup handler or if we were in a critical section. */
/* a0: depc, a1: a1, a2: trash, a3: exctable, depc: a0, excsave1: a3 */
2005-06-24 09:01:16 +04:00
/* Enter critical section. */
l3 2 i a2 , a3 , E X C _ T A B L E _ F I X U P
s3 2 i a3 , a3 , E X C _ T A B L E _ F I X U P
2013-07-03 20:23:28 +04:00
beq a2 , a3 , . L u n r e c o v e r a b l e _ f i x u p # c r i t i c a l s e c t i o n
2005-06-24 09:01:16 +04:00
beqz a2 , . L d f l t # n o h a n d l e r w a s r e g i s t e r e d
/* a0: depc, a1: a1, a2: trash, a3: exctable, depc: a0, excsave: a3 */
jx a2
.Ldflt : /* Get stack pointer. */
2013-07-03 20:23:28 +04:00
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
addi a2 , a2 , - P T _ U S E R _ S I Z E
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
/* a0: depc, a1: a1, a2: kstk, a3: exctable, depc: a0, excsave: a3 */
2005-06-24 09:01:16 +04:00
s3 2 i a0 , a2 , P T _ D E P C
2013-07-03 20:23:28 +04:00
l3 2 i a0 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
xsr a0 , d e p c
s3 2 i a0 , a2 , P T _ A R E G 0
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
/* a0: avail, a1: a1, a2: kstk, a3: exctable, depc: a2, excsave: a3 */
2005-06-24 09:01:16 +04:00
2012-10-15 03:55:38 +04:00
rsr a0 , e x c c a u s e
2005-06-24 09:01:16 +04:00
addx4 a0 , a0 , a3
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1
2005-06-24 09:01:16 +04:00
l3 2 i a0 , a0 , E X C _ T A B L E _ F A S T _ U S E R
jx a0
/ *
2013-07-03 20:23:28 +04:00
* Restart w i n d o w O V E R F L O W e x c e p t i o n .
* Currently :
* depc = o r i g a0 ,
* a0 = o r i g D E P C ,
* a2 = n e w s p b a s e d o n K S T K f r o m e x c _ t a b l e
* a3 = E X C S A V E _ 1
* excsave_ 1 = o r i g a3
*
* We r e t u r n t o t h e i n s t r u c t i o n i n u s e r s p a c e t h a t c a u s e d t h e w i n d o w
* overflow e x c e p t i o n . T h e r e f o r e , w e c h a n g e w i n d o w b a s e t o t h e v a l u e
* before w e e n t e r e d t h e w i n d o w o v e r f l o w e x c e p t i o n a n d p r e p a r e t h e
* registers t o r e t u r n a s i f w e w e r e c o m i n g f r o m a r e g u l a r e x c e p t i o n
* by c h a n g i n g D E P C ( i n a0 ) .
*
* NOTE : We C A N N O T t r a s h t h e c u r r e n t w i n d o w f r a m e ( a0 . . . a3 ) , b u t w e
* can c l o b b e r d e p c .
*
* The t r i c k y p a r t h e r e i s t h a t o v e r f l o w8 a n d o v e r f l o w12 h a n d l e r s
* save a0 , t h e n c l o b b e r a0 . T o r e s t a r t t h e h a n d l e r , w e h a v e t o r e s t o r e
* a0 i f t h e d o u b l e e x c e p t i o n w a s p a s t t h e p o i n t w h e r e a0 w a s c l o b b e r e d .
*
* To k e e p t h i n g s s i m p l e , w e t a k e a d v a n t a g e o f t h e f a c t a l l o v e r f l o w
* handlers s a v e a0 i n t h e i r v e r y f i r s t i n s t r u c t i o n . I f D E P C w a s p a s t
* that i n s t r u c t i o n , w e c a n s a f e l y r e s t o r e a0 f r o m w h e r e i t w a s s a v e d
* on t h e s t a c k .
*
* a0 : depc, a1 : a1 , a2 : k s t k , a3 : e x c _ t a b l e , d e p c : a0 , e x c s a v e 1 : a3
2005-06-24 09:01:16 +04:00
* /
2013-07-03 20:23:28 +04:00
_DoubleExceptionVector_WindowOverflow :
extui a2 , a0 , 0 , 6 # g e t o f f s e t i n t o 64 - b y t e v e c t o r h a n d l e r
beqz a2 , 1 f # i f a t s t a r t o f v e c t o r , d o n ' t r e s t o r e
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
addi a0 , a0 , - 1 2 8
xtensa: add fixup for double exception raised in window overflow
There are two FIXMEs in the double exception handler 'for the extremely
unlikely case'. This case gets hit by gcc during kernel build once in
a few hours, resulting in an unrecoverable exception condition.
Provide missing fixup routine to handle this case. Double exception
literals now need 8 more bytes, add them to the linker script.
Also replace bbsi instructions with bbsi.l as we're branching depending
on 8th and 7th LSB-based bits of exception address.
This may be tested by adding the explicit DTLB invalidation to window
overflow handlers, like the following:
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -592,6 +592,14 @@ ENDPROC(_WindowUnderflow4)
ENTRY_ALIGN64(_WindowOverflow8)
s32e a0, a9, -16
+ bbsi.l a9, 31, 1f
+ rsr a0, ccount
+ bbsi.l a0, 4, 1f
+ pdtlb a0, a9
+ idtlb a0
+ movi a0, 9
+ idtlb a0
+1:
l32e a0, a1, -12
s32e a2, a9, -8
s32e a1, a9, -12
Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2014-05-24 21:48:28 +04:00
bbsi. l a0 , 8 , 1 f # d o n ' t r e s t o r e e x c e p t f o r o v e r f l o w 8 a n d 1 2
/ *
* This f i x u p h a n d l e r i s f o r t h e e x t r e m e l y u n l i k e l y c a s e w h e r e t h e
* overflow h a n d l e r ' s r e f e r e n c e t h r u a0 g e t s a h a r d w a r e T L B r e f i l l
* that b u m p s o u t t h e ( d i s t i n c t , a l i a s i n g ) T L B e n t r y t h a t m a p p e d i t s
* prior r e f e r e n c e s t h r u a9 / a13 , a n d w h e r e o u r r e f e r e n c e n o w t h r u
* a9 / a13 g e t s a 2 n d - l e v e l m i s s e x c e p t i o n ( n o t h a r d w a r e T L B r e f i l l ) .
* /
movi a2 , w i n d o w _ o v e r f l o w _ r e s t o r e _ a0 _ f i x u p
s3 2 i a2 , a3 , E X C _ T A B L E _ F I X U P
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
xsr a3 , e x c s a v e 1
bbsi. l a0 , 7 , 2 f
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
/ *
* Restore a0 a s s a v e d b y _ W i n d o w O v e r f l o w8 ( ) .
* /
2005-06-24 09:01:16 +04:00
xtensa: add fixup for double exception raised in window overflow
There are two FIXMEs in the double exception handler 'for the extremely
unlikely case'. This case gets hit by gcc during kernel build once in
a few hours, resulting in an unrecoverable exception condition.
Provide missing fixup routine to handle this case. Double exception
literals now need 8 more bytes, add them to the linker script.
Also replace bbsi instructions with bbsi.l as we're branching depending
on 8th and 7th LSB-based bits of exception address.
This may be tested by adding the explicit DTLB invalidation to window
overflow handlers, like the following:
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -592,6 +592,14 @@ ENDPROC(_WindowUnderflow4)
ENTRY_ALIGN64(_WindowOverflow8)
s32e a0, a9, -16
+ bbsi.l a9, 31, 1f
+ rsr a0, ccount
+ bbsi.l a0, 4, 1f
+ pdtlb a0, a9
+ idtlb a0
+ movi a0, 9
+ idtlb a0
+1:
l32e a0, a1, -12
s32e a2, a9, -8
s32e a1, a9, -12
Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2014-05-24 21:48:28 +04:00
l3 2 e a0 , a9 , - 1 6
wsr a0 , d e p c # r e p l a c e t h e s a v e d a 0
j 3 f
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
2 :
/ *
* Restore a0 a s s a v e d b y _ W i n d o w O v e r f l o w12 ( ) .
* /
2005-06-24 09:01:16 +04:00
xtensa: add fixup for double exception raised in window overflow
There are two FIXMEs in the double exception handler 'for the extremely
unlikely case'. This case gets hit by gcc during kernel build once in
a few hours, resulting in an unrecoverable exception condition.
Provide missing fixup routine to handle this case. Double exception
literals now need 8 more bytes, add them to the linker script.
Also replace bbsi instructions with bbsi.l as we're branching depending
on 8th and 7th LSB-based bits of exception address.
This may be tested by adding the explicit DTLB invalidation to window
overflow handlers, like the following:
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -592,6 +592,14 @@ ENDPROC(_WindowUnderflow4)
ENTRY_ALIGN64(_WindowOverflow8)
s32e a0, a9, -16
+ bbsi.l a9, 31, 1f
+ rsr a0, ccount
+ bbsi.l a0, 4, 1f
+ pdtlb a0, a9
+ idtlb a0
+ movi a0, 9
+ idtlb a0
+1:
l32e a0, a1, -12
s32e a2, a9, -8
s32e a1, a9, -12
Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2014-05-24 21:48:28 +04:00
l3 2 e a0 , a13 , - 1 6
wsr a0 , d e p c # r e p l a c e t h e s a v e d a 0
3 :
xsr a3 , e x c s a v e 1
movi a0 , 0
s3 2 i a0 , a3 , E X C _ T A B L E _ F I X U P
s3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
2013-07-03 20:23:28 +04:00
1 :
/ *
* Restore W i n d o w B a s e w h i l e l e a v i n g a l l a d d r e s s r e g i s t e r s r e s t o r e d .
* We h a v e t o u s e R O T W f o r t h i s , b e c a u s e W S R . W I N D O W B A S E r e q u i r e s
* an a d d r e s s r e g i s t e r ( w h i c h w o u l d p r e v e n t r e s t o r e ) .
*
* Window B a s e g o e s f r o m 0 . . . 7 ( M o d u l e 8 )
* Window S t a r t i s 8 b i t s ; Ex: (0b1010 1010):0x55 from series of call4s
* /
rsr a0 , p s
extui a0 , a0 , P S _ O W B _ S H I F T , P S _ O W B _ W I D T H
rsr a2 , w i n d o w b a s e
sub a0 , a2 , a0
extui a0 , a0 , 0 , 3
2005-06-24 09:01:16 +04:00
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1
beqi a0 , 1 , . L 1 p a n e
beqi a0 , 3 , . L 3 p a n e
2005-06-24 09:01:16 +04:00
2013-07-03 20:23:28 +04:00
rsr a0 , d e p c
rotw - 2
/ *
* We a r e n o w i n t h e u s e r c o d e ' s o r i g i n a l w i n d o w f r a m e .
* Process t h e e x c e p t i o n a s a u s e r e x c e p t i o n a s i f i t w a s
* taken b y t h e u s e r c o d e .
*
* This i s s i m i l a r t o t h e u s e r e x c e p t i o n v e c t o r ,
* except t h a t P T _ D E P C i s n ' t s e t t o E X C C A U S E .
* /
1 :
xsr a3 , e x c s a v e 1
wsr a2 , d e p c
l3 2 i a2 , a3 , E X C _ T A B L E _ K S T K
s3 2 i a0 , a2 , P T _ A R E G 0
rsr a0 , e x c c a u s e
s3 2 i a0 , a2 , P T _ D E P C
xtensa: add fixup for double exception raised in window overflow
There are two FIXMEs in the double exception handler 'for the extremely
unlikely case'. This case gets hit by gcc during kernel build once in
a few hours, resulting in an unrecoverable exception condition.
Provide missing fixup routine to handle this case. Double exception
literals now need 8 more bytes, add them to the linker script.
Also replace bbsi instructions with bbsi.l as we're branching depending
on 8th and 7th LSB-based bits of exception address.
This may be tested by adding the explicit DTLB invalidation to window
overflow handlers, like the following:
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -592,6 +592,14 @@ ENDPROC(_WindowUnderflow4)
ENTRY_ALIGN64(_WindowOverflow8)
s32e a0, a9, -16
+ bbsi.l a9, 31, 1f
+ rsr a0, ccount
+ bbsi.l a0, 4, 1f
+ pdtlb a0, a9
+ idtlb a0
+ movi a0, 9
+ idtlb a0
+1:
l32e a0, a1, -12
s32e a2, a9, -8
s32e a1, a9, -12
Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2014-05-24 21:48:28 +04:00
_DoubleExceptionVector_handle_exception :
2014-08-07 01:03:01 +04:00
addi a0 , a0 , - E X C C A U S E _ U N A L I G N E D
beqz a0 , 2 f
2013-07-03 20:23:28 +04:00
addx4 a0 , a0 , a3
2014-08-07 01:03:01 +04:00
l3 2 i a0 , a0 , E X C _ T A B L E _ F A S T _ U S E R + 4 * E X C C A U S E _ U N A L I G N E D
xsr a3 , e x c s a v e 1
jx a0
2 :
movi a0 , u s e r _ e x c e p t i o n
2013-07-03 20:23:28 +04:00
xsr a3 , e x c s a v e 1
jx a0
.L1pane :
rsr a0 , d e p c
rotw - 1
j 1 b
.L3pane :
rsr a0 , d e p c
rotw - 3
j 1 b
2005-06-24 09:01:16 +04:00
2012-11-17 04:16:20 +04:00
ENDPROC( _ D o u b l e E x c e p t i o n V e c t o r )
2005-06-24 09:01:16 +04:00
2015-10-16 17:01:04 +03:00
.end literal_prefix
.text
xtensa: add fixup for double exception raised in window overflow
There are two FIXMEs in the double exception handler 'for the extremely
unlikely case'. This case gets hit by gcc during kernel build once in
a few hours, resulting in an unrecoverable exception condition.
Provide missing fixup routine to handle this case. Double exception
literals now need 8 more bytes, add them to the linker script.
Also replace bbsi instructions with bbsi.l as we're branching depending
on 8th and 7th LSB-based bits of exception address.
This may be tested by adding the explicit DTLB invalidation to window
overflow handlers, like the following:
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -592,6 +592,14 @@ ENDPROC(_WindowUnderflow4)
ENTRY_ALIGN64(_WindowOverflow8)
s32e a0, a9, -16
+ bbsi.l a9, 31, 1f
+ rsr a0, ccount
+ bbsi.l a0, 4, 1f
+ pdtlb a0, a9
+ idtlb a0
+ movi a0, 9
+ idtlb a0
+1:
l32e a0, a1, -12
s32e a2, a9, -8
s32e a1, a9, -12
Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2014-05-24 21:48:28 +04:00
/ *
* Fixup h a n d l e r f o r T L B m i s s i n d o u b l e e x c e p t i o n h a n d l e r f o r w i n d o w o w e r f l o w .
* We g e t h e r e w i t h w i n d o w b a s e s e t t o t h e w i n d o w t h a t w a s b e i n g s p i l l e d a n d
* a0 t r a s h e d . a0 b i t 7 d e t e r m i n e s i f t h i s i s a c a l l 8 ( b i t c l e a r ) o r c a l l 1 2
* ( bit s e t ) w i n d o w .
*
* We d o t h e f o l l o w i n g h e r e :
* - go t o t h e o r i g i n a l w i n d o w r e t a i n i n g a0 v a l u e ;
* - set u p e x c e p t i o n s t a c k t o r e t u r n b a c k t o a p p r o p r i a t e a0 r e s t o r e c o d e
* ( we' l l n e e d t o r o t a t e w i n d o w b a c k a n d t h e r e ' s n o p l a c e t o s a v e t h i s
* information, u s e d i f f e r e n t r e t u r n a d d r e s s f o r t h a t ) ;
* - handle t h e e x c e p t i o n ;
* - go t o t h e w i n d o w t h a t w a s b e i n g s p i l l e d ;
* - set u p w i n d o w _ o v e r f l o w _ r e s t o r e _ a0 _ f i x u p a s a f i x u p r o u t i n e ;
* - reload a0 ;
* - restore t h e o r i g i n a l w i n d o w ;
* - reset t h e d e f a u l t f i x u p r o u t i n e ;
* - return t o u s e r . B y t h e t i m e w e g e t t o t h i s f i x u p h a n d l e r a l l i n f o r m a t i o n
* about t h e c o n d i t i o n s o f t h e o r i g i n a l d o u b l e e x c e p t i o n t h a t h a p p e n e d i n
* the w i n d o w o v e r f l o w h a n d l e r i s l o s t , s o w e j u s t r e t u r n t o u s e r s p a c e t o
* retry o v e r f l o w f r o m s t a r t .
*
* a0 : value o f d e p c , o r i g i n a l v a l u e i n d e p c
* a2 : trashed, o r i g i n a l v a l u e i n E X C _ T A B L E _ D O U B L E _ S A V E
* a3 : exctable, o r i g i n a l v a l u e i n e x c s a v e 1
* /
ENTRY( w i n d o w _ o v e r f l o w _ r e s t o r e _ a0 _ f i x u p )
rsr a0 , p s
extui a0 , a0 , P S _ O W B _ S H I F T , P S _ O W B _ W I D T H
rsr a2 , w i n d o w b a s e
sub a0 , a2 , a0
extui a0 , a0 , 0 , 3
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
xsr a3 , e x c s a v e 1
_ beqi a0 , 1 , . L h a n d l e _ 1
_ beqi a0 , 3 , . L h a n d l e _ 3
.macro overflow_fixup_handle_exception_pane n
rsr a0 , d e p c
rotw - \ n
xsr a3 , e x c s a v e 1
wsr a2 , d e p c
l3 2 i a2 , a3 , E X C _ T A B L E _ K S T K
s3 2 i a0 , a2 , P T _ A R E G 0
movi a0 , . L r e s t o r e _ \ n
s3 2 i a0 , a2 , P T _ D E P C
rsr a0 , e x c c a u s e
j _ D o u b l e E x c e p t i o n V e c t o r _ h a n d l e _ e x c e p t i o n
.endm
overflow_ f i x u p _ h a n d l e _ e x c e p t i o n _ p a n e 2
.Lhandle_1 :
overflow_ f i x u p _ h a n d l e _ e x c e p t i o n _ p a n e 1
.Lhandle_3 :
overflow_ f i x u p _ h a n d l e _ e x c e p t i o n _ p a n e 3
.macro overflow_fixup_restore_a0_pane n
rotw \ n
/ * Need t o p r e s e r v e a0 v a l u e h e r e t o b e a b l e t o h a n d l e e x c e p t i o n
* that m a y o c c u r o n a0 r e l o a d f r o m s t a c k . I t m a y o c c u r b e c a u s e
* TLB m i s s h a n d l e r m a y n o t b e a t o m i c a n d p o i n t e r t o p a g e t a b l e
* may b e l o s t b e f o r e w e g e t h e r e . T h e r e a r e n o f r e e r e g i s t e r s ,
* so w e n e e d t o u s e E X C _ T A B L E _ D O U B L E _ S A V E a r e a .
* /
xsr a3 , e x c s a v e 1
s3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
movi a2 , w i n d o w _ o v e r f l o w _ r e s t o r e _ a0 _ f i x u p
s3 2 i a2 , a3 , E X C _ T A B L E _ F I X U P
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
xsr a3 , e x c s a v e 1
bbsi. l a0 , 7 , 1 f
l3 2 e a0 , a9 , - 1 6
j 2 f
1 :
l3 2 e a0 , a13 , - 1 6
2 :
rotw - \ n
.endm
.Lrestore_2 :
overflow_ f i x u p _ r e s t o r e _ a0 _ p a n e 2
.Lset_default_fixup :
xsr a3 , e x c s a v e 1
s3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
movi a2 , 0
s3 2 i a2 , a3 , E X C _ T A B L E _ F I X U P
l3 2 i a2 , a3 , E X C _ T A B L E _ D O U B L E _ S A V E
xsr a3 , e x c s a v e 1
rfe
.Lrestore_1 :
overflow_ f i x u p _ r e s t o r e _ a0 _ p a n e 1
j . L s e t _ d e f a u l t _ f i x u p
.Lrestore_3 :
overflow_ f i x u p _ r e s t o r e _ a0 _ p a n e 3
j . L s e t _ d e f a u l t _ f i x u p
ENDPROC( w i n d o w _ o v e r f l o w _ r e s t o r e _ a0 _ f i x u p )
2005-06-24 09:01:16 +04:00
/ *
* Debug i n t e r r u p t v e c t o r
*
* There i s n o t m u c h s p a c e h e r e , s o s i m p l y j u m p t o a n o t h e r h a n d l e r .
* EXCSAVE[ D E B U G L E V E L ] h a s b e e n s e t t o t h a t h a n d l e r .
* /
.section .DebugInterruptVector .text , " ax"
ENTRY( _ D e b u g I n t e r r u p t V e c t o r )
2012-11-17 04:16:20 +04:00
2016-03-07 01:36:33 +03:00
xsr a3 , S R E G _ E X C S A V E + X C H A L _ D E B U G L E V E L
s3 2 i a0 , a3 , D T _ D E B U G _ S A V E
l3 2 i a0 , a3 , D T _ D E B U G _ E X C E P T I O N
2005-06-24 09:01:16 +04:00
jx a0
2012-11-17 04:16:20 +04:00
ENDPROC( _ D e b u g I n t e r r u p t V e c t o r )
2005-06-24 09:01:16 +04:00
2013-01-05 04:57:17 +04:00
/ *
* Medium p r i o r i t y l e v e l i n t e r r u p t v e c t o r s
*
* Each t a k e s l e s s t h a n 1 6 ( 0 x10 ) b y t e s , n o l i t e r a l s , b y p l a c i n g
* the e x t r a 8 b y t e s t h a t w o u l d o t h e r w i s e b e r e q u i r e d i n t h e w i n d o w
* vectors a r e a w h e r e t h e r e i s s p a c e . W i t h r e l o c a t a b l e v e c t o r s ,
* all v e c t o r s a r e w i t h i n ~ 4 k B r a n g e o f e a c h o t h e r , s o w e c a n
* simply j u m p ( J ) t o a n o t h e r v e c t o r w i t h o u t h a v i n g t o u s e J X .
*
* common_ e x c e p t i o n c o d e g e t s c u r r e n t I R Q l e v e l i n P S . I N T L E V E L
* and p r e s e r v e s i t f o r t h e I R Q h a n d l i n g t i m e .
* /
.macro irq_entry_level level
.if XCHAL_EXCM_LEVEL > = \ level
.section .Level \ level\ ( ) I n t e r r u p t V e c t o r . t e x t , " a x "
ENTRY( _ L e v e l \ l e v e l \ ( ) I n t e r r u p t V e c t o r )
2013-03-26 02:51:43 +04:00
wsr a0 , e x c s a v e 2
2013-01-05 04:57:17 +04:00
rsr a0 , e p c \ l e v e l
2013-03-26 02:51:43 +04:00
wsr a0 , e p c1
2015-07-16 10:37:31 +03:00
.if \ level < = L O C K L E V E L
2013-03-26 02:51:43 +04:00
movi a0 , E X C C A U S E _ L E V E L 1 _ I N T E R R U P T
2015-07-16 10:37:31 +03:00
.else
movi a0 , E X C C A U S E _ M A P P E D _ N M I
.endif
2013-03-26 02:51:43 +04:00
wsr a0 , e x c c a u s e
rsr a0 , e p s \ l e v e l
2013-01-05 04:57:17 +04:00
# branch t o u s e r o r k e r n e l v e c t o r
j _ S i m u l a t e U s e r K e r n e l V e c t o r E x c e p t i o n
.endif
.endm
irq_ e n t r y _ l e v e l 2
irq_ e n t r y _ l e v e l 3
irq_ e n t r y _ l e v e l 4
irq_ e n t r y _ l e v e l 5
irq_ e n t r y _ l e v e l 6
2005-06-24 09:01:16 +04:00
/ * Window o v e r f l o w a n d u n d e r f l o w h a n d l e r s .
* The h a n d l e r s m u s t b e 6 4 b y t e s a p a r t , f i r s t s t a r t i n g w i t h t h e u n d e r f l o w
* handlers u n d e r f l o w - 4 t o u n d e r f l o w - 1 2 , t h e n t h e o v e r f l o w h a n d l e r s
* overflow- 4 t o o v e r f l o w - 1 2 .
*
* Note : We r e r u n t h e u n d e r f l o w h a n d l e r s i f w e h i t a n e x c e p t i o n , s o
* we t r y t o a c c e s s a n y p a g e t h a t w o u l d c a u s e a p a g e f a u l t e a r l y .
* /
2012-11-17 04:16:20 +04:00
# define E N T R Y _ A L I G N 6 4 ( n a m e ) \
.globl name; \
.align 6 4 ; \
name :
2005-06-24 09:01:16 +04:00
.section .WindowVectors .text , " ax"
/* 4-Register Window Overflow Vector (Handler) */
2012-11-17 04:16:20 +04:00
ENTRY_ A L I G N 6 4 ( _ W i n d o w O v e r f l o w4 )
2005-06-24 09:01:16 +04:00
s3 2 e a0 , a5 , - 1 6
s3 2 e a1 , a5 , - 1 2
s3 2 e a2 , a5 , - 8
s3 2 e a3 , a5 , - 4
rfwo
2012-11-17 04:16:20 +04:00
ENDPROC( _ W i n d o w O v e r f l o w4 )
2005-06-24 09:01:16 +04:00
2013-01-05 04:57:17 +04:00
# if X C H A L _ E X C M _ L E V E L > = 2
/ * Not a w i n d o w v e c t o r - b u t a c o n v e n i e n t l o c a t i o n
* ( where w e k n o w t h e r e ' s s p a c e ) f o r c o n t i n u a t i o n o f
* medium p r i o r i t y i n t e r r u p t d i s p a t c h c o d e .
* On e n t r y h e r e , a0 c o n t a i n s P S , a n d E P C 2 c o n t a i n s s a v e d a0 :
* /
.align 4
_SimulateUserKernelVectorException :
2013-03-26 02:51:43 +04:00
addi a0 , a0 , ( 1 < < P S _ E X C M _ B I T )
2015-07-16 10:37:31 +03:00
# if ! X T E N S A _ F A K E _ N M I
2013-03-26 02:51:43 +04:00
wsr a0 , p s
2015-07-16 10:37:31 +03:00
# endif
2013-01-05 04:57:17 +04:00
bbsi. l a0 , P S _ U M _ B I T , 1 f # b r a n c h i f u s e r m o d e
2015-07-16 10:37:31 +03:00
xsr a0 , e x c s a v e 2 # r e s t o r e a 0
2013-01-05 04:57:17 +04:00
j _ K e r n e l E x c e p t i o n V e c t o r # s i m u l a t e k e r n e l v e c t o r e x c e p t i o n
2015-07-16 10:37:31 +03:00
1 : xsr a0 , e x c s a v e 2 # r e s t o r e a 0
2013-01-05 04:57:17 +04:00
j _ U s e r E x c e p t i o n V e c t o r # s i m u l a t e u s e r v e c t o r e x c e p t i o n
# endif
2005-06-24 09:01:16 +04:00
/* 4-Register Window Underflow Vector (Handler) */
2012-11-17 04:16:20 +04:00
ENTRY_ A L I G N 6 4 ( _ W i n d o w U n d e r f l o w4 )
2005-06-24 09:01:16 +04:00
l3 2 e a0 , a5 , - 1 6
l3 2 e a1 , a5 , - 1 2
l3 2 e a2 , a5 , - 8
l3 2 e a3 , a5 , - 4
rfwu
2012-11-17 04:16:20 +04:00
ENDPROC( _ W i n d o w U n d e r f l o w4 )
2005-06-24 09:01:16 +04:00
/* 8-Register Window Overflow Vector (Handler) */
2012-11-17 04:16:20 +04:00
ENTRY_ A L I G N 6 4 ( _ W i n d o w O v e r f l o w8 )
2005-06-24 09:01:16 +04:00
s3 2 e a0 , a9 , - 1 6
l3 2 e a0 , a1 , - 1 2
s3 2 e a2 , a9 , - 8
s3 2 e a1 , a9 , - 1 2
s3 2 e a3 , a9 , - 4
s3 2 e a4 , a0 , - 3 2
s3 2 e a5 , a0 , - 2 8
s3 2 e a6 , a0 , - 2 4
s3 2 e a7 , a0 , - 2 0
rfwo
2012-11-17 04:16:20 +04:00
ENDPROC( _ W i n d o w O v e r f l o w8 )
2005-06-24 09:01:16 +04:00
/* 8-Register Window Underflow Vector (Handler) */
2012-11-17 04:16:20 +04:00
ENTRY_ A L I G N 6 4 ( _ W i n d o w U n d e r f l o w8 )
2005-06-24 09:01:16 +04:00
l3 2 e a1 , a9 , - 1 2
l3 2 e a0 , a9 , - 1 6
l3 2 e a7 , a1 , - 1 2
l3 2 e a2 , a9 , - 8
l3 2 e a4 , a7 , - 3 2
l3 2 e a3 , a9 , - 4
l3 2 e a5 , a7 , - 2 8
l3 2 e a6 , a7 , - 2 4
l3 2 e a7 , a7 , - 2 0
rfwu
2012-11-17 04:16:20 +04:00
ENDPROC( _ W i n d o w U n d e r f l o w8 )
2005-06-24 09:01:16 +04:00
/* 12-Register Window Overflow Vector (Handler) */
2012-11-17 04:16:20 +04:00
ENTRY_ A L I G N 6 4 ( _ W i n d o w O v e r f l o w12 )
2005-06-24 09:01:16 +04:00
s3 2 e a0 , a13 , - 1 6
l3 2 e a0 , a1 , - 1 2
s3 2 e a1 , a13 , - 1 2
s3 2 e a2 , a13 , - 8
s3 2 e a3 , a13 , - 4
s3 2 e a4 , a0 , - 4 8
s3 2 e a5 , a0 , - 4 4
s3 2 e a6 , a0 , - 4 0
s3 2 e a7 , a0 , - 3 6
s3 2 e a8 , a0 , - 3 2
s3 2 e a9 , a0 , - 2 8
s3 2 e a10 , a0 , - 2 4
s3 2 e a11 , a0 , - 2 0
rfwo
2012-11-17 04:16:20 +04:00
ENDPROC( _ W i n d o w O v e r f l o w12 )
2005-06-24 09:01:16 +04:00
/* 12-Register Window Underflow Vector (Handler) */
2012-11-17 04:16:20 +04:00
ENTRY_ A L I G N 6 4 ( _ W i n d o w U n d e r f l o w12 )
2005-06-24 09:01:16 +04:00
l3 2 e a1 , a13 , - 1 2
l3 2 e a0 , a13 , - 1 6
l3 2 e a11 , a1 , - 1 2
l3 2 e a2 , a13 , - 8
l3 2 e a4 , a11 , - 4 8
l3 2 e a8 , a11 , - 3 2
l3 2 e a3 , a13 , - 4
l3 2 e a5 , a11 , - 4 4
l3 2 e a6 , a11 , - 4 0
l3 2 e a7 , a11 , - 3 6
l3 2 e a9 , a11 , - 2 8
l3 2 e a10 , a11 , - 2 4
l3 2 e a11 , a11 , - 2 0
rfwu
2012-11-17 04:16:20 +04:00
ENDPROC( _ W i n d o w U n d e r f l o w12 )
2005-06-24 09:01:16 +04:00
.text