2005-04-17 02:20:36 +04:00
/ * clear_ p a g e . S : U l t r a S p a r c o p t i m i z e d c l e a r p a g e .
*
* Copyright ( C ) 1 9 9 6 , 1 9 9 8 , 1 9 9 9 , 2 0 0 0 , 2 0 0 4 D a v i d S . M i l l e r ( d a v e m @redhat.com)
* Copyright ( C ) 1 9 9 7 J a k u b J e l i n e k ( j a k u b @redhat.com)
* /
# include < a s m / v i s a s m . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / p a g e . h >
# include < a s m / p g t a b l e . h >
# include < a s m / s p i t f i r e . h >
2006-02-01 05:33:00 +03:00
# include < a s m / h e a d . h >
2005-04-17 02:20:36 +04:00
/ * What w e u s e d t o d o w a s l o c k a T L B e n t r y i n t o a s p e c i f i c
* TLB s l o t , c l e a r t h e p a g e w i t h i n t e r r u p t s d i s a b l e d , t h e n
* restore t h e o r i g i n a l T L B e n t r y . T h i s w a s g r e a t f o r
* disturbing t h e T L B a s l i t t l e a s p o s s i b l e , b u t i t m e a n t
* we h a d t o k e e p i n t e r r u p t s d i s a b l e d f o r a l o n g t i m e .
*
* Now, w e s i m p l y u s e t h e n o r m a l T L B l o a d i n g m e c h a n i s m ,
* and t h i s m a k e s t h e c p u c h o o s e a s l o t a l l b y i t s e l f .
* Then w e d o a n o r m a l T L B f l u s h o n e x i t . W e n e e d o n l y
* disable p r e e m p t i o n d u r i n g t h e c l e a r .
* /
.text
.globl _clear_page
_clear_page : /* %o0=dest */
ba,p t % x c c , c l e a r _ p a g e _ c o m m o n
clr % o 4
/ * This t h i n g i s p r e t t y i m p o r t a n t , i t s h o w s u p
* on t h e p r o f i l e s v i a d o _ a n o n y m o u s _ p a g e ( ) .
* /
.align 32
.globl clear_user_page
clear_user_page : /* %o0=dest, %o1=vaddr */
lduw [ % g 6 + T I _ P R E _ C O U N T ] , % o 2
sethi % u h i ( P A G E _ O F F S E T ) , % g 2
sethi % h i ( P A G E _ S I Z E ) , % o 4
sllx % g 2 , 3 2 , % g 2
2006-02-12 08:57:54 +03:00
sethi % h i ( P A G E _ K E R N E L _ L O C K E D ) , % g 3
2005-04-17 02:20:36 +04:00
2006-02-12 08:57:54 +03:00
ldx [ % g 3 + % l o ( P A G E _ K E R N E L _ L O C K E D ) ] , % g 3
2005-04-17 02:20:36 +04:00
sub % o 0 , % g 2 , % g 1 ! p a d d r
and % o 1 , % o 4 , % o 0 ! v a d d r D - c a c h e a l i a s b i t
or % g 1 , % g 3 , % g 1 ! T T E d a t a
sethi % h i ( T L B T E M P _ B A S E ) , % o 3
add % o 2 , 1 , % o 4
add % o 0 , % o 3 , % o 0 ! T T E v a d d r
/* Disable preemption. */
mov T L B _ T A G _ A C C E S S , % g 3
stw % o 4 , [ % g 6 + T I _ P R E _ C O U N T ]
/* Load TLB entry. */
rdpr % p s t a t e , % o 4
wrpr % o 4 , P S T A T E _ I E , % p s t a t e
stxa % o 0 , [ % g 3 ] A S I _ D M M U
stxa % g 1 , [ % g 0 ] A S I _ D T L B _ D A T A _ I N
2006-02-01 05:33:00 +03:00
sethi % h i ( K E R N B A S E ) , % g 1
flush % g 1
2005-04-17 02:20:36 +04:00
wrpr % o 4 , 0 x0 , % p s t a t e
mov 1 , % o 4
clear_page_common :
VISEntryHalf
membar #S t o r e L o a d | # S t o r e S t o r e | # L o a d S t o r e
fzero % f0
sethi % h i ( P A G E _ S I Z E / 6 4 ) , % o 1
mov % o 0 , % g 1 ! r e m e m b e r v a d d r f o r t l b f l u s h
fzero % f2
or % o 1 , % l o ( P A G E _ S I Z E / 6 4 ) , % o 1
faddd % f0 , % f2 , % f4
fmuld % f0 , % f2 , % f6
faddd % f0 , % f2 , % f8
fmuld % f0 , % f2 , % f10
faddd % f0 , % f2 , % f12
fmuld % f0 , % f2 , % f14
1 : stda % f0 , [ % o 0 + % g 0 ] A S I _ B L K _ P
subcc % o 1 , 1 , % o 1
bne,p t % i c c , 1 b
add % o 0 , 0 x40 , % o 0
membar #S y n c
VISExitHalf
brz,p n % o 4 , o u t
nop
stxa % g 0 , [ % g 1 ] A S I _ D M M U _ D E M A P
membar #S y n c
stw % o 2 , [ % g 6 + T I _ P R E _ C O U N T ]
out : retl
nop