2009-07-23 23:15:47 +00:00
/ *
2010-01-17 11:23:14 +00:00
* Low l e v e l T L B m i s s h a n d l e r s f o r B o o k 3 E
2009-07-23 23:15:47 +00:00
*
* Copyright ( C ) 2 0 0 8 - 2 0 0 9
* Ben. H e r r e n s c h m i d t ( b e n h @kernel.crashing.org), IBM Corp.
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* as p u b l i s h e d b y t h e F r e e S o f t w a r e F o u n d a t i o n ; either version
* 2 of t h e L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
* /
# include < a s m / p r o c e s s o r . h >
# include < a s m / r e g . h >
# include < a s m / p a g e . h >
# include < a s m / m m u . h >
# include < a s m / p p c _ a s m . h >
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / c p u t a b l e . h >
# include < a s m / p g t a b l e . h >
# include < a s m / e x c e p t i o n - 6 4 e . h >
# include < a s m / p p c - o p c o d e . h >
# ifdef C O N F I G _ P P C _ 6 4 K _ P A G E S
# define V P T E _ P M D _ S H I F T ( P T E _ I N D E X _ S I Z E + 1 )
# else
# define V P T E _ P M D _ S H I F T ( P T E _ I N D E X _ S I Z E )
# endif
# define V P T E _ P U D _ S H I F T ( V P T E _ P M D _ S H I F T + P M D _ I N D E X _ S I Z E )
# define V P T E _ P G D _ S H I F T ( V P T E _ P U D _ S H I F T + P U D _ I N D E X _ S I Z E )
# define V P T E _ I N D E X _ S I Z E ( V P T E _ P G D _ S H I F T + P G D _ I N D E X _ S I Z E )
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* TLB m i s s h a n d l i n g f o r B o o k 3 E w i t h T L B r e s e r v a t i o n a n d H E S s u p p o r t *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/* Data TLB miss */
START_ E X C E P T I O N ( d a t a _ t l b _ m i s s )
TLB_ M I S S _ P R O L O G
/ * Now w e h a n d l e t h e f a u l t p r o p e r . W e o n l y s a v e D E A R i n n o r m a l
* fault c a s e s i n c e t h a t ' s t h e o n l y i n t e r e s t i n g v a l u e s h e r e .
* We c o u l d p r o b a b l y a l s o o p t i m i z e b y n o t s a v i n g S R R 0 / 1 i n t h e
* linear m a p p i n g c a s e b u t I ' l l l e a v e t h a t f o r l a t e r
* /
mfspr r14 ,S P R N _ E S R
mfspr r16 ,S P R N _ D E A R / * g e t f a u l t i n g a d d r e s s * /
srdi r15 ,r16 ,6 0 / * g e t r e g i o n * /
cmpldi c r0 ,r15 ,0 x c / * l i n e a r m a p p i n g ? * /
TLB_ M I S S _ S T A T S _ S A V E _ I N F O
beq t l b _ l o a d _ l i n e a r / * y e s - > g o t o l i n e a r m a p l o a d * /
/ * The p a g e t a b l e s a r e m a p p e d v i r t u a l l y l i n e a r . A t t h i s p o i n t , t h o u g h ,
* we d o n ' t k n o w w h e t h e r w e a r e t r y i n g t o f a u l t i n a f i r s t l e v e l
* virtual a d d r e s s o r a v i r t u a l p a g e t a b l e a d d r e s s . W e c a n g e t t h a t
* from b i t 0 x1 o f t h e r e g i o n I D w h i c h w e h a v e s e t f o r a p a g e t a b l e
* /
andi. r10 ,r15 ,0 x1
bne- v i r t _ p a g e _ t a b l e _ t l b _ m i s s
std r14 ,E X _ T L B _ E S R ( r12 ) ; /* save ESR */
std r16 ,E X _ T L B _ D E A R ( r12 ) ; /* save DEAR */
/* We need _PAGE_PRESENT and _PAGE_ACCESSED set */
li r11 ,_ P A G E _ P R E S E N T
oris r11 ,r11 ,_ P A G E _ A C C E S S E D @h
/ * We d o t h e u s e r / k e r n e l t e s t f o r t h e P I D h e r e a l o n g w i t h t h e R W t e s t
* /
cmpldi c r0 ,r15 ,0 / * C h e c k f o r u s e r r e g i o n * /
/ * We p r e - t e s t s o m e c o m b i n a t i o n o f p e r m i s s i o n s t o a v o i d d o u b l e
* faults :
*
* We m o v e t h e E S R : S T b i t i n t o t h e p o s i t i o n o f _ P A G E _ B A P _ S W i n t h e P T E
* ESR_ S T i s 0 x00 8 0 0 0 0 0
* _ PAGE_ B A P _ S W i s 0 x00 0 0 0 0 1 0
* So t h e s h i f t i s > > 1 9 . T h i s t e s t s f o r s u p e r v i s o r w r i t e a b i l i t y .
* If t h e p a g e h a p p e n s t o b e s u p e r v i s o r w r i t e a b l e a n d n o t u s e r
* writeable, w e w i l l t a k e a n e w f a u l t l a t e r , b u t t h a t s h o u l d b e
* a r a r e e n o u g h c a s e .
*
* We a l s o m o v e E S R _ S T i n _ P A G E _ D I R T Y p o s i t i o n
* _ PAGE_ D I R T Y i s 0 x00 0 0 1 0 0 0 s o t h e s h i f t i s > > 1 1
*
* MAS1 i s p r e s e t f o r a l l w e n e e d e x c e p t f o r T I D t h a t n e e d s t o
* be c l e a r e d f o r k e r n e l t r a n s l a t i o n s
* /
rlwimi r11 ,r14 ,3 2 - 1 9 ,2 7 ,2 7
rlwimi r11 ,r14 ,3 2 - 1 6 ,1 9 ,1 9
beq n o r m a l _ t l b _ m i s s
/* XXX replace the RMW cycles with immediate loads + writes */
1 : mfspr r10 ,S P R N _ M A S 1
cmpldi c r0 ,r15 ,8 / * C h e c k f o r v m a l l o c r e g i o n * /
rlwinm r10 ,r10 ,0 ,1 6 ,1 / * C l e a r T I D * /
mtspr S P R N _ M A S 1 ,r10
beq+ n o r m a l _ t l b _ m i s s
/ * We g o t a c r a p p y a d d r e s s , j u s t f a u l t w i t h w h a t e v e r D E A R a n d E S R
* are h e r e
* /
TLB_ M I S S _ S T A T S _ D ( M M S T A T _ T L B _ M I S S _ N O R M _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
/* Instruction TLB miss */
START_ E X C E P T I O N ( i n s t r u c t i o n _ t l b _ m i s s )
TLB_ M I S S _ P R O L O G
/ * If w e t a k e a r e c u r s i v e f a u l t , t h e s e c o n d l e v e l h a n d l e r m a y n e e d
* to k n o w w h e t h e r w e a r e h a n d l i n g a d a t a o r i n s t r u c t i o n f a u l t i n
* order t o g e t t o t h e r i g h t s t o r e f a u l t h a n d l e r . W e p r o v i d e t h a t
* info b y w r i t i n g a c r a z y v a l u e i n E S R i n o u r e x c e p t i o n f r a m e
* /
li r14 ,- 1 / * s t o r e t o e x c e p t i o n f r a m e i s d o n e l a t e r * /
/ * Now w e h a n d l e t h e f a u l t p r o p e r . W e o n l y s a v e D E A R i n t h e n o n
* linear m a p p i n g c a s e s i n c e w e k n o w t h e l i n e a r m a p p i n g c a s e w i l l
* not r e - e n t e r . W e c o u l d i n d e e d o p t i m i z e a n d a l s o n o t s a v e S R R 0 / 1
* in t h e l i n e a r m a p p i n g c a s e b u t I ' l l l e a v e t h a t f o r l a t e r
*
* Faulting a d d r e s s i s S R R 0 w h i c h i s a l r e a d y i n r16
* /
srdi r15 ,r16 ,6 0 / * g e t r e g i o n * /
cmpldi c r0 ,r15 ,0 x c / * l i n e a r m a p p i n g ? * /
TLB_ M I S S _ S T A T S _ S A V E _ I N F O
beq t l b _ l o a d _ l i n e a r / * y e s - > g o t o l i n e a r m a p l o a d * /
/ * We d o t h e u s e r / k e r n e l t e s t f o r t h e P I D h e r e a l o n g w i t h t h e R W t e s t
* /
2009-08-18 19:00:34 +00:00
li r11 ,_ P A G E _ P R E S E N T | _ P A G E _ E X E C / * B a s e p e r m * /
2009-07-23 23:15:47 +00:00
oris r11 ,r11 ,_ P A G E _ A C C E S S E D @h
cmpldi c r0 ,r15 ,0 / * C h e c k f o r u s e r r e g i o n * /
std r14 ,E X _ T L B _ E S R ( r12 ) / * w r i t e c r a z y - 1 t o f r a m e * /
beq n o r m a l _ t l b _ m i s s
2010-11-17 07:20:32 +00:00
li r11 ,_ P A G E _ P R E S E N T | _ P A G E _ B A P _ S X / * B a s e p e r m * /
oris r11 ,r11 ,_ P A G E _ A C C E S S E D @h
2009-07-23 23:15:47 +00:00
/* XXX replace the RMW cycles with immediate loads + writes */
2010-11-17 07:20:32 +00:00
mfspr r10 ,S P R N _ M A S 1
2009-07-23 23:15:47 +00:00
cmpldi c r0 ,r15 ,8 / * C h e c k f o r v m a l l o c r e g i o n * /
rlwinm r10 ,r10 ,0 ,1 6 ,1 / * C l e a r T I D * /
mtspr S P R N _ M A S 1 ,r10
beq+ n o r m a l _ t l b _ m i s s
/* We got a crappy address, just fault */
TLB_ M I S S _ S T A T S _ I ( M M S T A T _ T L B _ M I S S _ N O R M _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ i n s t r u c t i o n _ s t o r a g e _ b o o k 3 e
/ *
* This i s t h e g u t s o f t h e f i r s t - l e v e l T L B m i s s h a n d l e r f o r d i r e c t
* misses. W e a r e e n t e r e d w i t h :
*
* r1 6 = f a u l t i n g a d d r e s s
* r1 5 = r e g i o n I D
* r1 4 = c r a p ( f r e e t o u s e )
* r1 3 = P A C A
* r1 2 = T L B e x c e p t i o n f r a m e i n P A C A
* r1 1 = P T E p e r m i s s i o n m a s k
* r1 0 = c r a p ( f r e e t o u s e )
* /
normal_tlb_miss :
/ * So w e f i r s t c o n s t r u c t t h e p a g e t a b l e a d d r e s s . W e d o t h a t b y
* shifting t h e b o t t o m o f t h e a d d r e s s ( n o t t h e r e g i o n I D ) b y
* PAGE_ S H I F T - 3 , c l e a r i n g t h e b o t t o m 3 b i t s ( g e t a P T E p t r ) a n d
* or' i n g t h e f o u r t h h i g h b i t .
*
* NOTE : For 6 4 K p a g e s , w e d o t h i n g s s l i g h t l y d i f f e r e n t l y i n
* order t o h a n d l e t h e w e i r d p a g e t a b l e f o r m a t u s e d b y l i n u x
* /
ori r10 ,r15 ,0 x1
# ifdef C O N F I G _ P P C _ 6 4 K _ P A G E S
/* For the top bits, 16 bytes per PTE */
rldicl r14 ,r16 ,6 4 - ( P A G E _ S H I F T - 4 ) ,P A G E _ S H I F T - 4 + 4
/ * Now c r e a t e t h e b o t t o m b i t s a s 0 i n p o s i t i o n 0 x80 0 0 a n d
* the r e s t c a l c u l a t e d f o r 8 b y t e s p e r P T E
* /
rldicl r15 ,r16 ,6 4 - ( P A G E _ S H I F T - 3 ) ,6 4 - 1 5
/* Insert the bottom bits in */
rlwimi r14 ,r15 ,0 ,1 6 ,3 1
# else
rldicl r14 ,r16 ,6 4 - ( P A G E _ S H I F T - 3 ) ,P A G E _ S H I F T - 3 + 4
# endif
sldi r15 ,r10 ,6 0
clrrdi r14 ,r14 ,3
or r10 ,r15 ,r14
2009-08-24 15:52:48 +00:00
BEGIN_ M M U _ F T R _ S E C T I O N
2011-03-30 22:57:33 -03:00
/ * Set t h e T L B r e s e r v a t i o n a n d s e a r c h f o r e x i s t i n g e n t r y . T h e n l o a d
2009-07-23 23:15:47 +00:00
* the e n t r y .
* /
PPC_ T L B S R X _ D O T ( 0 ,r16 )
ld r14 ,0 ( r10 )
beq n o r m a l _ t l b _ m i s s _ d o n e
2009-08-24 15:52:48 +00:00
MMU_ F T R _ S E C T I O N _ E L S E
ld r14 ,0 ( r10 )
ALT_ M M U _ F T R _ S E C T I O N _ E N D _ I F S E T ( M M U _ F T R _ U S E _ T L B R S R V )
2009-07-23 23:15:47 +00:00
finish_normal_tlb_miss :
/* Check if required permissions are met */
andc. r15 ,r11 ,r14
bne- n o r m a l _ t l b _ m i s s _ a c c e s s _ f a u l t
/ * Now w e b u i l d t h e M A S :
*
* MAS 0 : F u l l y s e t u p w i t h d e f a u l t s i n M A S 4 a n d T L B n C F G
* MAS 1 : A l m o s t f u l l y s e t u p
* - PID a l r e a d y u p d a t e d b y c a l l e r i f n e c e s s a r y
* - TSIZE n e e d c h a n g e i f ! b a s e p a g e s i z e , n o t
* yet i m p l e m e n t e d f o r n o w
* MAS 2 : D e f a u l t s n o t u s e f u l , n e e d t o b e r e d o n e
* MAS 3 + 7 : N e e d s t o b e d o n e
*
* TODO : mix u p c o d e b e l o w f o r b e t t e r s c h e d u l i n g
* /
clrrdi r11 ,r16 ,1 2 / * C l e a r l o w c r a p i n E A * /
rlwimi r11 ,r14 ,3 2 - 1 9 ,2 7 ,3 1 / * I n s e r t W I M G E * /
mtspr S P R N _ M A S 2 ,r11
/* Check page size, if not standard, update MAS1 */
rldicl r11 ,r14 ,6 4 - 8 ,6 4 - 8
# ifdef C O N F I G _ P P C _ 6 4 K _ P A G E S
cmpldi c r0 ,r11 ,B O O K 3 E _ P A G E S Z _ 6 4 K
# else
cmpldi c r0 ,r11 ,B O O K 3 E _ P A G E S Z _ 4 K
# endif
beq- 1 f
mfspr r11 ,S P R N _ M A S 1
rlwimi r11 ,r14 ,3 1 ,2 1 ,2 4
rlwinm r11 ,r11 ,0 ,2 1 ,1 9
mtspr S P R N _ M A S 1 ,r11
1 :
/* Move RPN in position */
rldicr r11 ,r14 ,6 4 - ( P T E _ R P N _ S H I F T - P A G E _ S H I F T ) ,6 3 - P A G E _ S H I F T
clrldi r15 ,r11 ,1 2 / * C l e a r c r a p a t t h e t o p * /
rlwimi r15 ,r14 ,3 2 - 8 ,2 2 ,2 5 / * M o v e i n U b i t s * /
rlwimi r15 ,r14 ,3 2 - 2 ,2 6 ,3 1 / * M o v e i n B A P b i t s * /
/* Mask out SW and UW if !DIRTY (XXX optimize this !) */
andi. r11 ,r14 ,_ P A G E _ D I R T Y
bne 1 f
li r11 ,M A S 3 _ S W | M A S 3 _ U W
andc r15 ,r15 ,r11
2009-08-24 15:52:48 +00:00
1 :
BEGIN_ M M U _ F T R _ S E C T I O N
srdi r16 ,r15 ,3 2
mtspr S P R N _ M A S 3 ,r15
mtspr S P R N _ M A S 7 ,r16
MMU_ F T R _ S E C T I O N _ E L S E
mtspr S P R N _ M A S 7 _ M A S 3 ,r15
ALT_ M M U _ F T R _ S E C T I O N _ E N D _ I F C L R ( M M U _ F T R _ U S E _ P A I R E D _ M A S )
2009-07-23 23:15:47 +00:00
tlbwe
normal_tlb_miss_done :
/ * We d o n ' t b o t h e r w i t h r e s t o r i n g D E A R o r E S R s i n c e w e k n o w w e a r e
* level 0 a n d j u s t g o i n g b a c k t o u s e r l a n d . T h e y a r e o n l y n e e d e d
* if y o u a r e g o i n g t o t a k e a n a c c e s s f a u l t
* /
TLB_ M I S S _ S T A T S _ X ( M M S T A T _ T L B _ M I S S _ N O R M _ O K )
TLB_ M I S S _ E P I L O G _ S U C C E S S
rfi
normal_tlb_miss_access_fault :
/* We need to check if it was an instruction miss */
2009-08-18 19:00:34 +00:00
andi. r10 ,r11 ,_ P A G E _ E X E C
2009-07-23 23:15:47 +00:00
bne 1 f
ld r14 ,E X _ T L B _ D E A R ( r12 )
ld r15 ,E X _ T L B _ E S R ( r12 )
mtspr S P R N _ D E A R ,r14
mtspr S P R N _ E S R ,r15
TLB_ M I S S _ S T A T S _ D ( M M S T A T _ T L B _ M I S S _ N O R M _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
1 : TLB_ M I S S _ S T A T S _ I ( M M S T A T _ T L B _ M I S S _ N O R M _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ i n s t r u c t i o n _ s t o r a g e _ b o o k 3 e
/ *
* This i s t h e g u t s o f t h e s e c o n d - l e v e l T L B m i s s h a n d l e r f o r d i r e c t
* misses. W e a r e e n t e r e d w i t h :
*
* r1 6 = v i r t u a l p a g e t a b l e f a u l t i n g a d d r e s s
* r1 5 = r e g i o n ( t o p 4 b i t s o f a d d r e s s )
* r1 4 = c r a p ( f r e e t o u s e )
* r1 3 = P A C A
* r1 2 = T L B e x c e p t i o n f r a m e i n P A C A
* r1 1 = c r a p ( f r e e t o u s e )
* r1 0 = c r a p ( f r e e t o u s e )
*
* Note t h a t t h i s s h o u l d o n l y e v e r b e c a l l e d a s a s e c o n d l e v e l h a n d l e r
* with t h e c u r r e n t s c h e m e w h e n u s i n g S W l o a d .
* That m e a n s w e c a n a l w a y s g e t t h e o r i g i n a l f a u l t D E A R a t
* EX_ T L B _ D E A R - E X _ T L B _ S I Z E ( r12 )
*
* It c a n b e r e - e n t e r e d b y t h e l i n e a r m a p p i n g m i s s h a n d l e r . H o w e v e r , t o
* avoid t o o m u c h c o m p l i c a t i o n , i t w i l l r e s t a r t t h e w h o l e f a u l t a t l e v e l
* 0 so w e d o n ' t c a r e t o o m u c h a b o u t c l o b b e r s
*
* XXX T h a t c o d e w a s w r i t t e n b a c k w h e n w e c o u l d n ' t c l o b b e r r14 . W e c a n n o w ,
* so w e c o u l d p r o b a b l y o p t i m i z e t h i n g s a b i t
* /
virt_page_table_tlb_miss :
/* Are we hitting a kernel page table ? */
andi. r10 ,r15 ,0 x8
/ * The c o o l t h i n g n o w i s t h a t r10 c o n t a i n s 0 f o r u s e r a n d 8 f o r k e r n e l ,
* and w e h a p p e n t o h a v e t h e s w a p p e r _ p g _ d i r a t o f f s e t 8 f r o m t h e u s e r
* pgdir i n t h e P A C A : - ) .
* /
add r11 ,r10 ,r13
/* If kernel, we need to clear MAS1 TID */
beq 1 f
/* XXX replace the RMW cycles with immediate loads + writes */
mfspr r10 ,S P R N _ M A S 1
rlwinm r10 ,r10 ,0 ,1 6 ,1 / * C l e a r T I D * /
mtspr S P R N _ M A S 1 ,r10
1 :
2009-08-24 15:52:48 +00:00
BEGIN_ M M U _ F T R _ S E C T I O N
2009-07-23 23:15:47 +00:00
/ * Search i f w e a l r e a d y h a v e a T L B e n t r y f o r t h a t v i r t u a l a d d r e s s , a n d
* if w e d o , b a i l o u t .
* /
PPC_ T L B S R X _ D O T ( 0 ,r16 )
beq v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ d o n e
2009-08-24 15:52:48 +00:00
END_ M M U _ F T R _ S E C T I O N _ I F S E T ( M M U _ F T R _ U S E _ T L B R S R V )
2009-07-23 23:15:47 +00:00
/ * Now, w e n e e d t o w a l k t h e p a g e t a b l e s . F i r s t c h e c k i f w e a r e i n
* range.
* /
rldicl. r10 ,r16 ,6 4 - ( V P T E _ I N D E X _ S I Z E + 3 ) ,V P T E _ I N D E X _ S I Z E + 3 + 4
bne- v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ f a u l t
/* Get the PGD pointer */
ld r15 ,P A C A P G D ( r11 )
cmpldi c r0 ,r15 ,0
beq- v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ f a u l t
/* Get to PGD entry */
rldicl r11 ,r16 ,6 4 - V P T E _ P G D _ S H I F T ,6 4 - P G D _ I N D E X _ S I Z E - 3
clrrdi r10 ,r11 ,3
ldx r15 ,r10 ,r15
cmpldi c r0 ,r15 ,0
beq v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ f a u l t
# ifndef C O N F I G _ P P C _ 6 4 K _ P A G E S
/* Get to PUD entry */
rldicl r11 ,r16 ,6 4 - V P T E _ P U D _ S H I F T ,6 4 - P U D _ I N D E X _ S I Z E - 3
clrrdi r10 ,r11 ,3
ldx r15 ,r10 ,r15
cmpldi c r0 ,r15 ,0
beq v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ f a u l t
# endif / * C O N F I G _ P P C _ 6 4 K _ P A G E S * /
/* Get to PMD entry */
rldicl r11 ,r16 ,6 4 - V P T E _ P M D _ S H I F T ,6 4 - P M D _ I N D E X _ S I Z E - 3
clrrdi r10 ,r11 ,3
ldx r15 ,r10 ,r15
cmpldi c r0 ,r15 ,0
beq v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ f a u l t
/ * Ok, w e ' r e a l l r i g h t , w e c a n n o w c r e a t e a k e r n e l t r a n s l a t i o n f o r
* a 4 K o r 6 4 K p a g e f r o m r16 - > r15 .
* /
/ * Now w e b u i l d t h e M A S :
*
* MAS 0 : F u l l y s e t u p w i t h d e f a u l t s i n M A S 4 a n d T L B n C F G
* MAS 1 : A l m o s t f u l l y s e t u p
* - PID a l r e a d y u p d a t e d b y c a l l e r i f n e c e s s a r y
* - TSIZE f o r n o w i s b a s e p a g e s i z e a l w a y s
* MAS 2 : U s e d e f a u l t s
* MAS 3 + 7 : N e e d s t o b e d o n e
*
* So w e o n l y d o M A S 2 a n d 3 f o r n o w . . .
* /
clrldi r11 ,r15 ,4 / * r e m o v e r e g i o n I D f r o m R P N * /
ori r10 ,r11 ,1 / * O r - i n S R * /
2009-08-24 15:52:48 +00:00
BEGIN_ M M U _ F T R _ S E C T I O N
srdi r16 ,r10 ,3 2
mtspr S P R N _ M A S 3 ,r10
mtspr S P R N _ M A S 7 ,r16
MMU_ F T R _ S E C T I O N _ E L S E
2009-07-23 23:15:47 +00:00
mtspr S P R N _ M A S 7 _ M A S 3 ,r10
2009-08-24 15:52:48 +00:00
ALT_ M M U _ F T R _ S E C T I O N _ E N D _ I F C L R ( M M U _ F T R _ U S E _ P A I R E D _ M A S )
2009-07-23 23:15:47 +00:00
tlbwe
2009-08-24 15:52:48 +00:00
BEGIN_ M M U _ F T R _ S E C T I O N
2009-07-23 23:15:47 +00:00
virt_page_table_tlb_miss_done :
/ * We h a v e o v e r r i d e n M A S 2 : E P N b u t c u r r e n t l y o u r p r i m a r y T L B m i s s
* handler w i l l a l w a y s r e s t o r e i t s o t h a t s h o u l d n o t b e a n i s s u e ,
* if w e e v e r o p t i m i z e t h e p r i m a r y h a n d l e r t o n o t w r i t e M A S 2 o n
* some c a s e s , w e ' l l h a v e t o r e s t o r e M A S 2 : E P N h e r e b a s e d o n t h e
* original f a u l t ' s D E A R . I f w e d o t h a t w e h a v e t o m o d i f y t h e
* ITLB m i s s h a n d l e r t o a l s o s t o r e S R R 0 i n t h e e x c e p t i o n f r a m e
* as D E A R .
*
* However, o n e n a s t y t h i n g w e d i d i s w e c l e a r e d t h e r e s e r v a t i o n
* ( well, p o t e n t i a l l y w e d i d ) . W e d o a t r i c k h e r e t h u s i f w e
* are n o t a l e v e l 0 e x c e p t i o n ( w e i n t e r r u p t e d t h e T L B m i s s ) w e
* offset t h e r e t u r n a d d r e s s b y - 4 i n o r d e r t o r e p l a y t h e t l b s r x
* instruction t h e r e
* /
subf r10 ,r13 ,r12
cmpldi c r0 ,r10 ,P A C A _ E X T L B + E X _ T L B _ S I Z E
bne- 1 f
ld r11 ,P A C A _ E X T L B + E X _ T L B _ S I Z E + E X _ T L B _ S R R 0 ( r13 )
addi r10 ,r11 ,- 4
std r10 ,P A C A _ E X T L B + E X _ T L B _ S I Z E + E X _ T L B _ S R R 0 ( r13 )
1 :
2009-08-24 15:52:48 +00:00
END_ M M U _ F T R _ S E C T I O N _ I F S E T ( M M U _ F T R _ U S E _ T L B R S R V )
2009-07-23 23:15:47 +00:00
/* Return to caller, normal case */
TLB_ M I S S _ S T A T S _ X ( M M S T A T _ T L B _ M I S S _ P T _ O K ) ;
TLB_ M I S S _ E P I L O G _ S U C C E S S
rfi
virt_page_table_tlb_miss_fault :
/ * If w e f a u l t h e r e , t h i n g s a r e a l i t t l e b i t t r i c k y . W e n e e d t o c a l l
2011-03-30 22:57:33 -03:00
* either d a t a o r i n s t r u c t i o n s t o r e f a u l t , a n d w e n e e d t o r e t r i e v e
2009-07-23 23:15:47 +00:00
* the o r i g i n a l f a u l t a d d r e s s a n d E S R ( f o r d a t a ) .
*
* The t h i n g i s , w e k n o w t h a t i n n o r m a l c i r c u m s t a n c e s , t h i s i s
* always c a l l e d a s a s e c o n d l e v e l t l b m i s s f o r S W l o a d o r a s a f i r s t
* level T L B m i s s f o r H W l o a d , s o w e s h o u l d b e a b l e t o p e e k a t t h e
2011-04-04 15:04:46 -07:00
* relevant i n f o r m a t i o n i n t h e f i r s t e x c e p t i o n f r a m e i n t h e P A C A .
2009-07-23 23:15:47 +00:00
*
* However, w e d o n e e d t o d o u b l e c h e c k t h a t , b e c a u s e w e m a y j u s t h i t
* a s t r a y k e r n e l p o i n t e r o r a u s e r l a n d a t t a c k t r y i n g t o h i t t h o s e
* areas. I f t h a t i s t h e c a s e , w e d o a d a t a f a u l t . ( W e c a n ' t g e t h e r e
* from a n i n s t r u c t i o n t l b m i s s a n y w a y ) .
*
* Note a l s o t h a t w h e n g o i n g t o a f a u l t , w e m u s t u n w i n d t h e p r e v i o u s
* level a s w e l l . S i n c e w e a r e d o i n g t h a t , w e d o n ' t n e e d t o c l e a r o r
* restore t h e T L B r e s e r v a t i o n n e i t h e r .
* /
subf r10 ,r13 ,r12
cmpldi c r0 ,r10 ,P A C A _ E X T L B + E X _ T L B _ S I Z E
bne- v i r t _ p a g e _ t a b l e _ t l b _ m i s s _ w h a c k o _ f a u l t
/* We dig the original DEAR and ESR from slot 0 */
ld r15 ,E X _ T L B _ D E A R + P A C A _ E X T L B ( r13 )
ld r16 ,E X _ T L B _ E S R + P A C A _ E X T L B ( r13 )
/* We check for the "special" ESR value for instruction faults */
cmpdi c r0 ,r16 ,- 1
beq 1 f
mtspr S P R N _ D E A R ,r15
mtspr S P R N _ E S R ,r16
TLB_ M I S S _ S T A T S _ D ( M M S T A T _ T L B _ M I S S _ P T _ F A U L T ) ;
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
1 : TLB_ M I S S _ S T A T S _ I ( M M S T A T _ T L B _ M I S S _ P T _ F A U L T ) ;
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ i n s t r u c t i o n _ s t o r a g e _ b o o k 3 e
virt_page_table_tlb_miss_whacko_fault :
/ * The l i n e a r f a u l t w i l l r e s t a r t e v e r y t h i n g s o E S R a n d D E A R w i l l
* not h a v e b e e n c l o b b e r e d , l e t ' s j u s t f a u l t w i t h w h a t w e h a v e
* /
TLB_ M I S S _ S T A T S _ X ( M M S T A T _ T L B _ M I S S _ P T _ F A U L T ) ;
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* TLB m i s s h a n d l i n g f o r B o o k 3 E w i t h h w p a g e t a b l e s u p p o r t *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/* Data TLB miss */
START_ E X C E P T I O N ( d a t a _ t l b _ m i s s _ h t w )
TLB_ M I S S _ P R O L O G
/ * Now w e h a n d l e t h e f a u l t p r o p e r . W e o n l y s a v e D E A R i n n o r m a l
* fault c a s e s i n c e t h a t ' s t h e o n l y i n t e r e s t i n g v a l u e s h e r e .
* We c o u l d p r o b a b l y a l s o o p t i m i z e b y n o t s a v i n g S R R 0 / 1 i n t h e
* linear m a p p i n g c a s e b u t I ' l l l e a v e t h a t f o r l a t e r
* /
mfspr r14 ,S P R N _ E S R
mfspr r16 ,S P R N _ D E A R / * g e t f a u l t i n g a d d r e s s * /
srdi r11 ,r16 ,6 0 / * g e t r e g i o n * /
cmpldi c r0 ,r11 ,0 x c / * l i n e a r m a p p i n g ? * /
TLB_ M I S S _ S T A T S _ S A V E _ I N F O
beq t l b _ l o a d _ l i n e a r / * y e s - > g o t o l i n e a r m a p l o a d * /
/ * We d o t h e u s e r / k e r n e l t e s t f o r t h e P I D h e r e a l o n g w i t h t h e R W t e s t
* /
cmpldi c r0 ,r11 ,0 / * C h e c k f o r u s e r r e g i o n * /
ld r15 ,P A C A P G D ( r13 ) / * L o a d u s e r p g d i r * /
beq h t w _ t l b _ m i s s
/* XXX replace the RMW cycles with immediate loads + writes */
1 : mfspr r10 ,S P R N _ M A S 1
cmpldi c r0 ,r11 ,8 / * C h e c k f o r v m a l l o c r e g i o n * /
rlwinm r10 ,r10 ,0 ,1 6 ,1 / * C l e a r T I D * /
mtspr S P R N _ M A S 1 ,r10
ld r15 ,P A C A _ K E R N E L P G D ( r13 ) / * L o a d k e r n e l p g d i r * /
beq+ h t w _ t l b _ m i s s
/ * We g o t a c r a p p y a d d r e s s , j u s t f a u l t w i t h w h a t e v e r D E A R a n d E S R
* are h e r e
* /
TLB_ M I S S _ S T A T S _ D ( M M S T A T _ T L B _ M I S S _ N O R M _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
/* Instruction TLB miss */
START_ E X C E P T I O N ( i n s t r u c t i o n _ t l b _ m i s s _ h t w )
TLB_ M I S S _ P R O L O G
/ * If w e t a k e a r e c u r s i v e f a u l t , t h e s e c o n d l e v e l h a n d l e r m a y n e e d
* to k n o w w h e t h e r w e a r e h a n d l i n g a d a t a o r i n s t r u c t i o n f a u l t i n
* order t o g e t t o t h e r i g h t s t o r e f a u l t h a n d l e r . W e p r o v i d e t h a t
* info b y k e e p i n g a c r a z y v a l u e f o r E S R i n r14
* /
li r14 ,- 1 / * s t o r e t o e x c e p t i o n f r a m e i s d o n e l a t e r * /
/ * Now w e h a n d l e t h e f a u l t p r o p e r . W e o n l y s a v e D E A R i n t h e n o n
* linear m a p p i n g c a s e s i n c e w e k n o w t h e l i n e a r m a p p i n g c a s e w i l l
* not r e - e n t e r . W e c o u l d i n d e e d o p t i m i z e a n d a l s o n o t s a v e S R R 0 / 1
* in t h e l i n e a r m a p p i n g c a s e b u t I ' l l l e a v e t h a t f o r l a t e r
*
* Faulting a d d r e s s i s S R R 0 w h i c h i s a l r e a d y i n r16
* /
srdi r11 ,r16 ,6 0 / * g e t r e g i o n * /
cmpldi c r0 ,r11 ,0 x c / * l i n e a r m a p p i n g ? * /
TLB_ M I S S _ S T A T S _ S A V E _ I N F O
beq t l b _ l o a d _ l i n e a r / * y e s - > g o t o l i n e a r m a p l o a d * /
/ * We d o t h e u s e r / k e r n e l t e s t f o r t h e P I D h e r e a l o n g w i t h t h e R W t e s t
* /
cmpldi c r0 ,r11 ,0 / * C h e c k f o r u s e r r e g i o n * /
ld r15 ,P A C A P G D ( r13 ) / * L o a d u s e r p g d i r * /
beq h t w _ t l b _ m i s s
/* XXX replace the RMW cycles with immediate loads + writes */
1 : mfspr r10 ,S P R N _ M A S 1
cmpldi c r0 ,r11 ,8 / * C h e c k f o r v m a l l o c r e g i o n * /
rlwinm r10 ,r10 ,0 ,1 6 ,1 / * C l e a r T I D * /
mtspr S P R N _ M A S 1 ,r10
ld r15 ,P A C A _ K E R N E L P G D ( r13 ) / * L o a d k e r n e l p g d i r * /
beq+ h t w _ t l b _ m i s s
/* We got a crappy address, just fault */
TLB_ M I S S _ S T A T S _ I ( M M S T A T _ T L B _ M I S S _ N O R M _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ i n s t r u c t i o n _ s t o r a g e _ b o o k 3 e
/ *
* This i s t h e g u t s o f t h e s e c o n d - l e v e l T L B m i s s h a n d l e r f o r d i r e c t
* misses. W e a r e e n t e r e d w i t h :
*
* r1 6 = v i r t u a l p a g e t a b l e f a u l t i n g a d d r e s s
* r1 5 = P G D p o i n t e r
* r1 4 = E S R
* r1 3 = P A C A
* r1 2 = T L B e x c e p t i o n f r a m e i n P A C A
* r1 1 = c r a p ( f r e e t o u s e )
* r1 0 = c r a p ( f r e e t o u s e )
*
* It c a n b e r e - e n t e r e d b y t h e l i n e a r m a p p i n g m i s s h a n d l e r . H o w e v e r , t o
* avoid t o o m u c h c o m p l i c a t i o n , i t w i l l s a v e / r e s t o r e t h i n g s f o r u s
* /
htw_tlb_miss :
/ * Search i f w e a l r e a d y h a v e a T L B e n t r y f o r t h a t v i r t u a l a d d r e s s , a n d
* if w e d o , b a i l o u t .
*
* MAS1 : IND s h o u l d b e a l r e a d y s e t b a s e d o n M A S 4
* /
PPC_ T L B S R X _ D O T ( 0 ,r16 )
beq h t w _ t l b _ m i s s _ d o n e
/ * Now, w e n e e d t o w a l k t h e p a g e t a b l e s . F i r s t c h e c k i f w e a r e i n
* range.
* /
rldicl. r10 ,r16 ,6 4 - P G T A B L E _ E A D D R _ S I Z E ,P G T A B L E _ E A D D R _ S I Z E + 4
bne- h t w _ t l b _ m i s s _ f a u l t
/* Get the PGD pointer */
cmpldi c r0 ,r15 ,0
beq- h t w _ t l b _ m i s s _ f a u l t
/* Get to PGD entry */
rldicl r11 ,r16 ,6 4 - ( P G D I R _ S H I F T - 3 ) ,6 4 - P G D _ I N D E X _ S I Z E - 3
clrrdi r10 ,r11 ,3
ldx r15 ,r10 ,r15
cmpldi c r0 ,r15 ,0
beq h t w _ t l b _ m i s s _ f a u l t
# ifndef C O N F I G _ P P C _ 6 4 K _ P A G E S
/* Get to PUD entry */
rldicl r11 ,r16 ,6 4 - ( P U D _ S H I F T - 3 ) ,6 4 - P U D _ I N D E X _ S I Z E - 3
clrrdi r10 ,r11 ,3
ldx r15 ,r10 ,r15
cmpldi c r0 ,r15 ,0
beq h t w _ t l b _ m i s s _ f a u l t
# endif / * C O N F I G _ P P C _ 6 4 K _ P A G E S * /
/* Get to PMD entry */
rldicl r11 ,r16 ,6 4 - ( P M D _ S H I F T - 3 ) ,6 4 - P M D _ I N D E X _ S I Z E - 3
clrrdi r10 ,r11 ,3
ldx r15 ,r10 ,r15
cmpldi c r0 ,r15 ,0
beq h t w _ t l b _ m i s s _ f a u l t
/ * Ok, w e ' r e a l l r i g h t , w e c a n n o w c r e a t e a n i n d i r e c t e n t r y f o r
* a 1 M o r 2 5 6 M p a g e .
*
* The l a s t t r i c k i s n o w t h a t b e c a u s e w e u s e " h a l f " p a g e s f o r
* the H T W ( 1 M I N D i s 2 K a n d 2 5 6 M I N D i s 3 2 K ) w e n e e d t o a c c o u n t
* for a n a d d e d L S B b i t t o t h e R P N . F o r 6 4 K p a g e s , t h e r e i s n o
* problem a s w e a l r e a d y u s e 3 2 K a r r a y s ( h a l f P T E p a g e s ) , b u t f o r
* 4 K p a g e w e n e e d t o e x t r a c t a b i t f r o m t h e v i r t u a l a d d r e s s a n d
* insert i t i n t o t h e " P A 5 2 " b i t o f t h e R P N .
* /
# ifndef C O N F I G _ P P C _ 6 4 K _ P A G E S
rlwimi r15 ,r16 ,3 2 - 9 ,2 0 ,2 0
# endif
/ * Now w e b u i l d t h e M A S :
*
* MAS 0 : F u l l y s e t u p w i t h d e f a u l t s i n M A S 4 a n d T L B n C F G
* MAS 1 : A l m o s t f u l l y s e t u p
* - PID a l r e a d y u p d a t e d b y c a l l e r i f n e c e s s a r y
* - TSIZE f o r n o w i s b a s e i n d p a g e s i z e a l w a y s
* MAS 2 : U s e d e f a u l t s
* MAS 3 + 7 : N e e d s t o b e d o n e
* /
# ifdef C O N F I G _ P P C _ 6 4 K _ P A G E S
ori r10 ,r15 ,( B O O K 3 E _ P A G E S Z _ 6 4 K < < M A S 3 _ S P S I Z E _ S H I F T )
# else
ori r10 ,r15 ,( B O O K 3 E _ P A G E S Z _ 4 K < < M A S 3 _ S P S I Z E _ S H I F T )
# endif
2009-08-24 15:52:48 +00:00
BEGIN_ M M U _ F T R _ S E C T I O N
srdi r16 ,r10 ,3 2
mtspr S P R N _ M A S 3 ,r10
mtspr S P R N _ M A S 7 ,r16
MMU_ F T R _ S E C T I O N _ E L S E
2009-07-23 23:15:47 +00:00
mtspr S P R N _ M A S 7 _ M A S 3 ,r10
2009-08-24 15:52:48 +00:00
ALT_ M M U _ F T R _ S E C T I O N _ E N D _ I F C L R ( M M U _ F T R _ U S E _ P A I R E D _ M A S )
2009-07-23 23:15:47 +00:00
tlbwe
htw_tlb_miss_done :
/ * We d o n ' t b o t h e r w i t h r e s t o r i n g D E A R o r E S R s i n c e w e k n o w w e a r e
* level 0 a n d j u s t g o i n g b a c k t o u s e r l a n d . T h e y a r e o n l y n e e d e d
* if y o u a r e g o i n g t o t a k e a n a c c e s s f a u l t
* /
TLB_ M I S S _ S T A T S _ X ( M M S T A T _ T L B _ M I S S _ P T _ O K )
TLB_ M I S S _ E P I L O G _ S U C C E S S
rfi
htw_tlb_miss_fault :
/ * We n e e d t o c h e c k i f i t w a s a n i n s t r u c t i o n m i s s . W e k n o w t h i s
* though b e c a u s e r14 w o u l d c o n t a i n - 1
* /
cmpdi c r0 ,r14 ,- 1
beq 1 f
mtspr S P R N _ D E A R ,r16
mtspr S P R N _ E S R ,r14
TLB_ M I S S _ S T A T S _ D ( M M S T A T _ T L B _ M I S S _ P T _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
1 : TLB_ M I S S _ S T A T S _ I ( M M S T A T _ T L B _ M I S S _ P T _ F A U L T )
TLB_ M I S S _ E P I L O G _ E R R O R
b e x c _ i n s t r u c t i o n _ s t o r a g e _ b o o k 3 e
/ *
* This i s t h e g u t s o f " a n y " l e v e l T L B m i s s h a n d l e r f o r k e r n e l l i n e a r
* mapping m i s s e s . W e a r e e n t e r e d w i t h :
*
*
* r1 6 = f a u l t i n g a d d r e s s
* r1 5 = c r a p ( f r e e t o u s e )
* r1 4 = E S R ( d a t a ) o r - 1 ( i n s t r u c t i o n )
* r1 3 = P A C A
* r1 2 = T L B e x c e p t i o n f r a m e i n P A C A
* r1 1 = c r a p ( f r e e t o u s e )
* r1 0 = c r a p ( f r e e t o u s e )
*
* In a d d i t i o n w e k n o w t h a t w e w i l l n o t r e - e n t e r , s o i n t h e o r y , w e c o u l d
* use a s i m p l e r e p i l o g n o t r e s t o r i n g S R R 0 / 1 e t c . . b u t w e ' l l d o t h a t l a t e r .
*
* We a l s o n e e d t o b e c a r e f u l a b o u t M A S r e g i s t e r s h e r e & T L B r e s e r v a t i o n ,
* as w e k n o w w e ' l l h a v e c l o b b e r e d t h e m i f w e i n t e r r u p t t h e m a i n T L B m i s s
* handlers i n w h i c h c a s e w e p r o b a b l y w a n t t o d o a f u l l r e s t a r t a t l e v e l
* 0 rather t h a n s a v i n g / r e s t o r i n g t h e M A S .
*
* Note : If w e c a r e a b o u t p e r f o r m a n c e o f t h a t c o r e , w e c a n e a s i l y s h u f f l e
* a f e w t h i n g s a r o u n d
* /
tlb_load_linear :
/ * For n o w , w e a s s u m e t h e l i n e a r m a p p i n g i s c o n t i g u o u s a n d s t o p s a t
* linear_ m a p _ t o p . W e a l s o a s s u m e t h e s i z e i s a m u l t i p l e o f 1 G , t h u s
* we o n l y u s e 1 G p a g e s f o r n o w . T h a t m i g h t h a v e t o b e c h a n g e d i n a
* final i m p l e m e n t a t i o n , e s p e c i a l l y w h e n d e a l i n g w i t h h y p e r v i s o r s
* /
ld r11 ,P A C A T O C ( r13 )
ld r11 ,l i n e a r _ m a p _ t o p @got(r11)
ld r10 ,0 ( r11 )
cmpld c r0 ,r10 ,r16
bge t l b _ l o a d _ l i n e a r _ f a u l t
/* MAS1 need whole new setup. */
li r15 ,( B O O K 3 E _ P A G E S Z _ 1 G B < < M A S 1 _ T S I Z E _ S H I F T )
oris r15 ,r15 ,M A S 1 _ V A L I D @h /* MAS1 needs V and TSIZE */
mtspr S P R N _ M A S 1 ,r15
/* Already somebody there ? */
PPC_ T L B S R X _ D O T ( 0 ,r16 )
beq t l b _ l o a d _ l i n e a r _ d o n e
/ * Now w e b u i l d t h e r e m a i n i n g M A S . M A S 0 a n d 2 s h o u l d b e f i n e
* with t h e i r d e f a u l t s , w h i c h l e a v e s u s w i t h M A S 3 a n d 7 . T h e
* mapping i s l i n e a r , s o w e j u s t t a k e t h e a d d r e s s , c l e a r t h e
* region b i t s , a n d o r i n t h e p e r m i s s i o n b i t s w h i c h a r e c u r r e n t l y
* hard w i r e d
* /
clrrdi r10 ,r16 ,3 0 / * 1 G p a g e i n d e x * /
clrldi r10 ,r10 ,4 / * c l e a r r e g i o n b i t s * /
ori r10 ,r10 ,M A S 3 _ S R | M A S 3 _ S W | M A S 3 _ S X
2009-08-24 15:52:48 +00:00
BEGIN_ M M U _ F T R _ S E C T I O N
srdi r16 ,r10 ,3 2
mtspr S P R N _ M A S 3 ,r10
mtspr S P R N _ M A S 7 ,r16
MMU_ F T R _ S E C T I O N _ E L S E
2009-07-23 23:15:47 +00:00
mtspr S P R N _ M A S 7 _ M A S 3 ,r10
2009-08-24 15:52:48 +00:00
ALT_ M M U _ F T R _ S E C T I O N _ E N D _ I F C L R ( M M U _ F T R _ U S E _ P A I R E D _ M A S )
2009-07-23 23:15:47 +00:00
tlbwe
tlb_load_linear_done :
/ * We u s e t h e " e r r o r " e p i l o g f o r s u c c e s s a s w e d o w a n t t o
* restore t o t h e i n i t i a l f a u l t i n g c o n t e x t , w h a t e v e r i t w a s .
* We d o t h a t b e c a u s e w e c a n ' t r e s u m e a f a u l t w i t h i n a T L B
* miss h a n d l e r , d u e t o M A S a n d T L B r e s e r v a t i o n b e i n g c l o b b e r e d .
* /
TLB_ M I S S _ S T A T S _ X ( M M S T A T _ T L B _ M I S S _ L I N E A R )
TLB_ M I S S _ E P I L O G _ E R R O R
rfi
tlb_load_linear_fault :
/* We keep the DEAR and ESR around, this shouldn't have happened */
cmpdi c r0 ,r14 ,- 1
beq 1 f
TLB_ M I S S _ E P I L O G _ E R R O R _ S P E C I A L
b e x c _ d a t a _ s t o r a g e _ b o o k 3 e
1 : TLB_ M I S S _ E P I L O G _ E R R O R _ S P E C I A L
b e x c _ i n s t r u c t i o n _ s t o r a g e _ b o o k 3 e
# ifdef C O N F I G _ B O O K 3 E _ M M U _ T L B _ S T A T S
.tlb_stat_inc :
1 : ldarx r8 ,0 ,r9
addi r8 ,r8 ,1
stdcx. r8 ,0 ,r9
bne- 1 b
blr
# endif