2008-12-25 15:38:56 +03:00
/ *
2012-07-20 13:15:04 +04:00
* Copyright I B M C o r p . 2 0 0 8 , 2 0 0 9
2008-12-25 15:38:56 +03:00
*
* Author( s ) : H e i k o C a r s t e n s < h e i k o . c a r s t e n s @de.ibm.com>,
*
* /
2011-07-24 12:48:19 +04:00
# include < l i n u x / l i n k a g e . h >
2009-03-18 15:27:34 +03:00
# include < a s m / a s m - o f f s e t s . h >
2013-05-13 16:48:52 +04:00
# include < a s m / f t r a c e . h >
2014-10-07 17:45:10 +04:00
# include < a s m / p t r a c e . h >
2009-03-18 15:27:34 +03:00
2011-01-05 14:47:25 +03:00
.section .kprobes .text , " ax"
2011-07-24 12:48:19 +04:00
ENTRY( f t r a c e _ s t u b )
2009-06-12 12:26:44 +04:00
br % r14
2014-10-07 17:45:10 +04:00
# define S T A C K _ F R A M E _ S I Z E ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
# define S T A C K _ P T R E G S ( S T A C K _ F R A M E _ O V E R H E A D )
# define S T A C K _ P T R E G S _ G P R S ( S T A C K _ P T R E G S + _ _ P T _ G P R S )
# define S T A C K _ P T R E G S _ P S W ( S T A C K _ P T R E G S + _ _ P T _ P S W )
2011-07-24 12:48:19 +04:00
ENTRY( _ m c o u n t )
2008-12-25 15:38:56 +03:00
br % r14
2011-07-24 12:48:19 +04:00
ENTRY( f t r a c e _ c a l l e r )
2014-10-07 17:45:10 +04:00
.globl ftrace_regs_caller
.set ftrace_ r e g s _ c a l l e r ,f t r a c e _ c a l l e r
lgr % r1 ,% r15
aghi % r15 ,- S T A C K _ F R A M E _ S I Z E
stg % r1 ,_ _ S F _ B A C K C H A I N ( % r15 )
stg % r1 ,( S T A C K _ P T R E G S _ G P R S + 1 5 * 8 ) ( % r15 )
stg % r0 ,( S T A C K _ P T R E G S _ P S W + 8 ) ( % r15 )
stmg % r2 ,% r14 ,( S T A C K _ P T R E G S _ G P R S + 2 * 8 ) ( % r15 )
# ifdef C O N F I G _ H A V E _ M A R C H _ Z 1 9 6 _ F E A T U R E S
aghik % r2 ,% r0 ,- M C O U N T _ I N S N _ S I Z E
lgrl % r4 ,f u n c t i o n _ t r a c e _ o p
lgrl % r1 ,f t r a c e _ t r a c e _ f u n c t i o n
# else
lgr % r2 ,% r0
aghi % r2 ,- M C O U N T _ I N S N _ S I Z E
larl % r4 ,f u n c t i o n _ t r a c e _ o p
lg % r4 ,0 ( % r4 )
larl % r1 ,f t r a c e _ t r a c e _ f u n c t i o n
lg % r1 ,0 ( % r1 )
# endif
lgr % r3 ,% r14
la % r5 ,S T A C K _ P T R E G S ( % r15 )
basr % r14 ,% r1
2009-06-12 12:26:46 +04:00
# ifdef C O N F I G _ F U N C T I O N _ G R A P H _ T R A C E R
2014-10-07 17:45:10 +04:00
# The j i n s t r u c t i o n g e t s r u n t i m e p a t c h e d t o a n o p i n s t r u c t i o n .
2014-10-08 12:03:08 +04:00
# See f t r a c e _ e n a b l e _ f t r a c e _ g r a p h _ c a l l e r .
2014-10-07 17:45:10 +04:00
ENTRY( f t r a c e _ g r a p h _ c a l l e r )
j f t r a c e _ g r a p h _ c a l l e r _ e n d
lg % r2 ,( S T A C K _ P T R E G S _ G P R S + 1 4 * 8 ) ( % r15 )
lg % r3 ,( S T A C K _ P T R E G S _ P S W + 8 ) ( % r15 )
brasl % r14 ,p r e p a r e _ f t r a c e _ r e t u r n
stg % r2 ,( S T A C K _ P T R E G S _ G P R S + 1 4 * 8 ) ( % r15 )
ftrace_graph_caller_end :
.globl ftrace_graph_caller_end
2009-06-12 12:26:46 +04:00
# endif
2014-10-07 17:45:10 +04:00
lg % r1 ,( S T A C K _ P T R E G S _ P S W + 8 ) ( % r15 )
lmg % r2 ,% r15 ,( S T A C K _ P T R E G S _ G P R S + 2 * 8 ) ( % r15 )
br % r1
2008-12-25 15:38:56 +03:00
2009-06-12 12:26:46 +04:00
# ifdef C O N F I G _ F U N C T I O N _ G R A P H _ T R A C E R
2011-07-24 12:48:19 +04:00
ENTRY( r e t u r n _ t o _ h a n d l e r )
2014-10-07 17:45:10 +04:00
stmg % r2 ,% r5 ,3 2 ( % r15 )
lgr % r1 ,% r15
aghi % r15 ,- S T A C K _ F R A M E _ O V E R H E A D
stg % r1 ,_ _ S F _ B A C K C H A I N ( % r15 )
brasl % r14 ,f t r a c e _ r e t u r n _ t o _ h a n d l e r
aghi % r15 ,S T A C K _ F R A M E _ O V E R H E A D
lgr % r14 ,% r2
lmg % r2 ,% r5 ,3 2 ( % r15 )
2009-06-12 12:26:46 +04:00
br % r14
2009-09-11 12:28:33 +04:00
# endif