@ -319,6 +319,55 @@ l2_disabled:
# endif / * C O N F I G _ M P C 8 5 6 9 * /
/ *
* Search f o r t h e T L B t h a t c o v e r s t h e c o d e w e ' r e e x e c u t i n g , a n d s h r i n k i t
* so t h a t i t c o v e r s o n l y t h i s 4 K p a g e . T h a t w i l l e n s u r e t h a t a n y o t h e r
* TLB w e c r e a t e w o n ' t i n t e r f e r e w i t h i t . W e a s s u m e t h a t t h e T L B e x i s t s ,
* which i s w h y w e d o n ' t c h e c k t h e V a l i d b i t o f M A S 1 .
*
* This i s n e c e s s a r y , f o r e x a m p l e , w h e n b o o t i n g f r o m t h e o n - c h i p R O M ,
* which ( o d d l y ) c r e a t e s a s i n g l e 4 G B T L B t h a t c o v e r s C C S R a n d D D R .
* If w e d o n ' t s h r i n k t h i s T L B n o w , t h e n w e ' l l a c c i d e n t a l l y d e l e t e i t
* in " p u r g e _ o l d _ c c s r _ t l b " b e l o w .
* /
bl n e x t i / * F i n d o u r a d d r e s s * /
nexti : mflr r1 / * R 1 = o u r P C * /
li r2 , 0
mtspr M A S 6 , r2 / * A s s u m e t h e c u r r e n t P I D a n d A S a r e 0 * /
isync
msync
tlbsx 0 , r1 / * T h i s m u s t s u c c e e d * /
/* Set the size of the TLB to 4KB */
mfspr r3 , M A S 1
li r2 , 0 x F 0 0
andc r3 , r3 , r2 / * C l e a r t h e T S I Z E b i t s * /
ori r3 , r3 , M A S 1 _ T S I Z E ( B O O K E _ P A G E S Z _ 4 K ) @l
mtspr M A S 1 , r3
/ *
* Set t h e b a s e a d d r e s s o f t h e T L B t o o u r P C . W e a s s u m e t h a t
* virtual = = p h y s i c a l . W e a l s o a s s u m e t h a t M A S 2 _ E P N = = M A S 3 _ R P N .
* /
lis r3 , M A S 2 _ E P N @h
ori r3 , r3 , M A S 2 _ E P N @l /* R3 = MAS2_EPN */
and r1 , r1 , r3 / * O u r P C , r o u n d e d d o w n t o t h e n e a r e s t p a g e * /
mfspr r2 , M A S 2
andc r2 , r2 , r3
or r2 , r2 , r1
mtspr M A S 2 , r2 / * S e t t h e E P N t o o u r P C b a s e a d d r e s s * /
mfspr r2 , M A S 3
andc r2 , r2 , r3
or r2 , r2 , r1
mtspr M A S 3 , r2 / * S e t t h e R P N t o o u r P C b a s e a d d r e s s * /
isync
msync
tlbwe
/ *
* Relocate C C S R , i f n e c e s s a r y . W e r e l o c a t e C C S R i f ( o b v i o u s l y ) t h e d e f a u l t
* location i s n o t w h e r e w e w a n t i t . T h i s t y p i c a l l y h a p p e n s o n a 3 6 - b i t
* system, w h e r e w e w a n t t o m o v e C C S R t o n e a r t h e t o p o f 3 6 - b i t a d d r e s s s p a c e .