2005-04-17 02:20:36 +04:00
/ *
* Cache f l u s h i n g r o u t i n e s .
*
2005-02-19 05:09:00 +03:00
* Copyright ( C ) 1 9 9 9 - 2 0 0 1 , 2 0 0 5 H e w l e t t - P a c k a r d C o
* David M o s b e r g e r - T a n g < d a v i d m @hpl.hp.com>
2005-06-03 16:36:00 +04:00
*
* 0 5 / 2 8 / 0 5 Zoltan M e n y h a r t D y n a m i c s t r i d e s i z e
2005-04-17 02:20:36 +04:00
* /
2005-06-03 16:36:00 +04:00
2005-04-17 02:20:36 +04:00
# include < a s m / a s m m a c r o . h >
2005-06-03 16:36:00 +04:00
2005-04-17 02:20:36 +04:00
/ *
* flush_ i c a c h e _ r a n g e ( s t a r t ,e n d )
2005-06-03 16:36:00 +04:00
*
* Make i - c a c h e ( s ) c o h e r e n t w i t h d - c a c h e s .
*
* Must d e a l w i t h r a n g e f r o m s t a r t t o e n d - 1 b u t n o t h i n g e l s e ( n e e d t o
2005-04-17 02:20:36 +04:00
* be c a r e f u l n o t t o t o u c h a d d r e s s e s t h a t m a y b e u n m a p p e d ) .
2005-06-03 16:36:00 +04:00
*
* Note : " in0 " a n d " i n 1 " a r e p r e s e r v e d f o r d e b u g g i n g p u r p o s e s .
2005-04-17 02:20:36 +04:00
* /
2005-09-07 02:19:30 +04:00
.section .kprobes .text , " ax"
2005-04-17 02:20:36 +04:00
GLOBAL_ E N T R Y ( f l u s h _ i c a c h e _ r a n g e )
2005-06-03 16:36:00 +04:00
2005-04-17 02:20:36 +04:00
.prologue
2005-06-03 16:36:00 +04:00
alloc r2 =ar . p f s ,2 ,0 ,0 ,0
movl r3 =ia64_i_cache_stride_shift
mov r21 =1
;;
ld8 r20 = [ r3 ] / / r20 : s t r i d e s h i f t
sub r22 =in1 ,r0 ,1 / / l a s t b y t e a d d r e s s
2005-04-17 02:20:36 +04:00
;;
2005-06-03 16:36:00 +04:00
shr. u r23 =in0 ,r20 / / s t a r t / ( s t r i d e s i z e )
shr. u r22 =r22 ,r20 / / ( l a s t b y t e a d d r e s s ) / ( s t r i d e s i z e )
shl r21 =r21 ,r20 / / r21 : s t r i d e s i z e o f t h e i - c a c h e ( s )
;;
sub r8 =r22 ,r23 / / n u m b e r o f s t r i d e s - 1
shl r24 =r23 ,r20 / / r24 : a d d r e s s e s f o r " f c . i " =
/ / " start" r o u n d e d d o w n t o s t r i d e b o u n d a r y
.save ar. l c ,r3
mov r3 =ar . l c / / s a v e a r . l c
2005-04-17 02:20:36 +04:00
;;
.body
2005-06-03 16:36:00 +04:00
mov a r . l c =r8
2005-04-17 02:20:36 +04:00
;;
2005-06-03 16:36:00 +04:00
/ *
* 3 2 byte a l i g n e d l o o p , e v e n n u m b e r o f ( a c t u a l l y 2 ) b u n d l e s
* /
.Loop : fc. i r24 / / i s s u a b l e o n M 0 o n l y
add r24 =r21 ,r24 / / w e f l u s h " s t r i d e s i z e " b y t e s p e r i t e r a t i o n
nop. i 0
2005-04-17 02:20:36 +04:00
br. c l o o p . s p t k . f e w . L o o p
;;
sync. i
;;
srlz. i
;;
2005-06-03 16:36:00 +04:00
mov a r . l c =r3 / / r e s t o r e a r . l c
2005-04-17 02:20:36 +04:00
br. r e t . s p t k . m a n y r p
END( f l u s h _ i c a c h e _ r a n g e )
2008-10-17 23:14:13 +04:00
/ *
* clflush_ c a c h e _ r a n g e ( s t a r t ,s i z e )
*
* Flush c a c h e l i n e s f r o m s t a r t t o s t a r t + s i z e - 1 .
*
* Must d e a l w i t h r a n g e f r o m s t a r t t o s t a r t + s i z e - 1 b u t n o t h i n g e l s e
* ( need t o b e c a r e f u l n o t t o t o u c h a d d r e s s e s t h a t m a y b e
* unmapped) .
*
* Note : " in0 " a n d " i n 1 " a r e p r e s e r v e d f o r d e b u g g i n g p u r p o s e s .
* /
.section .kprobes .text , " ax"
GLOBAL_ E N T R Y ( c l f l u s h _ c a c h e _ r a n g e )
.prologue
alloc r2 =ar . p f s ,2 ,0 ,0 ,0
movl r3 =ia64_cache_stride_shift
mov r21 =1
add r22 =in1 ,i n 0
;;
ld8 r20 = [ r3 ] / / r20 : s t r i d e s h i f t
sub r22 =r22 ,r0 ,1 / / l a s t b y t e a d d r e s s
;;
shr. u r23 =in0 ,r20 / / s t a r t / ( s t r i d e s i z e )
shr. u r22 =r22 ,r20 / / ( l a s t b y t e a d d r e s s ) / ( s t r i d e s i z e )
shl r21 =r21 ,r20 / / r21 : s t r i d e s i z e o f t h e i - c a c h e ( s )
;;
sub r8 =r22 ,r23 / / n u m b e r o f s t r i d e s - 1
shl r24 =r23 ,r20 / / r24 : a d d r e s s e s f o r " f c " =
/ / " start" r o u n d e d d o w n t o s t r i d e
/ / boundary
.save ar. l c ,r3
mov r3 =ar . l c / / s a v e a r . l c
;;
.body
mov a r . l c =r8
;;
/ *
* 3 2 byte a l i g n e d l o o p , e v e n n u m b e r o f ( a c t u a l l y 2 ) b u n d l e s
* /
.Loop_fc :
fc r24 / / i s s u a b l e o n M 0 o n l y
add r24 =r21 ,r24 / / w e f l u s h " s t r i d e s i z e " b y t e s p e r i t e r a t i o n
nop. i 0
br. c l o o p . s p t k . f e w . L o o p _ f c
;;
sync. i
;;
srlz. i
;;
mov a r . l c =r3 / / r e s t o r e a r . l c
br. r e t . s p t k . m a n y r p
END( c l f l u s h _ c a c h e _ r a n g e )