License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 15:07:57 +01:00
/* SPDX-License-Identifier: GPL-2.0 */
2005-04-16 15:20:36 -07:00
/ *
2006-10-03 23:01:26 +02:00
* arch/ i a64 / k e r n e l / e n t r y . S
2005-04-16 15:20:36 -07:00
*
* 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
* /
2008-05-27 15:08:01 -07:00
/ *
* Copyright ( c ) 2 0 0 8 I s a k u Y a m a h a t a < y a m a h a t a a t v a l i n u x c o j p >
* VA L i n u x S y s t e m s J a p a n K . K .
* pv_ o p s .
* /
2005-04-16 15:20:36 -07:00
/ *
* 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 < 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-09 22:03:13 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07: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 >
2009-01-09 11:29:46 +08:00
# include < a s m / f t r a c e . h >
2016-01-17 01:13:41 -05:00
# include < a s m / e x p o r t . h >
2005-04-16 15:20:36 -07:00
# 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 )
2012-10-14 15:53:04 -04:00
alloc l o c1 =ar . p f s ,8 ,2 ,3 ,0
2005-04-16 15:20:36 -07:00
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
br. c a l l . s p t k . m a n y r p =sys_execve
.ret0 :
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
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
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
2012-10-22 23:10:08 -04:00
mov o u t 2 =in2
2005-04-16 15:20:36 -07:00
tbit. n z p6 ,p0 =in0 ,C L O N E _ S E T T L S _ B I T
2012-10-22 23:10:08 -04:00
mov o u t 3 =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
2005-04-16 15:20:36 -07:00
;;
( 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 ( )
2012-10-22 23:10:08 -04:00
mov o u t 4 =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
2005-04-16 15:20:36 -07:00
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
2012-10-22 23:10:08 -04:00
mov o u t 2 =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 )
2005-04-16 15:20:36 -07:00
tbit. n z p6 ,p0 =in0 ,C L O N E _ S E T T L S _ B I T
2012-10-22 23:10:08 -04:00
mov o u t 3 =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
2005-04-16 15:20:36 -07:00
;;
( p6 ) s t 8 [ r2 ] =in4 / / s t o r e T L S i n r13 ( t p )
2012-10-22 23:10:08 -04:00
mov o u t 4 =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
2005-04-16 15:20:36 -07:00
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 .
* /
2015-06-02 11:42:02 -07:00
GLOBAL_ E N T R Y ( i a64 _ s w i t c h _ t o )
2005-04-16 15:20:36 -07:00
.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
2008-05-27 15:08:01 -07:00
MOV_ T O _ K R ( C U R R E N T , i n 0 , r8 , r9 ) / / 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
2005-04-16 15:20:36 -07:00
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 :
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I C ( r25 ) / / 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
2005-04-16 15:20:36 -07:00
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
;;
2008-05-27 15:08:01 -07:00
MOV_ T O _ I T I R ( p0 , r25 , r8 )
MOV_ T O _ I F A ( i n 0 , r8 ) / / V A o f n e x t t a s k . . .
2005-04-16 15:20:36 -07:00
;;
mov r25 =IA64_TR_CURRENT_STACK
2008-05-27 15:08:01 -07:00
MOV_ T O _ K R ( C U R R E N T _ S T A C K , r26 , r8 , r9 ) / / r e m e m b e r l a s t p a g e w e m a p p e d . . .
2005-04-16 15:20:36 -07:00
;;
itr. d d t r [ r25 ] =r23 / / w i r e i n n e w m a p p i n g . . .
2008-05-27 15:08:01 -07:00
SSM_ P S R _ I C _ A N D _ S R L Z _ D ( r8 , r9 ) / / r e e n a b l e t h e p s r . i c b i t
2005-04-16 15:20:36 -07:00
br. c o n d . s p t k . d o n e
2015-06-02 11:42:02 -07:00
END( i a64 _ s w i t c h _ t o )
2005-04-16 15:20:36 -07:00
/ *
* 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
* /
2008-05-27 15:08:01 -07:00
GLOBAL_ E N T R Y ( l o a d _ s w i t c h _ s t a c k )
2005-04-16 15:20:36 -07:00
.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 )
/ *
* 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
2008-10-06 10:43:06 -07:00
cmp. l t p6 ,p0 =r8 ,r0 / / c h e c k t r a c e h o o k
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 - >
2005-04-16 15:20:36 -07:00
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
2006-02-15 19:46:50 -06:00
.ret3 :
( pUStk) c m p . e q . u n c p6 ,p0 =r0 ,r0 / / p6 < - p U S t k
[IA64] disable interrupts on exit of ia64_trace_syscall
While testing with CONFIG_VIRT_CPU_ACCOUNTING=y, I found that
I occasionally get very huge system time in some threads.
So I dug the issue and finally noticed that it was caused
because of an interrupt which interrupt in the following window:
> [arch/ia64/kernel/entry.S: (!CONFIG_PREEMPT && CONFIG_VIRT_CPU_ACCOUNTING)]
>
> ENTRY(ia64_leave_syscall)
> :
> (pUStk) rsm psr.i
> cmp.eq pLvSys,p0=r0,r0 // pLvSys=1: leave from syscall
> (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk
> .work_processed_syscall:
> adds r2=PT(LOADRS)+16,r12
> (pUStk) mov.m r22=ar.itc // fetch time at leave
> adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
> ;;
> <<< window: from here >>>
> (p6) ld4 r31=[r18] // load current_thread_info()->flags
> ld8 r19=[r2],PT(B6)-PT(LOADRS)
> adds r3=PT(AR_BSPSTORE)+16,r12
> ;;
> mov r16=ar.bsp
> ld8 r18=[r2],PT(R9)-PT(B6)
> (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE?
> ;;
> ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE)
> (p6) cmp4.ne.unc p6,p0=r15, r0 // any special work pending?
> (p6) br.cond.spnt .work_pending_syscall
> ;;
> ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
> ld8 r11=[r3],PT(CR_IIP)-PT(R11)
> (pNonSys) break 0 // bug check: we shouldn't be here if pNonSys is TRUE!
> ;;
> invala
> <<< window: to here >>>
> rsm psr.i | psr.ic // turn off interrupts and interruption collection
If pUStk is true, it means we are going to return user mode, hence we fetch
ar.itc to get time at leave from system.
It seems that it is not possible to interrupt the window if pUStk is true,
because interrupts are disabled early. And also disabling interrupt makes
sense because it is safe for referring current_thread_info()->flags.
However interrupting the window while pUStk is true was possible.
The route was:
ia64_trace_syscall
-> .work_pending_syscall_end
-> .work_processed_syscall
Only in case entering the window from this route, interrupts are enabled
during in the window even if pUStk is true. I suppose interrupts must be
disabled here anyway if pUStk is true.
I'm not sure but afraid that what kind of bad effect were there, other
than crazy system time which I found.
FYI, there was a commit 6f6d75825dc49b082906b84537b4df28293c2977 that
points out a bug at same point(exit of ia64_trace_syscall) in 2006.
It can be said that there was an another bug.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
2008-04-21 14:34:39 -07:00
( pUStk) r s m p s r . i / / d i s a b l e i n t e r r u p t s
2008-05-27 15:08:01 -07:00
br. c o n d . s p t k i a64 _ w o r k _ p e n d i n g _ s y s c a l l _ e n d
2005-04-16 15:20:36 -07:00
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 )
2012-10-14 15:43:06 -04:00
ENTRY( c a l l _ p a y l o a 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 ( 0 )
/* call the kernel_thread payload; fn is in r4, arg - in r5 */
alloc l o c1 =ar . p f s ,0 ,3 ,1 ,0
mov l o c0 =rp
mov l o c2 =gp
mov o u t 0 =r5 / / a r g
ld8 r14 = [ r4 ] , 8 / / f n . a d d r e s s
;;
mov b6 = r14
ld8 g p = [ r4 ] / / f n . g p
;;
br. c a l l . s p t k . m a n y r p =b6 / / f n ( a r g )
.ret12 : mov g p =loc2
mov r p =loc0
mov a r . p f s =loc1
/* ... and if it has returned, we are going to userland */
cmp. n e p K S t k ,p U S t k =r0 ,r0
br. r e t . s p t k . m a n y r p
END( c a l l _ p a y l o a d )
2005-04-16 15:20:36 -07:00
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 :
2012-10-14 15:43:06 -04:00
( pKStk) b r . c a l l . s p t k . m a n y r p =call_payload
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
2005-04-16 15:20:36 -07:00
/ *
* 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-27 21:18:22 -07: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-16 15:20:36 -07: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-27 21:18:22 -07: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-16 15:20:36 -07: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
* /
2015-06-02 11:42:02 -07:00
GLOBAL_ E N T R Y ( i a64 _ l e a v e _ s y s c a l l )
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
* resumes a t i a64 _ 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
2005-04-16 15:20:36 -07:00
* 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
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I ( p0 , r2 , r18 ) / / d i s a b l e i n t e r r u p t s
2005-04-16 15:20:36 -07:00
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 * /
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I ( p U S t k , r2 , r18 )
2005-04-16 15:20:36 -07:00
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
2015-06-02 11:42:02 -07:00
.global ia6 4 _ w o r k _ p r o c e s s e d _ s y s c a l l ;
ia64_work_processed_syscall :
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
adds r2 =PT ( L O A D R S ) + 1 6 ,r12
2009-03-04 21:05:38 +09:00
MOV_ F R O M _ I T C ( p U S t k , p9 , r22 , r19 ) / / f e t c h t i m e a t l e a v e
2008-01-29 14:27:30 +09:00
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 "
adds r3 =PT ( A R _ B S P S T O R E ) + 1 6 ,r12 / / d e f e r r e d
;;
# else
2005-04-16 15:20:36 -07:00
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-27 21:16:07 -07:00
nop. i 0
2005-04-16 15:20:36 -07:00
;;
2008-01-29 14:27:30 +09:00
# endif
2005-04-27 21:17:44 -07: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-16 15:20:36 -07: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-27 21:17:44 -07: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-16 15:20:36 -07: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-27 21:17:44 -07: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-16 15:20:36 -07:00
;;
invala / / M 0 | 1 i n v a l i d a t e A L A T
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I _ I C ( r28 , r29 , r30 ) / / 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
2005-04-27 21:18:22 -07:00
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-16 15:20:36 -07:00
2005-04-27 21:18:22 -07: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
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
( pUStk) a d d r14 =TI_AC_LEAVE + I A 6 4 _ T A S K _ S I Z E ,r13
;;
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
( pUStk) a d d r15 =IA64_TASK_THREAD_ON_USTACK_OFFSET ,r13
;;
# else
2005-04-27 21:18:22 -07:00
mov r22 =r0 / / A c l e a r r22
2005-04-16 15:20:36 -07: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-27 21:17:44 -07:00
( pUStk) a d d r14 =IA64_TASK_THREAD_ON_USTACK_OFFSET ,r13
2005-04-16 15:20:36 -07:00
;;
2008-01-29 14:27:30 +09:00
# endif
2005-04-16 15:20:36 -07: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
2008-05-27 15:08:01 -07:00
MOV_ F R O M _ P S R ( p K S t k , r22 , r21 ) / / 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-27 21:17:44 -07:00
nop 0
2005-04-16 15:20:36 -07:00
;;
2005-04-27 21:18:22 -07: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-16 15:20:36 -07:00
;;
2005-04-27 21:18:22 -07: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-16 15:20:36 -07:00
;;
2005-04-27 21:18:22 -07: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-16 15:20:36 -07:00
;;
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
( pUStk) s t 1 [ r15 ] =r17 / / M 2 | 3
# else
2005-04-27 21:18:22 -07:00
( pUStk) s t 1 [ r14 ] =r17 / / M 2 | 3
2008-01-29 14:27:30 +09:00
# endif
2005-04-27 21:18:22 -07:00
ld8 . f i l l r13 = [ r3 ] ,1 6 / / M 0 | 1
mov f8 =f0 / / F c l e a r f8
2005-04-16 15:20:36 -07:00
;;
2005-04-27 21:18:22 -07: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-25 13:03:16 -07:00
2006-10-13 10:05:45 -07:00
LOAD_ P H Y S _ S T A C K _ R E G _ S I Z E ( r17 )
2005-04-27 21:18:22 -07:00
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-27 21:17:44 -07:00
2005-04-27 21:18:22 -07: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
2008-05-27 15:08:01 -07:00
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-16 15:20:36 -07:00
;;
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
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
st8 [ r14 ] =r22 / / M s a v e t i m e a t l e a v e
mov f10 =f0 / / F c l e a r f10
mov r22 =r0 / / A c l e a r r22
movl r14 =__kernel_syscall_via_epc / / X
;;
# else
2005-04-27 21:18:22 -07:00
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-27 21:16:07 -07:00
nop. m 0
2005-04-27 21:18:22 -07:00
movl r14 =__kernel_syscall_via_epc / / X
2005-04-16 15:20:36 -07:00
;;
2008-01-29 14:27:30 +09:00
# endif
2005-04-27 21:18:22 -07: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-16 15:20:36 -07:00
2005-04-27 21:18:22 -07: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
2015-06-02 11:42:02 -07:00
END( i a64 _ l e a v e _ s y s c a l l )
2005-04-16 15:20:36 -07:00
2015-06-02 11:42:02 -07:00
GLOBAL_ E N T R Y ( i a64 _ l e a v e _ k e r n e l )
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I ( p0 , r17 , r31 ) / / d i s a b l e i n t e r r u p t s
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I ( p U S t k , r17 , r31 )
2005-04-16 15:20:36 -07:00
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
;;
2008-05-27 15:08:01 -07:00
RSM_ P S R _ I _ I C ( r23 , r22 , r25 ) / / 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
2005-04-16 15:20:36 -07:00
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-27 21:22:08 -07: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-16 15:20:36 -07:00
mov a r . c c v =r15
;;
ldf. f i l l f11 = [ r2 ]
2008-05-27 15:08:01 -07:00
BSW_ 0 ( r2 , r3 , r15 ) / / 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 . . . )
2005-04-16 15:20:36 -07:00
;;
( 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
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
.pred .rel .mutex pUStk,p K S t k
2008-05-27 15:08:01 -07:00
MOV_ F R O M _ P S R ( p K S t k , r22 , r29 ) / / 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
2009-03-04 21:05:38 +09:00
MOV_ F R O M _ I T C ( p U S t k , p9 , r22 , r29 ) / / M f e t c h t i m e a t l e a v e
2008-01-29 14:27:30 +09:00
nop. i 0
;;
# else
2008-05-27 15:08:01 -07:00
MOV_ F R O M _ P S R ( p K S t k , r22 , r29 ) / / 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-16 15:20:36 -07:00
nop. i 0
nop. i 0
;;
2008-01-29 14:27:30 +09:00
# endif
2005-04-16 15:20:36 -07:00
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
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
( pUStk) a d d s r3 =TI_AC_LEAVE + I A 6 4 _ T A S K _ S I Z E ,r18
# else
2005-04-16 15:20:36 -07:00
( pUStk) a d d s r18 =IA64_TASK_THREAD_ON_USTACK_OFFSET ,r18
2008-01-29 14:27:30 +09:00
# endif
2005-04-16 15:20:36 -07:00
;;
ld8 r20 = [ r16 ] ,1 6 / / a r . f p s r
ld8 . f i l l r15 = [ r17 ] ,1 6
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
( pUStk) a d d s r18 =IA64_TASK_THREAD_ON_USTACK_OFFSET ,r18 / / d e f e r r e d
# endif
2005-04-16 15:20:36 -07:00
;;
ld8 . f i l l r14 = [ r16 ] ,1 6
ld8 . f i l l r2 = [ r17 ]
( pUStk) m o v r17 =1
;;
2012-07-25 07:56:04 +02:00
# ifdef C O N F I G _ V I R T _ C P U _ A C C O U N T I N G _ N A T I V E
2008-01-29 14:27:30 +09:00
/ / mmi_ : l d8 s t 1 s h r ;; mmi_ : st8 st1 shr;;
/ / mib : m o v a d d b r - > m i b : l d8 a d d b r
/ / bbb_ : b r n o p c o v e r ;; mbb_ : mov br cover;;
/ /
/ / no o n e r e q u i r e b s p i n r16 i f ( p K S t k ) b r a n c h i s s e l e c t e d .
( pUStk) s t 8 [ r3 ] =r22 / / s a v e t i m e a t l e a v e
( 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
;;
ld8 . f i l l r3 = [ r16 ] / / d e f e r r e d
LOAD_ P H Y S _ S T A C K _ R E G _ S I Z E ( r17 )
( pKStk) b r . c o n d . d p n t s k i p _ r b s _ s w i t c h
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
# else
2005-04-16 15:20:36 -07:00
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
2006-10-13 10:05:45 -07:00
LOAD_ P H Y S _ S T A C K _ R E G _ S I Z E ( r17 )
2005-04-16 15:20:36 -07:00
( pKStk) b r . c o n d . d p n t s k i p _ r b s _ s w i t c h
2008-01-29 14:27:30 +09:00
# endif
2005-04-16 15:20:36 -07:00
/ *
* 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
2008-05-27 15:08:01 -07:00
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
2005-04-16 15:20:36 -07:00
;;
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-27 21:17:44 -07:00
rbs_switch :
2005-04-16 15:20:36 -07: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-27 21:13:33 -07:00
( pRecurse) b r . c a l l . d p t k . f e w b0 =rse_clear_invalid
2005-04-16 15:20:36 -07: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-27 21:13:33 -07:00
( pReturn) b r . r e t . d p t k . m a n y b0
2005-04-16 15:20:36 -07: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
;;
2008-05-27 15:08:01 -07:00
MOV_ T O _ I P S R ( p0 , r29 , r25 ) / / M 2
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
MOV_ T O _ I F S ( p9 , r30 , r25 ) / / M 2
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
MOV_ T O _ I I P ( r28 , r25 ) / / M 2
2005-04-16 15:20:36 -07:00
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
2008-05-27 15:08:01 -07:00
RFI / / B
2005-04-16 15:20:36 -07:00
/ *
* 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
2008-05-09 15:26:35 +09:00
*
* Interrupts a r e d i s a b l e d o n e n t r y , r e e n a b l e d d e p e n d o n w o r k , a n d
* disabled o n e x i t .
2005-04-16 15:20:36 -07:00
* /
.work_pending_syscall :
add r2 = - 8 ,r2
add r3 = - 8 ,r3
;;
st8 [ r2 ] =r8
st8 [ r3 ] =r10
.work_pending :
2008-05-09 15:26:51 +09:00
tbit. z p6 ,p0 =r31 ,T I F _ N E E D _ R E S C H E D / / i s r e s c h e d n o t n e e d e d ?
2005-04-16 15:20:36 -07:00
( p6 ) b r . c o n d . s p t k . f e w . n o t i f y
2013-09-17 18:53:08 +00:00
br. c a l l . s p n t . m a n y r p =preempt_schedule_irq
2008-05-09 15:26:51 +09:00
.ret9 : cmp. e q p6 ,p0 =r0 ,r0 / / p6 < - 1 ( r e - c h e c k )
2015-06-02 11:42:02 -07:00
( pLvSys) b r . c o n d . s p t k . f e w i a64 _ w o r k _ p e n d i n g _ s y s c a l l _ e n d
2008-05-09 15:26:51 +09:00
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
2005-04-16 15:20:36 -07:00
.notify :
( pUStk) b r . c a l l . s p n t . m a n y r p =notify_resume_user
2008-05-09 15:26:51 +09:00
.ret10 : cmp. n e p6 ,p0 =r0 ,r0 / / p6 < - 0 ( d o n ' t r e - c h e c k )
2015-06-02 11:42:02 -07:00
( pLvSys) b r . c o n d . s p t k . f e w i a64 _ w o r k _ p e n d i n g _ s y s c a l l _ e n d
2008-05-09 15:26:51 +09:00
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
2005-04-16 15:20:36 -07:00
2015-06-02 11:42:02 -07:00
.global ia6 4 _ w o r k _ p e n d i n g _ s y s c a l l _ e n d ;
ia64_work_pending_syscall_end :
2005-04-16 15:20:36 -07:00
adds r2 =PT ( R 8 ) + 1 6 ,r12
adds r3 =PT ( R 1 0 ) + 1 6 ,r12
;;
ld8 r8 = [ r2 ]
ld8 r10 = [ r3 ]
2015-06-02 11:42:02 -07:00
br. c o n d . s p t k . m a n y i a64 _ w o r k _ p r o c e s s e d _ s y s c a l l
END( i a64 _ l e a v e _ k e r n e l )
2005-04-16 15:20:36 -07:00
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 )
/ *
2008-05-09 15:26:35 +09:00
* 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 ( ) , k e e p i n g i n t e r r u p t s
* disabled.
*
* Note t h a t p S y s a n d p N o n S y s n e e d t o b e s e t u p b y t h e c a l l e r .
* We 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 a r g s g e t p r e s e r v e d ,
* in 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 .
2005-04-16 15:20:36 -07:00
* /
2008-05-27 15:08:01 -07:00
GLOBAL_ E N T R Y ( n o t i f y _ r e s u m e _ u s e r )
2005-04-16 15:20:36 -07:00
.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 06:42:00 -07:00
.spillsp ar. u n a t , 1 6
2005-04-16 15:20:36 -07: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 )
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 12:25:00 -07:00
.ret19 : .restore sp,0
2005-04-16 15:20:36 -07:00
adds s p =16 ,s p
;;
ld8 r9 = [ s p ] / / l o a d n e w a r . u n a t
2015-06-02 11:42:02 -07:00
mov. s p t k b7 =r8 ,i a64 _ l e a v e _ k e r n e l
2005-04-16 15:20:36 -07:00
;;
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 )
2016-01-17 01:13:41 -05:00
EXPORT_ S Y M B O L ( u n w _ i n i t _ r u n n i n g )
2005-04-16 15:20:36 -07:00
2009-01-09 11:29:46 +08:00
# ifdef C O N F I G _ F U N C T I O N _ T R A C E R
2009-01-09 11:29:49 +08:00
# ifdef C O N F I G _ D Y N A M I C _ F T R A C E
GLOBAL_ E N T R Y ( _ m c o u n t )
br f t r a c e _ s t u b
END( _ m c o u n t )
2016-01-17 01:13:41 -05:00
EXPORT_ S Y M B O L ( _ m c o u n t )
2009-01-09 11:29:49 +08:00
.here :
br. r e t . s p t k . m a n y b0
GLOBAL_ E N T R Y ( f t r a c e _ c a l l e r )
alloc o u t 0 = a r . p f s , 8 , 0 , 4 , 0
mov o u t 3 = r0
;;
mov o u t 2 = b0
add r3 = 0 x20 , r3
mov o u t 1 = r1 ;
br. c a l l . s p t k . m a n y b0 = f t r a c e _ p a t c h _ g p
/ / this m i g h t b e c a l l e d f r o m m o d u l e , s o w e m u s t p a t c h g p
ftrace_patch_gp :
movl g p =__gp
mov b0 = r3
;;
.global ftrace_ c a l l ;
ftrace_call :
{
.mlx
nop. m 0 x0
movl r3 = . h e r e ;;
}
alloc l o c0 = a r . p f s , 4 , 4 , 2 , 0
;;
mov l o c1 = b0
mov o u t 0 = b0
mov l o c2 = r8
mov l o c3 = r15
;;
adds o u t 0 = - M C O U N T _ I N S N _ S I Z E , o u t 0
mov o u t 1 = i n 2
mov b6 = r3
br. c a l l . s p t k . m a n y b0 = b6
;;
mov a r . p f s = l o c0
mov b0 = l o c1
mov r8 = l o c2
mov r15 = l o c3
br f t r a c e _ s t u b
;;
END( f t r a c e _ c a l l e r )
# else
2009-01-09 11:29:46 +08:00
GLOBAL_ E N T R Y ( _ m c o u n t )
movl r2 = f t r a c e _ s t u b
movl r3 = f t r a c e _ t r a c e _ f u n c t i o n ;;
ld8 r3 = [ r3 ] ;;
ld8 r3 = [ r3 ] ;;
cmp. e q p7 ,p0 = r2 , r3
( p7 ) b r . s p t k . m a n y f t r a c e _ s t u b
;;
alloc l o c0 = a r . p f s , 4 , 4 , 2 , 0
;;
mov l o c1 = b0
mov o u t 0 = b0
mov l o c2 = r8
mov l o c3 = r15
;;
adds o u t 0 = - M C O U N T _ I N S N _ S I Z E , o u t 0
mov o u t 1 = i n 2
mov b6 = r3
br. c a l l . s p t k . m a n y b0 = b6
;;
mov a r . p f s = l o c0
mov b0 = l o c1
mov r8 = l o c2
mov r15 = l o c3
br f t r a c e _ s t u b
;;
END( _ m c o u n t )
2009-01-09 11:29:49 +08:00
# endif
2009-01-09 11:29:46 +08:00
GLOBAL_ E N T R Y ( f t r a c e _ s t u b )
mov r3 = b0
movl r2 = _ m c o u n t _ r e t _ h e l p e r
;;
mov b6 = r2
mov b7 = r3
br. r e t . s p t k . m a n y b6
_mcount_ret_helper :
mov b0 = r42
mov r1 = r41
mov a r . p f s = r40
br b7
END( f t r a c e _ s t u b )
# endif / * C O N F I G _ F U N C T I O N _ T R A C E R * /
2018-11-13 12:27:45 +05:30
# define _ _ S Y S C A L L ( n r , e n t r y , n a r g s ) d a t a8 e n t r y
2005-04-16 15:20:36 -07:00
.rodata
.align 8
.globl sys_call_table
sys_call_table :
2018-11-13 12:27:45 +05:30
# include < a s m / s y s c a l l _ t a b l e . h >
# undef _ _ S Y S C A L L