2005-04-17 02:20:36 +04:00
/ *
* ia6 4 / k e r n e l / e n t r y . S
*
* Kernel e n t r y p o i n t s .
*
* Copyright ( C ) 1 9 9 8 - 2 0 0 3 , 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>
* Copyright ( C ) 1 9 9 9 , 2 0 0 2 - 2 0 0 3
* Asit M a l l i c k < A s i t . K . M a l l i c k @intel.com>
* Don D u g g e r < D o n . D u g g e r @intel.com>
* Suresh S i d d h a < s u r e s h . b . s i d d h a @intel.com>
* Fenghua Y u < f e n g h u a . y u @intel.com>
* Copyright ( C ) 1 9 9 9 V A L i n u x S y s t e m s
* Copyright ( C ) 1 9 9 9 W a l t D r u m m o n d < d r u m m o n d @valinux.com>
* /
/ *
* ia6 4 _ s w i t c h _ t o n o w p l a c e s c o r r e c t v i r t u a l m a p p i n g i n i n T R 2 f o r
* kernel s t a c k . T h i s a l l o w s u s t o h a n d l e i n t e r r u p t s w i t h o u t c h a n g i n g
* to p h y s i c a l m o d e .
*
* Jonathan N i c k l i n < n i c k l i n @missioncriticallinux.com>
* Patrick O ' R o u r k e < o r o u r k e @missioncriticallinux.com>
* 1 1 / 0 7 / 2 0 0 0
* /
/ *
* Global ( p r e s e r v e d ) p r e d i c a t e u s a g e o n s y s c a l l e n t r y / e x i t p a t h :
*
* pKStk : See e n t r y . h .
* pUStk : See e n t r y . h .
* pSys : See e n t r y . h .
* pNonSys : ! pSys
* /
# include < l i n u x / c o n f i g . h >
# include < a s m / a s m m a c r o . h >
# include < a s m / c a c h e . h >
# include < a s m / e r r n o . h >
# include < a s m / k r e g s . h >
2005-09-10 00:03:13 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
# include < a s m / p g t a b l e . h >
# include < a s m / p e r c p u . h >
# include < a s m / p r o c e s s o r . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / u n i s t d . h >
# include " m i n s t a t e . h "
/ *
* execve( ) i s s p e c i a l b e c a u s e i n c a s e o f s u c c e s s , w e n e e d t o
* setup a n u l l r e g i s t e r w i n d o w f r a m e .
* /
ENTRY( i a64 _ e x e c v e )
/ *
* Allocate 8 i n p u t r e g i s t e r s s i n c e p t r a c e ( ) m a y c l o b b e r t h e m
* /
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc l o c1 =ar . p f s ,8 ,2 ,4 ,0
mov l o c0 =rp
.body
mov o u t 0 =in0 / / f i l e n a m e
;; // stop bit between alloc and call
mov o u t 1 =in1 / / a r g v
mov o u t 2 =in2 / / e n v p
add o u t 3 =16 ,s p / / r e g s
br. c a l l . s p t k . m a n y r p =sys_execve
.ret0 :
# ifdef C O N F I G _ I A 3 2 _ S U P P O R T
/ *
* Check i f w e ' r e r e t u r n i n g t o i a32 m o d e . I f s o , w e n e e d t o r e s t o r e i a32 r e g i s t e r s
* from p t _ r e g s .
* /
adds r16 =PT ( C R _ I P S R ) + 1 6 ,s p
;;
ld8 r16 = [ r16 ]
# endif
cmp4 . g e p6 ,p7 =r8 ,r0
mov a r . p f s =loc1 / / r e s t o r e a r . p f s
sxt4 r8 =r8 / / r e t u r n 6 4 - b i t r e s u l t
;;
stf. s p i l l [ s p ] =f0
( p6 ) c m p . n e p K S t k ,p U S t k =r0 ,r0 / / a s u c c e s s f u l e x e c v e ( ) l a n d s u s i n u s e r - m o d e . . .
mov r p =loc0
( p6 ) m o v a r . p f s =r0 / / c l e a r a r . p f s o n s u c c e s s
( p7 ) b r . r e t . s p t k . m a n y r p
/ *
* In t h e o r y , w e ' d h a v e t o z a p t h i s s t a t e o n l y t o p r e v e n t l e a k i n g o f
* security s e n s i t i v e s t a t e ( e . g . , i f c u r r e n t - > m m - > d u m p a b l e i s z e r o ) . H o w e v e r ,
* this e x e c u t e s i n l e s s t h a n 2 0 c y c l e s e v e n o n I t a n i u m , s o i t ' s n o t w o r t h
* optimizing f o r . . . ) .
* /
mov a r . u n a t =0 ; mov ar.lc=0
mov r4 =0 ; mov f2=f0; mov b1=r0
mov r5 =0 ; mov f3=f0; mov b2=r0
mov r6 =0 ; mov f4=f0; mov b3=r0
mov r7 =0 ; mov f5=f0; mov b4=r0
ldf. f i l l f12 = [ s p ] ; mov f13=f0; mov b5=r0
ldf. f i l l f14 = [ s p ] ; ldf.fill f15=[sp]; mov f16=f0
ldf. f i l l f17 = [ s p ] ; ldf.fill f18=[sp]; mov f19=f0
ldf. f i l l f20 = [ s p ] ; ldf.fill f21=[sp]; mov f22=f0
ldf. f i l l f23 = [ s p ] ; ldf.fill f24=[sp]; mov f25=f0
ldf. f i l l f26 = [ s p ] ; ldf.fill f27=[sp]; mov f28=f0
ldf. f i l l f29 = [ s p ] ; ldf.fill f30=[sp]; mov f31=f0
# ifdef C O N F I G _ I A 3 2 _ S U P P O R T
tbit. n z p6 ,p0 =r16 , I A 6 4 _ P S R _ I S _ B I T
movl l o c0 =ia64_ret_from_ia32_execve
;;
( p6 ) m o v r p =loc0
# endif
br. r e t . s p t k . m a n y r p
END( i a64 _ e x e c v e )
/ *
* sys_ c l o n e 2 ( u 6 4 f l a g s , u 6 4 u s t a c k _ b a s e , u 6 4 u s t a c k _ s i z e , u 6 4 p a r e n t _ t i d p t r , u 6 4 c h i l d _ t i d p t r ,
* u6 4 t l s )
* /
GLOBAL_ E N T R Y ( s y s _ c l o n e 2 )
/ *
* Allocate 8 i n p u t r e g i s t e r s s i n c e p t r a c e ( ) m a y c l o b b e r t h e m
* /
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc r16 =ar . p f s ,8 ,2 ,6 ,0
DO_ S A V E _ S W I T C H _ S T A C K
adds r2 =PT ( R 1 6 ) + I A 6 4 _ S W I T C H _ S T A C K _ S I Z E + 1 6 ,s p
mov l o c0 =rp
mov l o c1 =r16 / / s a v e a r . p f s a c r o s s d o _ f o r k
.body
mov o u t 1 =in1
mov o u t 3 =in2
tbit. n z p6 ,p0 =in0 ,C L O N E _ S E T T L S _ B I T
mov o u t 4 =in3 / / p a r e n t _ t i d p t r : v a l i d o n l y w / C L O N E _ P A R E N T _ S E T T I D
;;
( p6 ) s t 8 [ r2 ] =in5 / / s t o r e T L S i n r16 f o r c o p y _ t h r e a d ( )
mov o u t 5 =in4 / / c h i l d _ t i d p t r : v a l i d o n l y w / C L O N E _ C H I L D _ S E T T I D o r C L O N E _ C H I L D _ C L E A R T I D
adds o u t 2 =IA64_SWITCH_STACK_SIZE + 1 6 ,s p / / o u t 2 = & r e g s
mov o u t 0 =in0 / / o u t 0 = c l o n e _ f l a g s
br. c a l l . s p t k . m a n y r p =do_fork
.ret1 : .restore sp
adds s p =IA64_SWITCH_STACK_SIZE ,s p / / p o p t h e s w i t c h s t a c k
mov a r . p f s =loc1
mov r p =loc0
br. r e t . s p t k . m a n y r p
END( s y s _ c l o n e 2 )
/ *
* sys_ c l o n e ( u 6 4 f l a g s , u 6 4 u s t a c k _ b a s e , u 6 4 p a r e n t _ t i d p t r , u 6 4 c h i l d _ t i d p t r , u 6 4 t l s )
* Deprecated. U s e s y s _ c l o n e 2 ( ) i n s t e a d .
* /
GLOBAL_ E N T R Y ( s y s _ c l o n e )
/ *
* Allocate 8 i n p u t r e g i s t e r s s i n c e p t r a c e ( ) m a y c l o b b e r t h e m
* /
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc r16 =ar . p f s ,8 ,2 ,6 ,0
DO_ S A V E _ S W I T C H _ S T A C K
adds r2 =PT ( R 1 6 ) + I A 6 4 _ S W I T C H _ S T A C K _ S I Z E + 1 6 ,s p
mov l o c0 =rp
mov l o c1 =r16 / / s a v e a r . p f s a c r o s s d o _ f o r k
.body
mov o u t 1 =in1
mov o u t 3 =16 / / s t a c k s i z e ( c o m p e n s a t e s f o r 1 6 - b y t e s c r a t c h a r e a )
tbit. n z p6 ,p0 =in0 ,C L O N E _ S E T T L S _ B I T
mov o u t 4 =in2 / / p a r e n t _ t i d p t r : v a l i d o n l y w / C L O N E _ P A R E N T _ S E T T I D
;;
( p6 ) s t 8 [ r2 ] =in4 / / s t o r e T L S i n r13 ( t p )
mov o u t 5 =in3 / / c h i l d _ t i d p t r : v a l i d o n l y w / C L O N E _ C H I L D _ S E T T I D o r C L O N E _ C H I L D _ C L E A R T I D
adds o u t 2 =IA64_SWITCH_STACK_SIZE + 1 6 ,s p / / o u t 2 = & r e g s
mov o u t 0 =in0 / / o u t 0 = c l o n e _ f l a g s
br. c a l l . s p t k . m a n y r p =do_fork
.ret2 : .restore sp
adds s p =IA64_SWITCH_STACK_SIZE ,s p / / p o p t h e s w i t c h s t a c k
mov a r . p f s =loc1
mov r p =loc0
br. r e t . s p t k . m a n y r p
END( s y s _ c l o n e )
/ *
* prev_ t a s k < - i a64 _ s w i t c h _ t o ( s t r u c t t a s k _ s t r u c t * n e x t )
* With I n g o ' s n e w s c h e d u l e r , i n t e r r u p t s a r e d i s a b l e d w h e n t h i s r o u t i n e g e t s
* called. T h e c o d e s t a r t i n g a t . m a p r e l i e s o n t h i s . T h e r e s t o f t h e c o d e
* doesn' t c a r e a b o u t t h e i n t e r r u p t m a s k i n g s t a t u s .
* /
GLOBAL_ E N T R Y ( i a64 _ s w i t c h _ t o )
.prologue
alloc r16 =ar . p f s ,1 ,0 ,0 ,0
DO_ S A V E _ S W I T C H _ S T A C K
.body
adds r22 =IA64_TASK_THREAD_KSP_OFFSET ,r13
movl r25 =init_task
mov r27 =IA64_KR ( C U R R E N T _ S T A C K )
adds r21 =IA64_TASK_THREAD_KSP_OFFSET ,i n 0
dep r20 =0 ,i n 0 ,6 1 ,3 / / p h y s i c a l a d d r e s s o f " n e x t "
;;
st8 [ r22 ] =sp / / s a v e k e r n e l s t a c k p o i n t e r o f o l d t a s k
shr. u r26 =r20 ,I A 6 4 _ G R A N U L E _ S H I F T
cmp. e q p7 ,p6 =r25 ,i n 0
;;
/ *
* If w e ' v e a l r e a d y m a p p e d t h i s t a s k ' s p a g e , w e c a n s k i p d o i n g i t a g a i n .
* /
( p6 ) c m p . e q p7 ,p6 =r26 ,r27
( p6 ) b r . c o n d . d p n t . m a p
;;
.done :
ld8 s p = [ r21 ] / / l o a d k e r n e l s t a c k p o i n t e r o f n e w t a s k
mov I A 6 4 _ K R ( C U R R E N T ) =in0 / / u p d a t e " c u r r e n t " a p p l i c a t i o n r e g i s t e r
mov r8 =r13 / / r e t u r n p o i n t e r t o p r e v i o u s l y r u n n i n g t a s k
mov r13 =in0 / / s e t " c u r r e n t " p o i n t e r
;;
DO_ L O A D _ S W I T C H _ S T A C K
# ifdef C O N F I G _ S M P
sync. i / / e n s u r e " f c " s d o n e b y t h i s C P U a r e v i s i b l e o n o t h e r C P U s
# endif
br. r e t . s p t k . m a n y r p / / b o o g i e o n o u t i n n e w c o n t e x t
.map :
rsm p s r . i c / / i n t e r r u p t s ( p s r . i ) a r e a l r e a d y d i s a b l e d h e r e
movl r25 =PAGE_KERNEL
;;
srlz. d
or r23 =r25 ,r20 / / c o n s t r u c t P A | p a g e p r o p e r t i e s
mov r25 =IA64_GRANULE_SHIFT < < 2
;;
mov c r . i t i r =r25
mov c r . i f a =in0 / / V A o f n e x t t a s k . . .
;;
mov r25 =IA64_TR_CURRENT_STACK
mov I A 6 4 _ K R ( C U R R E N T _ S T A C K ) =r26 / / r e m e m b e r l a s t p a g e w e m a p p e d . . .
;;
itr. d d t r [ r25 ] =r23 / / w i r e i n n e w m a p p i n g . . .
2005-09-07 12:00:37 +04:00
ssm p s r . i c / / r e e n a b l e t h e p s r . i c b i t
;;
srlz. d
2005-04-17 02:20:36 +04:00
br. c o n d . s p t k . d o n e
END( i a64 _ s w i t c h _ t o )
/ *
* Note t h a t i n t e r r u p t s a r e e n a b l e d d u r i n g s a v e _ s w i t c h _ s t a c k a n d l o a d _ s w i t c h _ s t a c k . T h i s
* means t h a t w e m a y g e t a n i n t e r r u p t w i t h " s p " p o i n t i n g t o t h e n e w k e r n e l s t a c k w h i l e
* ar. b s p s t o r e i s s t i l l p o i n t i n g t o t h e o l d k e r n e l b a c k i n g s t o r e a r e a . S i n c e a r . r s c ,
* ar. r n a t , a r . b s p , a n d a r . b s p s t o r e a r e a l l p r e s e r v e d b y i n t e r r u p t s , t h i s i s n o t a
* problem. A l s o , w e d o n ' t n e e d t o s p e c i f y u n w i n d i n f o r m a t i o n f o r p r e s e r v e d r e g i s t e r s
* that a r e n o t m o d i f i e d i n s a v e _ s w i t c h _ s t a c k a s t h e r i g h t u n w i n d i n f o r m a t i o n i s a l r e a d y
* specified a t t h e c a l l - s i t e o f s a v e _ s w i t c h _ s t a c k .
* /
/ *
* save_switch_stack :
* - r1 6 h o l d s a r . p f s
* - b7 h o l d s a d d r e s s t o r e t u r n t o
* - rp ( b0 ) h o l d s r e t u r n a d d r e s s t o s a v e
* /
GLOBAL_ E N T R Y ( s a v e _ s w i t c h _ s t a c k )
.prologue
.altrp b7
flushrs / / f l u s h d i r t y r e g s t o b a c k i n g s t o r e ( m u s t b e f i r s t i n i n s n g r o u p )
.save @priunat,r17
mov r17 =ar . u n a t / / p r e s e r v e c a l l e r ' s
.body
# ifdef C O N F I G _ I T A N I U M
adds r2 =16 + 1 2 8 ,s p
adds r3 =16 + 6 4 ,s p
adds r14 =SW ( R 4 ) + 1 6 ,s p
;;
st8 . s p i l l [ r14 ] =r4 ,1 6 / / s p i l l r4
lfetch. f a u l t . e x c l . n t 1 [ r3 ] ,1 2 8
;;
lfetch. f a u l t . e x c l . n t 1 [ r2 ] ,1 2 8
lfetch. f a u l t . e x c l . n t 1 [ r3 ] ,1 2 8
;;
lfetch. f a u l t . e x c l [ r2 ]
lfetch. f a u l t . e x c l [ r3 ]
adds r15 =SW ( R 5 ) + 1 6 ,s p
# else
add r2 =16 + 3 * 1 2 8 ,s p
add r3 =16 ,s p
add r14 =SW ( R 4 ) + 1 6 ,s p
;;
st8 . s p i l l [ r14 ] =r4 ,S W ( R 6 ) - S W ( R 4 ) / / s p i l l r4 a n d p r e f e t c h o f f s e t 0 x1 c0
lfetch. f a u l t . e x c l . n t 1 [ r3 ] ,1 2 8 / / p r e f e t c h o f f s e t 0 x01 0
;;
lfetch. f a u l t . e x c l . n t 1 [ r3 ] ,1 2 8 / / p r e f e t c h o f f s e t 0 x09 0
lfetch. f a u l t . e x c l . n t 1 [ r2 ] ,1 2 8 / / p r e f e t c h o f f s e t 0 x19 0
;;
lfetch. f a u l t . e x c l . n t 1 [ r3 ] / / p r e f e t c h o f f s e t 0 x11 0
lfetch. f a u l t . e x c l . n t 1 [ r2 ] / / p r e f e t c h o f f s e t 0 x21 0
adds r15 =SW ( R 5 ) + 1 6 ,s p
# endif
;;
st8 . s p i l l [ r15 ] =r5 ,S W ( R 7 ) - S W ( R 5 ) / / s p i l l r5
mov. m a r . r s c =0 / / p u t R S E i n m o d e : e n f o r c e d l a z y , l i t t l e e n d i a n , p l 0
add r2 =SW ( F 2 ) + 1 6 ,s p / / r2 = & s w - > f2
;;
st8 . s p i l l [ r14 ] =r6 ,S W ( B 0 ) - S W ( R 6 ) / / s p i l l r6
mov. m r18 =ar . f p s r / / p r e s e r v e f p s r
add r3 =SW ( F 3 ) + 1 6 ,s p / / r3 = & s w - > f3
;;
stf. s p i l l [ r2 ] =f2 ,3 2
mov. m r19 =ar . r n a t
mov r21 =b0
stf. s p i l l [ r3 ] =f3 ,3 2
st8 . s p i l l [ r15 ] =r7 ,S W ( B 2 ) - S W ( R 7 ) / / s p i l l r7
mov r22 =b1
;;
/ / since w e ' r e d o n e w i t h t h e s p i l l s , r e a d a n d s a v e a r . u n a t :
mov. m r29 =ar . u n a t
mov. m r20 =ar . b s p s t o r e
mov r23 =b2
stf. s p i l l [ r2 ] =f4 ,3 2
stf. s p i l l [ r3 ] =f5 ,3 2
mov r24 =b3
;;
st8 [ r14 ] =r21 ,S W ( B 1 ) - S W ( B 0 ) / / s a v e b0
st8 [ r15 ] =r23 ,S W ( B 3 ) - S W ( B 2 ) / / s a v e b2
mov r25 =b4
mov r26 =b5
;;
st8 [ r14 ] =r22 ,S W ( B 4 ) - S W ( B 1 ) / / s a v e b1
st8 [ r15 ] =r24 ,S W ( A R _ P F S ) - S W ( B 3 ) / / s a v e b3
mov r21 =ar . l c / / I - u n i t
stf. s p i l l [ r2 ] =f12 ,3 2
stf. s p i l l [ r3 ] =f13 ,3 2
;;
st8 [ r14 ] =r25 ,S W ( B 5 ) - S W ( B 4 ) / / s a v e b4
st8 [ r15 ] =r16 ,S W ( A R _ L C ) - S W ( A R _ P F S ) / / s a v e a r . p f s
stf. s p i l l [ r2 ] =f14 ,3 2
stf. s p i l l [ r3 ] =f15 ,3 2
;;
st8 [ r14 ] =r26 / / s a v e b5
st8 [ r15 ] =r21 / / s a v e a r . l c
stf. s p i l l [ r2 ] =f16 ,3 2
stf. s p i l l [ r3 ] =f17 ,3 2
;;
stf. s p i l l [ r2 ] =f18 ,3 2
stf. s p i l l [ r3 ] =f19 ,3 2
;;
stf. s p i l l [ r2 ] =f20 ,3 2
stf. s p i l l [ r3 ] =f21 ,3 2
;;
stf. s p i l l [ r2 ] =f22 ,3 2
stf. s p i l l [ r3 ] =f23 ,3 2
;;
stf. s p i l l [ r2 ] =f24 ,3 2
stf. s p i l l [ r3 ] =f25 ,3 2
;;
stf. s p i l l [ r2 ] =f26 ,3 2
stf. s p i l l [ r3 ] =f27 ,3 2
;;
stf. s p i l l [ r2 ] =f28 ,3 2
stf. s p i l l [ r3 ] =f29 ,3 2
;;
stf. s p i l l [ r2 ] =f30 ,S W ( A R _ U N A T ) - S W ( F 3 0 )
stf. s p i l l [ r3 ] =f31 ,S W ( P R ) - S W ( F 3 1 )
add r14 =SW ( C A L L E R _ U N A T ) + 1 6 ,s p
;;
st8 [ r2 ] =r29 ,S W ( A R _ R N A T ) - S W ( A R _ U N A T ) / / s a v e a r . u n a t
st8 [ r14 ] =r17 ,S W ( A R _ F P S R ) - S W ( C A L L E R _ U N A T ) / / s a v e c a l l e r _ u n a t
mov r21 =pr
;;
st8 [ r2 ] =r19 ,S W ( A R _ B S P S T O R E ) - S W ( A R _ R N A T ) / / s a v e a r . r n a t
st8 [ r3 ] =r21 / / s a v e p r e d i c a t e r e g i s t e r s
;;
st8 [ r2 ] =r20 / / s a v e a r . b s p s t o r e
st8 [ r14 ] =r18 / / s a v e f p s r
mov a r . r s c =3 / / p u t R S E b a c k i n t o e a g e r m o d e , p l 0
br. c o n d . s p t k . m a n y b7
END( s a v e _ s w i t c h _ s t a c k )
/ *
* load_switch_stack :
* - " invala" M U S T b e d o n e a t c a l l s i t e ( n o r m a l l y i n D O _ L O A D _ S W I T C H _ S T A C K )
* - b7 h o l d s a d d r e s s t o r e t u r n t o
* - must n o t t o u c h r8 - r11
* /
ENTRY( l o a d _ s w i t c h _ s t a c k )
.prologue
.altrp b7
.body
lfetch. f a u l t . n t 1 [ s p ]
adds r2 =SW ( A R _ B S P S T O R E ) + 1 6 ,s p
adds r3 =SW ( A R _ U N A T ) + 1 6 ,s p
mov a r . r s c =0 / / p u t R S E i n t o e n f o r c e d l a z y m o d e
adds r14 =SW ( C A L L E R _ U N A T ) + 1 6 ,s p
adds r15 =SW ( A R _ F P S R ) + 1 6 ,s p
;;
ld8 r27 = [ r2 ] ,( S W ( B 0 ) - S W ( A R _ B S P S T O R E ) ) / / b s p s t o r e
ld8 r29 = [ r3 ] ,( S W ( B 1 ) - S W ( A R _ U N A T ) ) / / u n a t
;;
ld8 r21 = [ r2 ] ,1 6 / / r e s t o r e b0
ld8 r22 = [ r3 ] ,1 6 / / r e s t o r e b1
;;
ld8 r23 = [ r2 ] ,1 6 / / r e s t o r e b2
ld8 r24 = [ r3 ] ,1 6 / / r e s t o r e b3
;;
ld8 r25 = [ r2 ] ,1 6 / / r e s t o r e b4
ld8 r26 = [ r3 ] ,1 6 / / r e s t o r e b5
;;
ld8 r16 = [ r2 ] ,( S W ( P R ) - S W ( A R _ P F S ) ) / / a r . p f s
ld8 r17 = [ r3 ] ,( S W ( A R _ R N A T ) - S W ( A R _ L C ) ) / / a r . l c
;;
ld8 r28 = [ r2 ] / / r e s t o r e p r
ld8 r30 = [ r3 ] / / r e s t o r e r n a t
;;
ld8 r18 = [ r14 ] ,1 6 / / r e s t o r e c a l l e r ' s u n a t
ld8 r19 = [ r15 ] ,2 4 / / r e s t o r e f p s r
;;
ldf. f i l l f2 = [ r14 ] ,3 2
ldf. f i l l f3 = [ r15 ] ,3 2
;;
ldf. f i l l f4 = [ r14 ] ,3 2
ldf. f i l l f5 = [ r15 ] ,3 2
;;
ldf. f i l l f12 = [ r14 ] ,3 2
ldf. f i l l f13 = [ r15 ] ,3 2
;;
ldf. f i l l f14 = [ r14 ] ,3 2
ldf. f i l l f15 = [ r15 ] ,3 2
;;
ldf. f i l l f16 = [ r14 ] ,3 2
ldf. f i l l f17 = [ r15 ] ,3 2
;;
ldf. f i l l f18 = [ r14 ] ,3 2
ldf. f i l l f19 = [ r15 ] ,3 2
mov b0 =r21
;;
ldf. f i l l f20 = [ r14 ] ,3 2
ldf. f i l l f21 = [ r15 ] ,3 2
mov b1 =r22
;;
ldf. f i l l f22 = [ r14 ] ,3 2
ldf. f i l l f23 = [ r15 ] ,3 2
mov b2 =r23
;;
mov a r . b s p s t o r e =r27
mov a r . u n a t =r29 / / e s t a b l i s h u n a t h o l d i n g t h e N a T b i t s f o r r4 - r7
mov b3 =r24
;;
ldf. f i l l f24 = [ r14 ] ,3 2
ldf. f i l l f25 = [ r15 ] ,3 2
mov b4 =r25
;;
ldf. f i l l f26 = [ r14 ] ,3 2
ldf. f i l l f27 = [ r15 ] ,3 2
mov b5 =r26
;;
ldf. f i l l f28 = [ r14 ] ,3 2
ldf. f i l l f29 = [ r15 ] ,3 2
mov a r . p f s =r16
;;
ldf. f i l l f30 = [ r14 ] ,3 2
ldf. f i l l f31 = [ r15 ] ,2 4
mov a r . l c =r17
;;
ld8 . f i l l r4 = [ r14 ] ,1 6
ld8 . f i l l r5 = [ r15 ] ,1 6
mov p r =r28 ,- 1
;;
ld8 . f i l l r6 = [ r14 ] ,1 6
ld8 . f i l l r7 = [ r15 ] ,1 6
mov a r . u n a t =r18 / / r e s t o r e c a l l e r ' s u n a t
mov a r . r n a t =r30 / / m u s t r e s t o r e a f t e r b s p s t o r e b u t b e f o r e r s c !
mov a r . f p s r =r19 / / r e s t o r e f p s r
mov a r . r s c =3 / / p u t R S E b a c k i n t o e a g e r m o d e , p l 0
br. c o n d . s p t k . m a n y b7
END( l o a d _ s w i t c h _ s t a c k )
2005-09-10 00:02:02 +04:00
GLOBAL_ E N T R Y ( p r e f e t c h _ s t a c k )
add r14 = - I A 6 4 _ S W I T C H _ S T A C K _ S I Z E , s p
add r15 = I A 6 4 _ T A S K _ T H R E A D _ K S P _ O F F S E T , i n 0
;;
ld8 r16 = [ r15 ] / / l o a d n e x t ' s s t a c k p o i n t e r
lfetch. f a u l t . e x c l [ r14 ] , 1 2 8
;;
lfetch. f a u l t . e x c l [ r14 ] , 1 2 8
lfetch. f a u l t [ r16 ] , 1 2 8
;;
lfetch. f a u l t . e x c l [ r14 ] , 1 2 8
lfetch. f a u l t [ r16 ] , 1 2 8
;;
lfetch. f a u l t . e x c l [ r14 ] , 1 2 8
lfetch. f a u l t [ r16 ] , 1 2 8
;;
lfetch. f a u l t . e x c l [ r14 ] , 1 2 8
lfetch. f a u l t [ r16 ] , 1 2 8
;;
lfetch. f a u l t [ r16 ] , 1 2 8
br. r e t . s p t k . m a n y r p
2005-09-15 09:36:35 +04:00
END( p r e f e t c h _ s t a c k )
2005-09-10 00:02:02 +04:00
2005-04-17 02:20:36 +04:00
GLOBAL_ E N T R Y ( e x e c v e )
mov r15 =__NR_execve / / p u t s y s c a l l n u m b e r i n p l a c e
break _ _ B R E A K _ S Y S C A L L
br. r e t . s p t k . m a n y r p
END( e x e c v e )
GLOBAL_ E N T R Y ( c l o n e )
mov r15 =__NR_clone / / p u t s y s c a l l n u m b e r i n p l a c e
break _ _ B R E A K _ S Y S C A L L
br. r e t . s p t k . m a n y r p
END( c l o n e )
/ *
* Invoke a s y s t e m c a l l , b u t d o s o m e t r a c i n g b e f o r e a n d a f t e r t h e c a l l .
* We M U S T p r e s e r v e t h e c u r r e n t r e g i s t e r f r a m e t h r o u g h o u t t h i s r o u t i n e
* because s o m e s y s t e m c a l l s ( s u c h a s i a64 _ e x e c v e ) d i r e c t l y
* manipulate a r . p f s .
* /
GLOBAL_ E N T R Y ( i a64 _ t r a c e _ s y s c a l l )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
/ *
* We n e e d t o p r e s e r v e t h e s c r a t c h r e g i s t e r s f6 - f11 i n c a s e t h e s y s t e m
* call i s s i g r e t u r n .
* /
adds r16 =PT ( F 6 ) + 1 6 ,s p
adds r17 =PT ( F 7 ) + 1 6 ,s p
;;
stf. s p i l l [ r16 ] =f6 ,3 2
stf. s p i l l [ r17 ] =f7 ,3 2
;;
stf. s p i l l [ r16 ] =f8 ,3 2
stf. s p i l l [ r17 ] =f9 ,3 2
;;
stf. s p i l l [ r16 ] =f10
stf. s p i l l [ r17 ] =f11
br. c a l l . s p t k . m a n y r p =syscall_trace_enter / / g i v e p a r e n t a c h a n c e t o c a t c h s y s c a l l a r g s
adds r16 =PT ( F 6 ) + 1 6 ,s p
adds r17 =PT ( F 7 ) + 1 6 ,s p
;;
ldf. f i l l f6 = [ r16 ] ,3 2
ldf. f i l l f7 = [ r17 ] ,3 2
;;
ldf. f i l l f8 = [ r16 ] ,3 2
ldf. f i l l f9 = [ r17 ] ,3 2
;;
ldf. f i l l f10 = [ r16 ]
ldf. f i l l f11 = [ r17 ]
/ / the s y s c a l l n u m b e r m a y h a v e c h a n g e d , s o r e - l o a d i t a n d r e - c a l c u l a t e t h e
/ / syscall e n t r y - p o i n t :
adds r15 =PT ( R 1 5 ) + 1 6 ,s p / / r15 = & p t _ r e g s . r15 ( s y s c a l l #)
;;
ld8 r15 = [ r15 ]
mov r3 =NR_syscalls - 1
;;
adds r15 = - 1 0 2 4 ,r15
movl r16 =sys_call_table
;;
shladd r20 =r15 ,3 ,r16 / / r20 = s y s _ c a l l _ t a b l e + 8 * ( s y s c a l l - 1 0 2 4 )
cmp. l e u p6 ,p7 =r15 ,r3
;;
( p6 ) l d8 r20 = [ r20 ] / / l o a d a d d r e s s o f s y s c a l l e n t r y p o i n t
( p7 ) m o v l r20 =sys_ni_syscall
;;
mov b6 =r20
br. c a l l . s p t k . m a n y r p =b6 / / d o t h e s y s c a l l
.strace_check_retval :
cmp. l t p6 ,p0 =r8 ,r0 / / s y s c a l l f a i l e d ?
adds r2 =PT ( R 8 ) + 1 6 ,s p / / r2 = & p t _ r e g s . r8
adds r3 =PT ( R 1 0 ) + 1 6 ,s p / / r3 = & p t _ r e g s . r10
mov r10 =0
( p6 ) b r . c o n d . s p t k s t r a c e _ e r r o r / / s y s c a l l f a i l e d - >
;; // avoid RAW on r10
.strace_save_retval :
.mem .offset 0 , 0 ; st8.spill [r2]=r8 // store return value in slot for r8
.mem .offset 8 , 0 ; st8.spill [r3]=r10 // clear error indication in slot for r10
br. c a l l . s p t k . m a n y r p =syscall_trace_leave / / g i v e p a r e n t a c h a n c e t o c a t c h r e t u r n v a l u e
.ret3 : br. c o n d . s p t k . w o r k _ p e n d i n g _ s y s c a l l _ e n d
strace_error :
ld8 r3 = [ r2 ] / / l o a d p t _ r e g s . r8
sub r9 =0 ,r8 / / n e g a t e r e t u r n v a l u e t o g e t e r r n o v a l u e
;;
cmp. n e p6 ,p0 =r3 ,r0 / / i s p t _ r e g s . r8 ! =0 ?
adds r3 =16 ,r2 / / r3 = & p t _ r e g s . r10
;;
( p6 ) m o v r10 = - 1
( p6 ) m o v r8 =r9
br. c o n d . s p t k . s t r a c e _ s a v e _ r e t v a l
END( i a64 _ t r a c e _ s y s c a l l )
/ *
* When t r a c e d a n d r e t u r n i n g f r o m s i g r e t u r n , w e i n v o k e s y s c a l l _ t r a c e b u t t h e n
* go s t r a i g h t t o i a64 _ l e a v e _ k e r n e l r a t h e r t h a n i a64 _ l e a v e _ s y s c a l l .
* /
GLOBAL_ E N T R Y ( i a64 _ s t r a c e _ l e a v e _ k e r n e l )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
{ / *
* Some v e r s i o n s o f g a s g e n e r a t e b a d u n w i n d i n f o i f t h e f i r s t i n s t r u c t i o n o f a
* procedure d o e s n ' t g o i n t o t h e f i r s t s l o t o f a b u n d l e . T h i s i s a w o r k a r o u n d .
* /
nop. m 0
nop. i 0
br. c a l l . s p t k . m a n y r p =syscall_trace_leave / / g i v e p a r e n t a c h a n c e t o c a t c h r e t u r n v a l u e
}
.ret4 : br. c o n d . s p t k i a64 _ l e a v e _ k e r n e l
END( i a64 _ s t r a c e _ l e a v e _ k e r n e l )
GLOBAL_ E N T R Y ( i a64 _ r e t _ f r o m _ c l o n e )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
{ / *
* Some v e r s i o n s o f g a s g e n e r a t e b a d u n w i n d i n f o i f t h e f i r s t i n s t r u c t i o n o f a
* procedure d o e s n ' t g o i n t o t h e f i r s t s l o t o f a b u n d l e . T h i s i s a w o r k a r o u n d .
* /
nop. m 0
nop. i 0
/ *
* We n e e d t o c a l l s c h e d u l e _ t a i l ( ) t o c o m p l e t e t h e s c h e d u l i n g p r o c e s s .
* Called b y i a64 _ s w i t c h _ t o ( ) a f t e r d o _ f o r k ( ) - > c o p y _ t h r e a d ( ) . r8 c o n t a i n s t h e
* address o f t h e p r e v i o u s l y e x e c u t i n g t a s k .
* /
br. c a l l . s p t k . m a n y r p =ia64_invoke_schedule_tail
}
.ret8 :
adds r2 =TI_FLAGS + I A 6 4 _ T A S K _ S I Z E ,r13
;;
ld4 r2 = [ r2 ]
;;
mov r8 =0
and r2 =_TIF_SYSCALL_TRACEAUDIT ,r2
;;
cmp. n e p6 ,p0 =r2 ,r0
( p6 ) b r . c o n d . s p n t . s t r a c e _ c h e c k _ r e t v a l
;; // added stop bits to prevent r8 dependency
END( i a64 _ r e t _ f r o m _ c l o n e )
/ / fall t h r o u g h
GLOBAL_ E N T R Y ( i a64 _ r e t _ f r o m _ s y s c a l l )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
cmp. g e p6 ,p7 =r8 ,r0 / / s y s c a l l e x e c u t e d s u c c e s s f u l l y ?
adds r2 =PT ( R 8 ) + 1 6 ,s p / / r2 = & p t _ r e g s . r8
mov r10 =r0 / / c l e a r e r r o r i n d i c a t i o n i n r10
( p7 ) b r . c o n d . s p n t h a n d l e _ s y s c a l l _ e r r o r / / h a n d l e p o t e n t i a l s y s c a l l f a i l u r e
END( i a64 _ r e t _ f r o m _ s y s c a l l )
/ / fall t h r o u g h
/ *
* ia6 4 _ l e a v e _ s y s c a l l ( ) : S a m e a s i a64 _ l e a v e _ k e r n e l , e x c e p t t h a t i t d o e s n ' t
* need t o s w i t c h t o b a n k 0 a n d d o e s n ' t r e s t o r e t h e s c r a t c h r e g i s t e r s .
* To a v o i d l e a k i n g k e r n e l b i t s , t h e s c r a t c h r e g i s t e r s a r e s e t t o
* the f o l l o w i n g k n o w n - t o - b e - s a f e v a l u e s :
*
* r1 : restored ( g l o b a l p o i n t e r )
* r2 : cleared
* r3 : 1 ( when r e t u r n i n g t o u s e r - l e v e l )
* r8 - r11 : r e s t o r e d ( s y s c a l l r e t u r n v a l u e ( s ) )
* r12 : restored ( u s e r - l e v e l s t a c k p o i n t e r )
* r13 : restored ( u s e r - l e v e l t h r e a d p o i n t e r )
2005-04-28 08:18:22 +04:00
* r14 : set t o _ _ k e r n e l _ s y s c a l l _ v i a _ e p c
2005-04-17 02:20:36 +04:00
* r15 : restored ( s y s c a l l #)
* r1 6 - r17 : c l e a r e d
* r18 : user- l e v e l b6
* r19 : cleared
* r20 : user- l e v e l a r . f p s r
* r21 : user- l e v e l b0
* r22 : cleared
* r23 : user- l e v e l a r . b s p s t o r e
* r24 : user- l e v e l a r . r n a t
* r25 : user- l e v e l a r . u n a t
* r26 : user- l e v e l a r . p f s
* r27 : user- l e v e l a r . r s c
* r28 : user- l e v e l i p
* r29 : user- l e v e l p s r
* r30 : user- l e v e l c f m
* r31 : user- l e v e l p r
* f6 - f11 : c l e a r e d
* pr : restored ( u s e r - l e v e l p r )
* b0 : restored ( u s e r - l e v e l r p )
* b6 : restored
2005-04-28 08:18:22 +04:00
* b7 : set t o _ _ k e r n e l _ s y s c a l l _ v i a _ e p c
2005-04-17 02:20:36 +04:00
* ar. u n a t : r e s t o r e d ( u s e r - l e v e l a r . u n a t )
* ar. p f s : r e s t o r e d ( u s e r - l e v e l a r . p f s )
* ar. r s c : r e s t o r e d ( u s e r - l e v e l a r . r s c )
* ar. r n a t : r e s t o r e d ( u s e r - l e v e l a r . r n a t )
* ar. b s p s t o r e : r e s t o r e d ( u s e r - l e v e l a r . b s p s t o r e )
* ar. f p s r : r e s t o r e d ( u s e r - l e v e l a r . f p s r )
* ar. c c v : c l e a r e d
* ar. c s d : c l e a r e d
* ar. s s d : c l e a r e d
* /
ENTRY( i a64 _ l e a v e _ s y s c a l l )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
/ *
* work. n e e d _ r e s c h e d e t c . m u s t n ' t g e t c h a n g e d b y t h i s C P U b e f o r e i t r e t u r n s t o
* user- o r f s y s - m o d e , h e n c e w e d i s a b l e i n t e r r u p t s e a r l y o n .
*
* p6 c o n t r o l s w h e t h e r c u r r e n t _ t h r e a d _ i n f o ( ) - > f l a g s n e e d s t o b e c h e c k f o r
* extra w o r k . W e a l w a y s c h e c k f o r e x t r a w o r k w h e n r e t u r n i n g t o u s e r - l e v e l .
* With C O N F I G _ P R E E M P T , w e a l s o c h e c k f o r e x t r a w o r k w h e n t h e p r e e m p t _ c o u n t
* is 0 . A f t e r e x t r a w o r k p r o c e s s i n g h a s b e e n c o m p l e t e d , e x e c u t i o n
* resumes a t . w o r k _ p r o c e s s e d _ s y s c a l l w i t h p6 s e t t o 1 i f t h e e x t r a - w o r k - c h e c k
* needs t o b e r e d o n e .
* /
# ifdef C O N F I G _ P R E E M P T
rsm p s r . i / / d i s a b l e i n t e r r u p t s
cmp. e q p L v S y s ,p0 =r0 ,r0 / / p L v S y s =1 : l e a v e f r o m s y s c a l l
( pKStk) a d d s r20 =TI_PRE_COUNT + I A 6 4 _ T A S K _ S I Z E ,r13
;;
.pred .rel .mutex pUStk,p K S t k
( pKStk) l d4 r21 = [ r20 ] / / r21 < - p r e e m p t _ c o u n t
( pUStk) m o v r21 =0 / / r21 < - 0
;;
cmp. e q p6 ,p0 =r21 ,r0 / / p6 < - p U S t k | | ( p r e e m p t _ c o u n t = = 0 )
# else / * ! C O N F I G _ P R E E M P T * /
( pUStk) r s m p s r . i
cmp. e q p L v S y s ,p0 =r0 ,r0 / / p L v S y s =1 : l e a v e f r o m s y s c a l l
( pUStk) c m p . e q . u n c p6 ,p0 =r0 ,r0 / / p6 < - p U S t k
# endif
.work_processed_syscall :
adds r2 =PT ( L O A D R S ) + 1 6 ,r12
adds r3 =PT ( A R _ B S P S T O R E ) + 1 6 ,r12
adds r18 =TI_FLAGS + I A 6 4 _ T A S K _ S I Z E ,r13
;;
( p6 ) l d4 r31 = [ r18 ] / / l o a d c u r r e n t _ t h r e a d _ i n f o ( ) - > f l a g s
ld8 r19 = [ r2 ] ,P T ( B 6 ) - P T ( L O A D R S ) / / l o a d a r . r s c v a l u e f o r " l o a d r s "
2005-04-28 08:16:07 +04:00
nop. i 0
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:17:44 +04:00
mov r16 =ar . b s p / / M 2 g e t e x i s t i n g b a c k i n g s t o r e p o i n t e r
2005-04-17 02:20:36 +04:00
ld8 r18 = [ r2 ] ,P T ( R 9 ) - P T ( B 6 ) / / l o a d b6
( p6 ) a n d r15 =TIF_WORK_MASK ,r31 / / a n y w o r k o t h e r t h a n T I F _ S Y S C A L L _ T R A C E ?
;;
2005-04-28 08:17:44 +04:00
ld8 r23 = [ r3 ] ,P T ( R 1 1 ) - P T ( A R _ B S P S T O R E ) / / l o a d a r . b s p s t o r e ( m a y b e g a r b a g e )
2005-04-17 02:20:36 +04:00
( p6 ) c m p4 . n e . u n c p6 ,p0 =r15 , r0 / / a n y s p e c i a l w o r k p e n d i n g ?
( p6 ) b r . c o n d . s p n t . w o r k _ p e n d i n g _ s y s c a l l
;;
/ / start r e s t o r i n g t h e s t a t e s a v e d o n t h e k e r n e l s t a c k ( s t r u c t p t _ r e g s ) :
ld8 r9 = [ r2 ] ,P T ( C R _ I P S R ) - P T ( R 9 )
ld8 r11 = [ r3 ] ,P T ( C R _ I I P ) - P T ( R 1 1 )
2005-04-28 08:17:44 +04:00
( pNonSys) b r e a k 0 / / b u g c h e c k : w e s h o u l d n ' t b e h e r e i f p N o n S y s i s T R U E !
2005-04-17 02:20:36 +04:00
;;
invala / / M 0 | 1 i n v a l i d a t e A L A T
2005-04-28 08:18:22 +04:00
rsm p s r . i | p s r . i c / / M 2 t u r n o f f i n t e r r u p t s a n d i n t e r r u p t i o n c o l l e c t i o n
cmp. e q p9 ,p0 =r0 ,r0 / / A s e t p9 t o i n d i c a t e t h a t w e s h o u l d r e s t o r e c r . i f s
2005-04-17 02:20:36 +04:00
2005-04-28 08:18:22 +04:00
ld8 r29 = [ r2 ] ,1 6 / / M 0 | 1 l o a d c r . i p s r
ld8 r28 = [ r3 ] ,1 6 / / M 0 | 1 l o a d c r . i i p
mov r22 =r0 / / A c l e a r r22
2005-04-17 02:20:36 +04:00
;;
ld8 r30 = [ r2 ] ,1 6 / / M 0 | 1 l o a d c r . i f s
ld8 r25 = [ r3 ] ,1 6 / / M 0 | 1 l o a d a r . u n a t
2005-04-28 08:17:44 +04:00
( pUStk) a d d r14 =IA64_TASK_THREAD_ON_USTACK_OFFSET ,r13
2005-04-17 02:20:36 +04:00
;;
ld8 r26 = [ r2 ] ,P T ( B 0 ) - P T ( A R _ P F S ) / / M 0 | 1 l o a d a r . p f s
2005-04-28 08:18:22 +04:00
( pKStk) m o v r22 =psr / / M 2 r e a d P S R n o w t h a t i n t e r r u p t s a r e d i s a b l e d
2005-04-28 08:17:44 +04:00
nop 0
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
ld8 r21 = [ r2 ] ,P T ( A R _ R N A T ) - P T ( B 0 ) / / M 0 | 1 l o a d b0
ld8 r27 = [ r3 ] ,P T ( P R ) - P T ( A R _ R S C ) / / M 0 | 1 l o a d a r . r s c
mov f6 =f0 / / F c l e a r f6
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
ld8 r24 = [ r2 ] ,P T ( A R _ F P S R ) - P T ( A R _ R N A T ) / / M 0 | 1 l o a d a r . r n a t ( m a y b e g a r b a g e )
ld8 r31 = [ r3 ] ,P T ( R 1 ) - P T ( P R ) / / M 0 | 1 l o a d p r e d i c a t e s
mov f7 =f0 / / F c l e a r f7
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
ld8 r20 = [ r2 ] ,P T ( R 1 2 ) - P T ( A R _ F P S R ) / / M 0 | 1 l o a d a r . f p s r
ld8 . f i l l r1 = [ r3 ] ,1 6 / / M 0 | 1 l o a d r1
( pUStk) m o v r17 =1 / / A
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
( pUStk) s t 1 [ r14 ] =r17 / / M 2 | 3
ld8 . f i l l r13 = [ r3 ] ,1 6 / / M 0 | 1
mov f8 =f0 / / F c l e a r f8
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
ld8 . f i l l r12 = [ r2 ] / / M 0 | 1 r e s t o r e r12 ( s p )
ld8 . f i l l r15 = [ r3 ] / / M 0 | 1 r e s t o r e r15
mov b6 =r18 / / I 0 r e s t o r e b6
2005-04-26 00:03:16 +04:00
2005-04-28 08:18:22 +04:00
addl r17 =THIS_CPU ( i a64 _ p h y s _ s t a c k e d _ s i z e _ p8 ) ,r0 / / A
mov f9 =f0 / / F c l e a r f9
( pKStk) b r . c o n d . d p n t . m a n y s k i p _ r b s _ s w i t c h / / B
2005-04-28 08:17:44 +04:00
2005-04-28 08:18:22 +04:00
srlz. d / / M 0 e n s u r e i n t e r r u p t i o n c o l l e c t i o n i s o f f ( f o r c o v e r )
shr. u r18 =r19 ,1 6 / / I 0 | 1 g e t b y t e s i z e o f e x i s t i n g " d i r t y " p a r t i t i o n
cover / / B a d d c u r r e n t f r a m e i n t o d i r t y p a r t i t i o n & s e t c r . i f s
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
( pUStk) l d4 r17 = [ r17 ] / / M 0 | 1 r17 = c p u _ d a t a - > p h y s _ s t a c k e d _ s i z e _ p8
mov r19 =ar . b s p / / M 2 g e t n e w b a c k i n g s t o r e p o i n t e r
mov f10 =f0 / / F c l e a r f10
2005-04-28 08:16:07 +04:00
nop. m 0
2005-04-28 08:18:22 +04:00
movl r14 =__kernel_syscall_via_epc / / X
2005-04-17 02:20:36 +04:00
;;
2005-04-28 08:18:22 +04:00
mov. m a r . c s d =r0 / / M 2 c l e a r a r . c s d
mov. m a r . c c v =r0 / / M 2 c l e a r a r . c c v
mov b7 =r14 / / I 0 c l e a r b7 ( h i n t w i t h _ _ k e r n e l _ s y s c a l l _ v i a _ e p c )
2005-04-17 02:20:36 +04:00
2005-04-28 08:18:22 +04:00
mov. m a r . s s d =r0 / / M 2 c l e a r a r . s s d
mov f11 =f0 / / F c l e a r f11
br. c o n d . s p t k . m a n y r b s _ s w i t c h / / B
2005-04-17 02:20:36 +04:00
END( i a64 _ l e a v e _ s y s c a l l )
# ifdef C O N F I G _ I A 3 2 _ S U P P O R T
GLOBAL_ E N T R Y ( i a64 _ r e t _ f r o m _ i a32 _ e x e c v e )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
adds r2 =PT ( R 8 ) + 1 6 ,s p / / r2 = & p t _ r e g s . r8
adds r3 =PT ( R 1 0 ) + 1 6 ,s p / / r3 = & p t _ r e g s . r10
;;
.mem .offset 0 , 0
st8 . s p i l l [ r2 ] =r8 / / s t o r e r e t u r n v a l u e i n s l o t f o r r8 a n d s e t u n a t b i t
.mem .offset 8 , 0
st8 . s p i l l [ r3 ] =r0 / / c l e a r e r r o r i n d i c a t i o n i n s l o t f o r r10 a n d s e t u n a t b i t
2005-03-25 10:16:00 +03:00
END( i a64 _ r e t _ f r o m _ i a32 _ e x e c v e )
2005-04-17 02:20:36 +04:00
/ / fall t h r o u g h
# endif / * C O N F I G _ I A 3 2 _ S U P P O R T * /
GLOBAL_ E N T R Y ( i a64 _ l e a v e _ k e r n e l )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
/ *
* work. n e e d _ r e s c h e d e t c . m u s t n ' t g e t c h a n g e d b y t h i s C P U b e f o r e i t r e t u r n s t o
* user- o r f s y s - m o d e , h e n c e w e d i s a b l e i n t e r r u p t s e a r l y o n .
*
* p6 c o n t r o l s w h e t h e r c u r r e n t _ t h r e a d _ i n f o ( ) - > f l a g s n e e d s t o b e c h e c k f o r
* extra w o r k . W e a l w a y s c h e c k f o r e x t r a w o r k w h e n r e t u r n i n g t o u s e r - l e v e l .
* With C O N F I G _ P R E E M P T , w e a l s o c h e c k f o r e x t r a w o r k w h e n t h e p r e e m p t _ c o u n t
* is 0 . A f t e r e x t r a w o r k p r o c e s s i n g h a s b e e n c o m p l e t e d , e x e c u t i o n
* resumes a t . w o r k _ p r o c e s s e d _ s y s c a l l w i t h p6 s e t t o 1 i f t h e e x t r a - w o r k - c h e c k
* needs t o b e r e d o n e .
* /
# ifdef C O N F I G _ P R E E M P T
rsm p s r . i / / d i s a b l e i n t e r r u p t s
cmp. e q p0 ,p L v S y s =r0 ,r0 / / p L v S y s =0 : l e a v e f r o m k e r n e l
( pKStk) a d d s r20 =TI_PRE_COUNT + I A 6 4 _ T A S K _ S I Z E ,r13
;;
.pred .rel .mutex pUStk,p K S t k
( pKStk) l d4 r21 = [ r20 ] / / r21 < - p r e e m p t _ c o u n t
( pUStk) m o v r21 =0 / / r21 < - 0
;;
cmp. e q p6 ,p0 =r21 ,r0 / / p6 < - p U S t k | | ( p r e e m p t _ c o u n t = = 0 )
# else
( pUStk) r s m p s r . i
cmp. e q p0 ,p L v S y s =r0 ,r0 / / p L v S y s =0 : l e a v e f r o m k e r n e l
( pUStk) c m p . e q . u n c p6 ,p0 =r0 ,r0 / / p6 < - p U S t k
# endif
.work_processed_kernel :
adds r17 =TI_FLAGS + I A 6 4 _ T A S K _ S I Z E ,r13
;;
( p6 ) l d4 r31 = [ r17 ] / / l o a d c u r r e n t _ t h r e a d _ i n f o ( ) - > f l a g s
adds r21 =PT ( P R ) + 1 6 ,r12
;;
lfetch [ r21 ] ,P T ( C R _ I P S R ) - P T ( P R )
adds r2 =PT ( B 6 ) + 1 6 ,r12
adds r3 =PT ( R 1 6 ) + 1 6 ,r12
;;
lfetch [ r21 ]
ld8 r28 = [ r2 ] ,8 / / l o a d b6
adds r29 =PT ( R 2 4 ) + 1 6 ,r12
ld8 . f i l l r16 = [ r3 ] ,P T ( A R _ C S D ) - P T ( R 1 6 )
adds r30 =PT ( A R _ C C V ) + 1 6 ,r12
( p6 ) a n d r19 =TIF_WORK_MASK ,r31 / / a n y w o r k o t h e r t h a n T I F _ S Y S C A L L _ T R A C E ?
;;
ld8 . f i l l r24 = [ r29 ]
ld8 r15 = [ r30 ] / / l o a d a r . c c v
( p6 ) c m p4 . n e . u n c p6 ,p0 =r19 , r0 / / a n y s p e c i a l w o r k p e n d i n g ?
;;
ld8 r29 = [ r2 ] ,1 6 / / l o a d b7
ld8 r30 = [ r3 ] ,1 6 / / l o a d a r . c s d
( p6 ) b r . c o n d . s p n t . w o r k _ p e n d i n g
;;
ld8 r31 = [ r2 ] ,1 6 / / l o a d a r . s s d
ld8 . f i l l r8 = [ r3 ] ,1 6
;;
ld8 . f i l l r9 = [ r2 ] ,1 6
ld8 . f i l l r10 = [ r3 ] ,P T ( R 1 7 ) - P T ( R 1 0 )
;;
ld8 . f i l l r11 = [ r2 ] ,P T ( R 1 8 ) - P T ( R 1 1 )
ld8 . f i l l r17 = [ r3 ] ,1 6
;;
ld8 . f i l l r18 = [ r2 ] ,1 6
ld8 . f i l l r19 = [ r3 ] ,1 6
;;
ld8 . f i l l r20 = [ r2 ] ,1 6
ld8 . f i l l r21 = [ r3 ] ,1 6
mov a r . c s d =r30
mov a r . s s d =r31
;;
rsm p s r . i | p s r . i c / / i n i t i a t e t u r n i n g o f f o f i n t e r r u p t a n d i n t e r r u p t i o n c o l l e c t i o n
invala / / i n v a l i d a t e A L A T
;;
ld8 . f i l l r22 = [ r2 ] ,2 4
ld8 . f i l l r23 = [ r3 ] ,2 4
mov b6 =r28
;;
ld8 . f i l l r25 = [ r2 ] ,1 6
ld8 . f i l l r26 = [ r3 ] ,1 6
mov b7 =r29
;;
ld8 . f i l l r27 = [ r2 ] ,1 6
ld8 . f i l l r28 = [ r3 ] ,1 6
;;
ld8 . f i l l r29 = [ r2 ] ,1 6
ld8 . f i l l r30 = [ r3 ] ,2 4
;;
ld8 . f i l l r31 = [ r2 ] ,P T ( F 9 ) - P T ( R 3 1 )
adds r3 =PT ( F 1 0 ) - P T ( F 6 ) ,r3
;;
ldf. f i l l f9 = [ r2 ] ,P T ( F 6 ) - P T ( F 9 )
ldf. f i l l f10 = [ r3 ] ,P T ( F 8 ) - P T ( F 1 0 )
;;
ldf. f i l l f6 = [ r2 ] ,P T ( F 7 ) - P T ( F 6 )
;;
ldf. f i l l f7 = [ r2 ] ,P T ( F 1 1 ) - P T ( F 7 )
ldf. f i l l f8 = [ r3 ] ,3 2
;;
2005-04-28 08:22:08 +04:00
srlz. d / / e n s u r e t h a t i n t e r . c o l l e c t i o n i s o f f ( V H P T i s d o n ' t c a r e , s i n c e t e x t i s p i n n e d )
2005-04-17 02:20:36 +04:00
mov a r . c c v =r15
;;
ldf. f i l l f11 = [ r2 ]
bsw. 0 / / s w i t c h b a c k t o b a n k 0 ( n o s t o p b i t r e q u i r e d b e f o r e h a n d . . . )
;;
( pUStk) m o v r18 =IA64_KR ( C U R R E N T ) / / M 2 ( 1 2 c y c l e r e a d l a t e n c y )
adds r16 =PT ( C R _ I P S R ) + 1 6 ,r12
adds r17 =PT ( C R _ I I P ) + 1 6 ,r12
( pKStk) m o v r22 =psr / / M 2 r e a d P S R n o w t h a t i n t e r r u p t s a r e d i s a b l e d
nop. i 0
nop. i 0
;;
ld8 r29 = [ r16 ] ,1 6 / / l o a d c r . i p s r
ld8 r28 = [ r17 ] ,1 6 / / l o a d c r . i i p
;;
ld8 r30 = [ r16 ] ,1 6 / / l o a d c r . i f s
ld8 r25 = [ r17 ] ,1 6 / / l o a d a r . u n a t
;;
ld8 r26 = [ r16 ] ,1 6 / / l o a d a r . p f s
ld8 r27 = [ r17 ] ,1 6 / / l o a d a r . r s c
cmp. e q p9 ,p0 =r0 ,r0 / / s e t p9 t o i n d i c a t e t h a t w e s h o u l d r e s t o r e c r . i f s
;;
ld8 r24 = [ r16 ] ,1 6 / / l o a d a r . r n a t ( m a y b e g a r b a g e )
ld8 r23 = [ r17 ] ,1 6 / / l o a d a r . b s p s t o r e ( m a y b e g a r b a g e )
;;
ld8 r31 = [ r16 ] ,1 6 / / l o a d p r e d i c a t e s
ld8 r21 = [ r17 ] ,1 6 / / l o a d b0
;;
ld8 r19 = [ r16 ] ,1 6 / / l o a d a r . r s c v a l u e f o r " l o a d r s "
ld8 . f i l l r1 = [ r17 ] ,1 6 / / l o a d r1
;;
ld8 . f i l l r12 = [ r16 ] ,1 6
ld8 . f i l l r13 = [ r17 ] ,1 6
( pUStk) a d d s r18 =IA64_TASK_THREAD_ON_USTACK_OFFSET ,r18
;;
ld8 r20 = [ r16 ] ,1 6 / / a r . f p s r
ld8 . f i l l r15 = [ r17 ] ,1 6
;;
ld8 . f i l l r14 = [ r16 ] ,1 6
ld8 . f i l l r2 = [ r17 ]
( pUStk) m o v r17 =1
;;
ld8 . f i l l r3 = [ r16 ]
( pUStk) s t 1 [ r18 ] =r17 / / r e s t o r e c u r r e n t - > t h r e a d . o n _ u s t a c k
shr. u r18 =r19 ,1 6 / / g e t b y t e s i z e o f e x i s t i n g " d i r t y " p a r t i t i o n
;;
mov r16 =ar . b s p / / g e t e x i s t i n g b a c k i n g s t o r e p o i n t e r
addl r17 =THIS_CPU ( i a64 _ p h y s _ s t a c k e d _ s i z e _ p8 ) ,r0
;;
ld4 r17 = [ r17 ] / / r17 = c p u _ d a t a - > p h y s _ s t a c k e d _ s i z e _ p8
( pKStk) b r . c o n d . d p n t s k i p _ r b s _ s w i t c h
/ *
* Restore u s e r b a c k i n g s t o r e .
*
* NOTE : alloc, l o a d r s , a n d c o v e r c a n ' t b e p r e d i c a t e d .
* /
( pNonSys) b r . c o n d . d p n t d o n t _ p r e s e r v e _ c u r r e n t _ f r a m e
cover / / a d d c u r r e n t f r a m e i n t o d i r t y p a r t i t i o n a n d s e t c r . i f s
;;
mov r19 =ar . b s p / / g e t n e w b a c k i n g s t o r e p o i n t e r
2005-04-28 08:17:44 +04:00
rbs_switch :
2005-04-17 02:20:36 +04:00
sub r16 =r16 ,r18 / / k r b s = o l d b s p - s i z e o f d i r t y p a r t i t i o n
cmp. n e p9 ,p0 =r0 ,r0 / / c l e a r p9 t o s k i p r e s t o r e o f c r . i f s
;;
sub r19 =r19 ,r16 / / c a l c u l a t e t o t a l b y t e s i z e o f d i r t y p a r t i t i o n
add r18 =64 ,r18 / / d o n ' t f o r c e i n 0 - i n 7 i n t o m e m o r y . . .
;;
shl r19 =r19 ,1 6 / / s h i f t s i z e o f d i r t y p a r t i t i o n i n t o l o a d r s p o s i t i o n
;;
dont_preserve_current_frame :
/ *
* To p r e v e n t l e a k i n g b i t s b e t w e e n t h e k e r n e l a n d u s e r - s p a c e ,
* we m u s t c l e a r t h e s t a c k e d r e g i s t e r s i n t h e " i n v a l i d " p a r t i t i o n h e r e .
* Not p r e t t y , b u t a t l e a s t i t ' s f a s t ( 3 . 3 4 r e g i s t e r s / c y c l e o n I t a n i u m ,
* 5 registers/ c y c l e o n M c K i n l e y ) .
* /
# define p R e c u r s e p6
# define p R e t u r n p7
# ifdef C O N F I G _ I T A N I U M
# define N r e g s 1 0
# else
# define N r e g s 1 4
# endif
alloc l o c0 =ar . p f s ,2 ,N r e g s - 2 ,2 ,0
shr. u l o c1 =r18 ,9 / / R N a T s l o t s < = f l o o r ( d i r t y S i z e / ( 6 4 * 8 ) )
sub r17 =r17 ,r18 / / r17 = ( p h y s S t a c k e d S i z e + 8 ) - d i r t y S i z e
;;
mov a r . r s c =r19 / / l o a d a r . r s c t o b e u s e d f o r " l o a d r s "
shladd i n 0 =loc1 ,3 ,r17
mov i n 1 =0
;;
TEXT_ A L I G N ( 3 2 )
rse_clear_invalid :
# ifdef C O N F I G _ I T A N I U M
/ / cycle 0
{ .mii
alloc l o c0 =ar . p f s ,2 ,N r e g s - 2 ,2 ,0
cmp. l t p R e c u r s e ,p0 =Nregs * 8 ,i n 0 / / i f m o r e t h a n N r e g s r e g s l e f t t o c l e a r , ( r e ) c u r s e
add o u t 0 = - N r e g s * 8 ,i n 0
} { .mfb
add o u t 1 =1 ,i n 1 / / i n c r e m e n t r e c u r s i o n c o u n t
nop. f 0
nop. b 0 / / c a n ' t d o b r . c a l l h e r e b e c a u s e o f a l l o c ( W A W o n C F M )
;;
} { .mfi / / cycle 1
mov l o c1 =0
nop. f 0
mov l o c2 =0
} { .mib
mov l o c3 =0
mov l o c4 =0
( pRecurse) b r . c a l l . s p t k . m a n y b0 =rse_clear_invalid
} { .mfi / / cycle 2
mov l o c5 =0
nop. f 0
cmp. n e p R e t u r n ,p0 =r0 ,i n 1 / / i f r e c u r s i o n c o u n t ! = 0 , w e n e e d t o d o a b r . r e t
} { .mib
mov l o c6 =0
mov l o c7 =0
( pReturn) b r . r e t . s p t k . m a n y b0
}
# else / * ! C O N F I G _ I T A N I U M * /
alloc l o c0 =ar . p f s ,2 ,N r e g s - 2 ,2 ,0
cmp. l t p R e c u r s e ,p0 =Nregs * 8 ,i n 0 / / i f m o r e t h a n N r e g s r e g s l e f t t o c l e a r , ( r e ) c u r s e
add o u t 0 = - N r e g s * 8 ,i n 0
add o u t 1 =1 ,i n 1 / / i n c r e m e n t r e c u r s i o n c o u n t
mov l o c1 =0
mov l o c2 =0
;;
mov l o c3 =0
mov l o c4 =0
mov l o c5 =0
mov l o c6 =0
mov l o c7 =0
2005-04-28 08:13:33 +04:00
( pRecurse) b r . c a l l . d p t k . f e w b0 =rse_clear_invalid
2005-04-17 02:20:36 +04:00
;;
mov l o c8 =0
mov l o c9 =0
cmp. n e p R e t u r n ,p0 =r0 ,i n 1 / / i f r e c u r s i o n c o u n t ! = 0 , w e n e e d t o d o a b r . r e t
mov l o c10 =0
mov l o c11 =0
2005-04-28 08:13:33 +04:00
( pReturn) b r . r e t . d p t k . m a n y b0
2005-04-17 02:20:36 +04:00
# endif / * ! C O N F I G _ I T A N I U M * /
# undef p R e c u r s e
# undef p R e t u r n
;;
alloc r17 =ar . p f s ,0 ,0 ,0 ,0 / / d r o p c u r r e n t r e g i s t e r f r a m e
;;
loadrs
;;
skip_rbs_switch :
mov a r . u n a t =r25 / / M 2
( pKStk) e x t r . u r22 =r22 ,2 1 ,1 / / I 0 e x t r a c t c u r r e n t v a l u e o f p s r . p p f r o m r22
( pLvSys) m o v r19 =r0 / / A c l e a r r19 f o r l e a v e _ s y s c a l l , n o - o p o t h e r w i s e
;;
( pUStk) m o v a r . b s p s t o r e =r23 / / M 2
( pKStk) d e p r29 =r22 ,r29 ,2 1 ,1 / / I 0 u p d a t e i p s r . p p w i t h p s r . p p
( pLvSys) m o v r16 =r0 / / A c l e a r r16 f o r l e a v e _ s y s c a l l , n o - o p o t h e r w i s e
;;
mov c r . i p s r =r29 / / M 2
mov a r . p f s =r26 / / I 0
( pLvSys) m o v r17 =r0 / / A c l e a r r17 f o r l e a v e _ s y s c a l l , n o - o p o t h e r w i s e
( p9 ) m o v c r . i f s =r30 / / M 2
mov b0 =r21 / / I 0
( pLvSys) m o v r18 =r0 / / A c l e a r r18 f o r l e a v e _ s y s c a l l , n o - o p o t h e r w i s e
mov a r . f p s r =r20 / / M 2
mov c r . i i p =r28 / / M 2
nop 0
;;
( pUStk) m o v a r . r n a t =r24 / / M 2 m u s t h a p p e n w i t h R S E i n l a z y m o d e
nop 0
( pLvSys) m o v r2 =r0
mov a r . r s c =r27 / / M 2
mov p r =r31 ,- 1 / / I 0
rfi / / B
/ *
* On e n t r y :
* r2 0 = & c u r r e n t - > t h r e a d _ i n f o - > p r e _ c o u n t ( i f C O N F I G _ P R E E M P T )
* r3 1 = c u r r e n t - > t h r e a d _ i n f o - > f l a g s
* On e x i t :
* p6 = T R U E i f w o r k - p e n d i n g - c h e c k n e e d s t o b e r e d o n e
* /
.work_pending_syscall :
add r2 = - 8 ,r2
add r3 = - 8 ,r3
;;
st8 [ r2 ] =r8
st8 [ r3 ] =r10
.work_pending :
tbit. n z p6 ,p0 =r31 ,T I F _ S I G D E L A Y E D / / s i g n a l d e l a y e d f r o m M C A / I N I T / N M I / P M I c o n t e x t ?
( p6 ) b r . c o n d . s p t k . f e w . s i g d e l a y e d
;;
tbit. z p6 ,p0 =r31 ,T I F _ N E E D _ R E S C H E D / / c u r r e n t _ t h r e a d _ i n f o ( ) - > n e e d _ r e s c h e d = =0 ?
( p6 ) b r . c o n d . s p t k . f e w . n o t i f y
# ifdef C O N F I G _ P R E E M P T
( pKStk) d e p r21 = - 1 ,r0 ,P R E E M P T _ A C T I V E _ B I T ,1
;;
( pKStk) s t 4 [ r20 ] =r21
ssm p s r . i / / e n a b l e i n t e r r u p t s
# endif
br. c a l l . s p n t . m a n y r p =schedule
.ret9 : cmp. e q p6 ,p0 =r0 ,r0 / / p6 < - 1
rsm p s r . i / / d i s a b l e i n t e r r u p t s
;;
# ifdef C O N F I G _ P R E E M P T
( pKStk) a d d s r20 =TI_PRE_COUNT + I A 6 4 _ T A S K _ S I Z E ,r13
;;
( pKStk) s t 4 [ r20 ] =r0 / / p r e e m p t _ c o u n t ( ) < - 0
# endif
( pLvSys) b r . c o n d . s p t k . f e w . w o r k _ p e n d i n g _ s y s c a l l _ e n d
br. c o n d . s p t k . m a n y . w o r k _ p r o c e s s e d _ k e r n e l / / r e - c h e c k
.notify :
( pUStk) b r . c a l l . s p n t . m a n y r p =notify_resume_user
.ret10 : cmp. n e p6 ,p0 =r0 ,r0 / / p6 < - 0
( pLvSys) b r . c o n d . s p t k . f e w . w o r k _ p e n d i n g _ s y s c a l l _ e n d
br. c o n d . s p t k . m a n y . w o r k _ p r o c e s s e d _ k e r n e l / / d o n ' t r e - c h e c k
/ / There i s a d e l a y e d s i g n a l t h a t w a s d e t e c t e d i n M C A / I N I T / N M I / P M I c o n t e x t w h e r e
/ / it c o u l d n o t b e d e l i v e r e d . D e l i v e r i t n o w . T h e s i g n a l m i g h t b e f o r u s a n d
/ / may s e t T I F _ S I G P E N D I N G , s o r e d r i v e i a64 _ l e a v e _ * a f t e r p r o c e s s i n g t h e d e l a y e d
/ / signal.
.sigdelayed :
br. c a l l . s p t k . m a n y r p =do_sigdelayed
cmp. e q p6 ,p0 =r0 ,r0 / / p6 < - 1 , a l w a y s r e - c h e c k
( pLvSys) b r . c o n d . s p t k . f e w . w o r k _ p e n d i n g _ s y s c a l l _ e n d
br. c o n d . s p t k . m a n y . w o r k _ p r o c e s s e d _ k e r n e l / / r e - c h e c k
.work_pending_syscall_end :
adds r2 =PT ( R 8 ) + 1 6 ,r12
adds r3 =PT ( R 1 0 ) + 1 6 ,r12
;;
ld8 r8 = [ r2 ]
ld8 r10 = [ r3 ]
br. c o n d . s p t k . m a n y . w o r k _ p r o c e s s e d _ s y s c a l l / / r e - c h e c k
END( i a64 _ l e a v e _ k e r n e l )
ENTRY( h a n d l e _ s y s c a l l _ e r r o r )
/ *
* Some s y s t e m c a l l s ( e . g . , p t r a c e , m m a p ) c a n r e t u r n a r b i t r a r y v a l u e s w h i c h c o u l d
* lead u s t o m i s t a k e a n e g a t i v e r e t u r n v a l u e a s a f a i l e d s y s c a l l . T h o s e s y s c a l l
* must d e p o s i t a n o n - z e r o v a l u e i n p t _ r e g s . r8 t o i n d i c a t e a n e r r o r . I f
* pt_ r e g s . r8 i s z e r o , w e a s s u m e t h a t t h e c a l l c o m p l e t e d s u c c e s s f u l l y .
* /
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
ld8 r3 = [ r2 ] / / l o a d p t _ r e g s . r8
;;
cmp. e q p6 ,p7 =r3 ,r0 / / i s p t _ r e g s . r8 = =0 ?
;;
( p7 ) m o v r10 = - 1
( p7 ) s u b r8 =0 ,r8 / / n e g a t e r e t u r n v a l u e t o g e t e r r n o
br. c o n d . s p t k i a64 _ l e a v e _ s y s c a l l
END( h a n d l e _ s y s c a l l _ e r r o r )
/ *
* Invoke s c h e d u l e _ t a i l ( t a s k ) w h i l e p r e s e r v i n g i n 0 - i n 7 , w h i c h m a y b e n e e d e d
* in c a s e a s y s t e m c a l l g e t s r e s t a r t e d .
* /
GLOBAL_ E N T R Y ( i a64 _ i n v o k e _ s c h e d u l e _ t a i l )
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc l o c1 =ar . p f s ,8 ,2 ,1 ,0
mov l o c0 =rp
mov o u t 0 =r8 / / A d d r e s s o f p r e v i o u s t a s k
;;
br. c a l l . s p t k . m a n y r p =schedule_tail
.ret11 : mov a r . p f s =loc1
mov r p =loc0
br. r e t . s p t k . m a n y r p
END( i a64 _ i n v o k e _ s c h e d u l e _ t a i l )
/ *
* Setup s t a c k a n d c a l l d o _ n o t i f y _ r e s u m e _ u s e r ( ) . N o t e t h a t p S y s a n d p N o n S y s n e e d t o
* be s e t u p b y t h e c a l l e r . W e d e c l a r e 8 i n p u t r e g i s t e r s s o t h e s y s t e m c a l l
* args g e t p r e s e r v e d , i n c a s e w e n e e d t o r e s t a r t a s y s t e m c a l l .
* /
ENTRY( n o t i f y _ r e s u m e _ u s e r )
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc l o c1 =ar . p f s ,8 ,2 ,3 ,0 / / p r e s e r v e a l l e i g h t i n p u t r e g s i n c a s e o f s y s c a l l r e s t a r t !
mov r9 =ar . u n a t
mov l o c0 =rp / / s a v e r e t u r n a d d r e s s
mov o u t 0 =0 / / t h e r e i s n o " o l d s e t "
adds o u t 1 =8 ,s p / / o u t 1 = & s i g s c r a t c h - > a r _ p f s
( pSys) m o v o u t 2 =1 / / o u t 2 = =1 = > w e ' r e i n a s y s c a l l
;;
( pNonSys) m o v o u t 2 =0 / / o u t 2 = =0 = > n o t a s y s c a l l
.fframe 16
2005-05-04 17:42:00 +04:00
.spillsp ar. u n a t , 1 6
2005-04-17 02:20:36 +04:00
st8 [ s p ] =r9 ,- 1 6 / / a l l o c a t e s p a c e f o r a r . u n a t a n d s a v e i t
st8 [ o u t 1 ] =loc1 ,- 8 / / s a v e a r . p f s , o u t 1 = & s i g s c r a t c h
.body
br. c a l l . s p t k . m a n y r p =do_notify_resume_user
.ret15 : .restore sp
adds s p =16 ,s p / / p o p s c r a t c h s t a c k s p a c e
;;
ld8 r9 = [ s p ] / / l o a d n e w u n a t f r o m s i g s c r a t c h - > s c r a t c h _ u n a t
mov r p =loc0
;;
mov a r . u n a t =r9
mov a r . p f s =loc1
br. r e t . s p t k . m a n y r p
END( n o t i f y _ r e s u m e _ u s e r )
GLOBAL_ E N T R Y ( s y s _ r t _ s i g s u s p e n d )
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc l o c1 =ar . p f s ,8 ,2 ,3 ,0 / / p r e s e r v e a l l e i g h t i n p u t r e g s i n c a s e o f s y s c a l l r e s t a r t !
mov r9 =ar . u n a t
mov l o c0 =rp / / s a v e r e t u r n a d d r e s s
mov o u t 0 =in0 / / m a s k
mov o u t 1 =in1 / / s i g s e t s i z e
adds o u t 2 =8 ,s p / / o u t 2 = & s i g s c r a t c h - > a r _ p f s
;;
.fframe 16
2005-05-04 17:42:00 +04:00
.spillsp ar. u n a t , 1 6
2005-04-17 02:20:36 +04:00
st8 [ s p ] =r9 ,- 1 6 / / a l l o c a t e s p a c e f o r a r . u n a t a n d s a v e i t
st8 [ o u t 2 ] =loc1 ,- 8 / / s a v e a r . p f s , o u t 2 = & s i g s c r a t c h
.body
br. c a l l . s p t k . m a n y r p =ia64_rt_sigsuspend
.ret17 : .restore sp
adds s p =16 ,s p / / p o p s c r a t c h s t a c k s p a c e
;;
ld8 r9 = [ s p ] / / l o a d n e w u n a t f r o m s w - > c a l l e r _ u n a t
mov r p =loc0
;;
mov a r . u n a t =r9
mov a r . p f s =loc1
br. r e t . s p t k . m a n y r p
END( s y s _ r t _ s i g s u s p e n d )
ENTRY( s y s _ r t _ s i g r e t u r n )
PT_ R E G S _ U N W I N D _ I N F O ( 0 )
/ *
* Allocate 8 i n p u t r e g i s t e r s s i n c e p t r a c e ( ) m a y c l o b b e r t h e m
* /
alloc r2 =ar . p f s ,8 ,0 ,1 ,0
.prologue
PT_ R E G S _ S A V E S ( 1 6 )
adds s p = - 1 6 ,s p
.body
cmp. e q p N o n S y s ,p S y s =r0 ,r0 / / s i g r e t u r n i s n ' t a n o r m a l s y s c a l l . . .
;;
/ *
* leave_ k e r n e l ( ) r e s t o r e s f6 - f11 f r o m p t _ r e g s , b u t s i n c e t h e s t r e a m l i n e d
* syscall- e n t r y p a t h d o e s n o t s a v e t h e m w e s a v e t h e m h e r e i n s t e a d . N o t e : w e
* don' t n e e d t o s a v e a n y o t h e r r e g i s t e r s t h a t a r e n o t s a v e d b y t h e s t r e a m - l i n e d
* syscall p a t h , b e c a u s e r e s t o r e _ s i g c o n t e x t ( ) r e s t o r e s t h e m .
* /
adds r16 =PT ( F 6 ) + 3 2 ,s p
adds r17 =PT ( F 7 ) + 3 2 ,s p
;;
stf. s p i l l [ r16 ] =f6 ,3 2
stf. s p i l l [ r17 ] =f7 ,3 2
;;
stf. s p i l l [ r16 ] =f8 ,3 2
stf. s p i l l [ r17 ] =f9 ,3 2
;;
stf. s p i l l [ r16 ] =f10
stf. s p i l l [ r17 ] =f11
adds o u t 0 =16 ,s p / / o u t 0 = & s i g s c r a t c h
br. c a l l . s p t k . m a n y r p =ia64_rt_sigreturn
2005-07-08 23:25:00 +04:00
.ret19 : .restore sp,0
2005-04-17 02:20:36 +04:00
adds s p =16 ,s p
;;
ld8 r9 = [ s p ] / / l o a d n e w a r . u n a t
mov. s p t k b7 =r8 ,i a64 _ l e a v e _ k e r n e l
;;
mov a r . u n a t =r9
br. m a n y b7
END( s y s _ r t _ s i g r e t u r n )
GLOBAL_ E N T R Y ( i a64 _ p r e p a r e _ h a n d l e _ u n a l i g n e d )
.prologue
/ *
* r1 6 = f a k e a r . p f s , w e s i m p l y n e e d t o m a k e s u r e p r i v i l e g e i s s t i l l 0
* /
mov r16 =r0
DO_ S A V E _ S W I T C H _ S T A C K
br. c a l l . s p t k . m a n y r p =ia64_handle_unaligned / / s t a c k f r a m e s e t u p i n i v t
.ret21 : .body
DO_ L O A D _ S W I T C H _ S T A C K
br. c o n d . s p t k . m a n y r p / / g o e s t o i a64 _ l e a v e _ k e r n e l
END( i a64 _ p r e p a r e _ h a n d l e _ u n a l i g n e d )
/ /
/ / unw_ i n i t _ r u n n i n g ( v o i d ( * c a l l b a c k ) ( i n f o , a r g ) , v o i d * a r g )
/ /
# define E X T R A _ F R A M E _ S I Z E ( ( U N W _ F R A M E _ I N F O _ S I Z E + 1 5 ) & ~ 1 5 )
GLOBAL_ E N T R Y ( u n w _ i n i t _ r u n n i n g )
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 2 )
alloc l o c1 =ar . p f s ,2 ,3 ,3 ,0
;;
ld8 l o c2 = [ i n 0 ] ,8
mov l o c0 =rp
mov r16 =loc1
DO_ S A V E _ S W I T C H _ S T A C K
.body
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 2 )
.fframe IA6 4 _ S W I T C H _ S T A C K _ S I Z E + E X T R A _ F R A M E _ S I Z E
SWITCH_ S T A C K _ S A V E S ( E X T R A _ F R A M E _ S I Z E )
adds s p = - E X T R A _ F R A M E _ S I Z E ,s p
.body
;;
adds o u t 0 =16 ,s p / / & i n f o
mov o u t 1 =r13 / / c u r r e n t
adds o u t 2 =16 + E X T R A _ F R A M E _ S I Z E ,s p / / & s w i t c h _ s t a c k
br. c a l l . s p t k . m a n y r p =unw_init_frame_info
1 : adds o u t 0 =16 ,s p / / & i n f o
mov b6 =loc2
mov l o c2 =gp / / s a v e g p a c r o s s i n d i r e c t f u n c t i o n c a l l
;;
ld8 g p = [ i n 0 ]
mov o u t 1 =in1 / / a r g
br. c a l l . s p t k . m a n y r p =b6 / / i n v o k e t h e c a l l b a c k f u n c t i o n
1 : mov g p =loc2 / / r e s t o r e g p
/ / For n o w , w e d o n ' t a l l o w c h a n g i n g r e g i s t e r s f r o m w i t h i n
/ / unw_ i n i t _ r u n n i n g ; if we ever want to allow that, we'd
/ / have t o d o a l o a d _ s w i t c h _ s t a c k h e r e :
.restore sp
adds s p =IA64_SWITCH_STACK_SIZE + E X T R A _ F R A M E _ S I Z E ,s p
mov a r . p f s =loc1
mov r p =loc0
br. r e t . s p t k . m a n y r p
END( u n w _ i n i t _ r u n n i n g )
.rodata
.align 8
.globl sys_call_table
sys_call_table :
data8 s y s _ n i _ s y s c a l l / / T h i s m u s t b e s y s _ n i _ s y s c a l l ! S e e i v t . S .
data8 s y s _ e x i t / / 1 0 2 5
data8 s y s _ r e a d
data8 s y s _ w r i t e
data8 s y s _ o p e n
data8 s y s _ c l o s e
data8 s y s _ c r e a t / / 1 0 3 0
data8 s y s _ l i n k
data8 s y s _ u n l i n k
data8 i a64 _ e x e c v e
data8 s y s _ c h d i r
data8 s y s _ f c h d i r / / 1 0 3 5
data8 s y s _ u t i m e s
data8 s y s _ m k n o d
data8 s y s _ c h m o d
data8 s y s _ c h o w n
data8 s y s _ l s e e k / / 1 0 4 0
data8 s y s _ g e t p i d
data8 s y s _ g e t p p i d
data8 s y s _ m o u n t
data8 s y s _ u m o u n t
data8 s y s _ s e t u i d / / 1 0 4 5
data8 s y s _ g e t u i d
data8 s y s _ g e t e u i d
data8 s y s _ p t r a c e
data8 s y s _ a c c e s s
data8 s y s _ s y n c / / 1 0 5 0
data8 s y s _ f s y n c
data8 s y s _ f d a t a s y n c
data8 s y s _ k i l l
data8 s y s _ r e n a m e
data8 s y s _ m k d i r / / 1 0 5 5
data8 s y s _ r m d i r
data8 s y s _ d u p
data8 s y s _ p i p e
data8 s y s _ t i m e s
data8 i a64 _ b r k / / 1 0 6 0
data8 s y s _ s e t g i d
data8 s y s _ g e t g i d
data8 s y s _ g e t e g i d
data8 s y s _ a c c t
data8 s y s _ i o c t l / / 1 0 6 5
data8 s y s _ f c n t l
data8 s y s _ u m a s k
data8 s y s _ c h r o o t
data8 s y s _ u s t a t
data8 s y s _ d u p2 / / 1 0 7 0
data8 s y s _ s e t r e u i d
data8 s y s _ s e t r e g i d
data8 s y s _ g e t r e s u i d
data8 s y s _ s e t r e s u i d
data8 s y s _ g e t r e s g i d / / 1 0 7 5
data8 s y s _ s e t r e s g i d
data8 s y s _ g e t g r o u p s
data8 s y s _ s e t g r o u p s
data8 s y s _ g e t p g i d
data8 s y s _ s e t p g i d / / 1 0 8 0
data8 s y s _ s e t s i d
data8 s y s _ g e t s i d
data8 s y s _ s e t h o s t n a m e
data8 s y s _ s e t r l i m i t
data8 s y s _ g e t r l i m i t / / 1 0 8 5
data8 s y s _ g e t r u s a g e
data8 s y s _ g e t t i m e o f d a y
data8 s y s _ s e t t i m e o f d a y
data8 s y s _ s e l e c t
data8 s y s _ p o l l / / 1 0 9 0
data8 s y s _ s y m l i n k
data8 s y s _ r e a d l i n k
data8 s y s _ u s e l i b
data8 s y s _ s w a p o n
data8 s y s _ s w a p o f f / / 1 0 9 5
data8 s y s _ r e b o o t
data8 s y s _ t r u n c a t e
data8 s y s _ f t r u n c a t e
data8 s y s _ f c h m o d
data8 s y s _ f c h o w n / / 1 1 0 0
data8 i a64 _ g e t p r i o r i t y
data8 s y s _ s e t p r i o r i t y
data8 s y s _ s t a t f s
data8 s y s _ f s t a t f s
data8 s y s _ g e t t i d / / 1 1 0 5
data8 s y s _ s e m g e t
data8 s y s _ s e m o p
data8 s y s _ s e m c t l
data8 s y s _ m s g g e t
data8 s y s _ m s g s n d / / 1 1 1 0
data8 s y s _ m s g r c v
data8 s y s _ m s g c t l
data8 s y s _ s h m g e t
2005-05-01 19:59:12 +04:00
data8 s y s _ s h m a t
2005-04-17 02:20:36 +04:00
data8 s y s _ s h m d t / / 1 1 1 5
data8 s y s _ s h m c t l
data8 s y s _ s y s l o g
data8 s y s _ s e t i t i m e r
data8 s y s _ g e t i t i m e r
data8 s y s _ n i _ s y s c a l l / / 1 1 2 0 / * w a s : i a64 _ o l d s t a t * /
data8 s y s _ n i _ s y s c a l l / * w a s : i a64 _ o l d l s t a t * /
data8 s y s _ n i _ s y s c a l l / * w a s : i a64 _ o l d f s t a t * /
data8 s y s _ v h a n g u p
data8 s y s _ l c h o w n
data8 s y s _ r e m a p _ f i l e _ p a g e s / / 1 1 2 5
data8 s y s _ w a i t 4
data8 s y s _ s y s i n f o
data8 s y s _ c l o n e
data8 s y s _ s e t d o m a i n n a m e
data8 s y s _ n e w u n a m e / / 1 1 3 0
data8 s y s _ a d j t i m e x
data8 s y s _ n i _ s y s c a l l / * w a s : i a64 _ c r e a t e _ m o d u l e * /
data8 s y s _ i n i t _ m o d u l e
data8 s y s _ d e l e t e _ m o d u l e
data8 s y s _ n i _ s y s c a l l / / 1 1 3 5 / * w a s : s y s _ g e t _ k e r n e l _ s y m s * /
data8 s y s _ n i _ s y s c a l l / * w a s : s y s _ q u e r y _ m o d u l e * /
data8 s y s _ q u o t a c t l
data8 s y s _ b d f l u s h
data8 s y s _ s y s f s
data8 s y s _ p e r s o n a l i t y / / 1 1 4 0
data8 s y s _ n i _ s y s c a l l / / s y s _ a f s _ s y s c a l l
data8 s y s _ s e t f s u i d
data8 s y s _ s e t f s g i d
data8 s y s _ g e t d e n t s
data8 s y s _ f l o c k / / 1 1 4 5
data8 s y s _ r e a d v
data8 s y s _ w r i t e v
data8 s y s _ p r e a d64
data8 s y s _ p w r i t e 6 4
data8 s y s _ s y s c t l / / 1 1 5 0
data8 s y s _ m m a p
data8 s y s _ m u n m a p
data8 s y s _ m l o c k
data8 s y s _ m l o c k a l l
data8 s y s _ m p r o t e c t / / 1 1 5 5
data8 i a64 _ m r e m a p
data8 s y s _ m s y n c
data8 s y s _ m u n l o c k
data8 s y s _ m u n l o c k a l l
data8 s y s _ s c h e d _ g e t p a r a m / / 1 1 6 0
data8 s y s _ s c h e d _ s e t p a r a m
data8 s y s _ s c h e d _ g e t s c h e d u l e r
data8 s y s _ s c h e d _ s e t s c h e d u l e r
data8 s y s _ s c h e d _ y i e l d
data8 s y s _ s c h e d _ g e t _ p r i o r i t y _ m a x / / 1 1 6 5
data8 s y s _ s c h e d _ g e t _ p r i o r i t y _ m i n
data8 s y s _ s c h e d _ r r _ g e t _ i n t e r v a l
data8 s y s _ n a n o s l e e p
data8 s y s _ n f s s e r v c t l
data8 s y s _ p r c t l / / 1 1 7 0
data8 s y s _ g e t p a g e s i z e
data8 s y s _ m m a p2
data8 s y s _ p c i c o n f i g _ r e a d
data8 s y s _ p c i c o n f i g _ w r i t e
data8 s y s _ p e r f m o n c t l / / 1 1 7 5
data8 s y s _ s i g a l t s t a c k
data8 s y s _ r t _ s i g a c t i o n
data8 s y s _ r t _ s i g p e n d i n g
data8 s y s _ r t _ s i g p r o c m a s k
data8 s y s _ r t _ s i g q u e u e i n f o / / 1 1 8 0
data8 s y s _ r t _ s i g r e t u r n
data8 s y s _ r t _ s i g s u s p e n d
data8 s y s _ r t _ s i g t i m e d w a i t
data8 s y s _ g e t c w d
data8 s y s _ c a p g e t / / 1 1 8 5
data8 s y s _ c a p s e t
data8 s y s _ s e n d f i l e 6 4
data8 s y s _ n i _ s y s c a l l / / s y s _ g e t p m s g ( S T R E A M S )
data8 s y s _ n i _ s y s c a l l / / s y s _ p u t p m s g ( S T R E A M S )
data8 s y s _ s o c k e t / / 1 1 9 0
data8 s y s _ b i n d
data8 s y s _ c o n n e c t
data8 s y s _ l i s t e n
data8 s y s _ a c c e p t
data8 s y s _ g e t s o c k n a m e / / 1 1 9 5
data8 s y s _ g e t p e e r n a m e
data8 s y s _ s o c k e t p a i r
data8 s y s _ s e n d
data8 s y s _ s e n d t o
data8 s y s _ r e c v / / 1 2 0 0
data8 s y s _ r e c v f r o m
data8 s y s _ s h u t d o w n
data8 s y s _ s e t s o c k o p t
data8 s y s _ g e t s o c k o p t
data8 s y s _ s e n d m s g / / 1 2 0 5
data8 s y s _ r e c v m s g
data8 s y s _ p i v o t _ r o o t
data8 s y s _ m i n c o r e
data8 s y s _ m a d v i s e
data8 s y s _ n e w s t a t / / 1 2 1 0
data8 s y s _ n e w l s t a t
data8 s y s _ n e w f s t a t
data8 s y s _ c l o n e 2
data8 s y s _ g e t d e n t s64
data8 s y s _ g e t u n w i n d / / 1 2 1 5
data8 s y s _ r e a d a h e a d
data8 s y s _ s e t x a t t r
data8 s y s _ l s e t x a t t r
data8 s y s _ f s e t x a t t r
data8 s y s _ g e t x a t t r / / 1 2 2 0
data8 s y s _ l g e t x a t t r
data8 s y s _ f g e t x a t t r
data8 s y s _ l i s t x a t t r
data8 s y s _ l l i s t x a t t r
data8 s y s _ f l i s t x a t t r / / 1 2 2 5
data8 s y s _ r e m o v e x a t t r
data8 s y s _ l r e m o v e x a t t r
data8 s y s _ f r e m o v e x a t t r
data8 s y s _ t k i l l
data8 s y s _ f u t e x / / 1 2 3 0
data8 s y s _ s c h e d _ s e t a f f i n i t y
data8 s y s _ s c h e d _ g e t a f f i n i t y
data8 s y s _ s e t _ t i d _ a d d r e s s
data8 s y s _ f a d v i s e 6 4 _ 6 4
data8 s y s _ t g k i l l / / 1 2 3 5
data8 s y s _ e x i t _ g r o u p
data8 s y s _ l o o k u p _ d c o o k i e
data8 s y s _ i o _ s e t u p
data8 s y s _ i o _ d e s t r o y
data8 s y s _ i o _ g e t e v e n t s / / 1 2 4 0
data8 s y s _ i o _ s u b m i t
data8 s y s _ i o _ c a n c e l
data8 s y s _ e p o l l _ c r e a t e
data8 s y s _ e p o l l _ c t l
data8 s y s _ e p o l l _ w a i t / / 1 2 4 5
data8 s y s _ r e s t a r t _ s y s c a l l
data8 s y s _ s e m t i m e d o p
data8 s y s _ t i m e r _ c r e a t e
data8 s y s _ t i m e r _ s e t t i m e
data8 s y s _ t i m e r _ g e t t i m e / / 1 2 5 0
data8 s y s _ t i m e r _ g e t o v e r r u n
data8 s y s _ t i m e r _ d e l e t e
data8 s y s _ c l o c k _ s e t t i m e
data8 s y s _ c l o c k _ g e t t i m e
data8 s y s _ c l o c k _ g e t r e s / / 1 2 5 5
data8 s y s _ c l o c k _ n a n o s l e e p
data8 s y s _ f s t a t f s64
data8 s y s _ s t a t f s64
data8 s y s _ m b i n d
data8 s y s _ g e t _ m e m p o l i c y / / 1 2 6 0
data8 s y s _ s e t _ m e m p o l i c y
data8 s y s _ m q _ o p e n
data8 s y s _ m q _ u n l i n k
data8 s y s _ m q _ t i m e d s e n d
data8 s y s _ m q _ t i m e d r e c e i v e / / 1 2 6 5
data8 s y s _ m q _ n o t i f y
data8 s y s _ m q _ g e t s e t a t t r
data8 s y s _ n i _ s y s c a l l / / r e s e r v e d f o r k e x e c _ l o a d
data8 s y s _ n i _ s y s c a l l / / r e s e r v e d f o r v s e r v e r
data8 s y s _ w a i t i d / / 1 2 7 0
data8 s y s _ a d d _ k e y
data8 s y s _ r e q u e s t _ k e y
data8 s y s _ k e y c t l
2005-06-27 12:55:12 +04:00
data8 s y s _ i o p r i o _ s e t
data8 s y s _ i o p r i o _ g e t / / 1 2 7 5
[PATCH] remove sys_set_zone_reclaim()
This removes sys_set_zone_reclaim() for now. While i'm sure Martin is
trying to solve a real problem, we must not hard-code an incomplete and
insufficient approach into a syscall, because syscalls are pretty much
for eternity. I am quite strongly convinced that this syscall must not
hit v2.6.13 in its current form.
Firstly, the syscall lacks basic syscall design: e.g. it allows the
global setting of VM policy for unprivileged users. (!) [ Imagine an
Oracle installation and a SAP installation on the same NUMA box fighting
over the 'optimal' setting for this flag. What will they do? Will they
try to set the flag to their own preferred value every second or so? ]
Secondly, it was added based on a single datapoint from Martin:
http://marc.theaimsgroup.com/?l=linux-mm&m=111763597218177&w=2
where Martin characterizes the numbers the following way:
' Run-to-run variability for "make -j" is huge, so these numbers aren't
terribly useful except to see that with reclaim the benchmark still
finishes in a reasonable amount of time. '
in other words: the fundamental problem has likely not been solved, only
a tendential move into the right direction has been observed, and a
handful of numbers were picked out of a set of hugely variable results,
without showing the variability data. How much variance is there
run-to-run?
I'd really suggest to first walk the walk and see what's needed to get
stable & predictable kernel compilation numbers on that NUMA box, before
adding random syscalls to tune a particular aspect of the VM ... which
approach might not even matter once the whole picture has been analyzed
and understood!
The third, most important point is that the syscall exposes VM tuning
internals in a completely unstructured way. What sense does it make to
have a _GLOBAL_ per-node setting for 'should we go to another node for
reclaim'? If then it might make sense to do this per-app, via numalib or
so.
The change is minimalistic in that it doesnt remove the syscall and the
underlying infrastructure changes, only the user-visible changes. We
could perhaps add a CAP_SYS_ADMIN-only sysctl for this hack, a'ka
/proc/sys/vm/swappiness, but even that looks quite counterproductive
when the generic approach is that we are trying to reduce the number of
external factors in the VM balance picture.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-01 15:39:13 +04:00
data8 s y s _ n i _ s y s c a l l
2005-07-27 19:58:00 +04:00
data8 s y s _ i n o t i f y _ i n i t
data8 s y s _ i n o t i f y _ a d d _ w a t c h
data8 s y s _ i n o t i f y _ r m _ w a t c h
2005-04-17 02:20:36 +04:00
.org sys_call_table + 8 * NR_ s y s c a l l s / / g u a r d a g a i n s t f a i l u r e s t o i n c r e a s e N R _ s y s c a l l s