2008-12-25 15:38:56 +03:00
/ *
2009-06-12 12:26:44 +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>,
*
* /
2009-03-18 15:27:34 +03:00
# include < a s m / a s m - o f f s e t s . h >
2009-06-12 12:26:44 +04:00
.globl ftrace_stub
ftrace_stub :
br % r14
# ifdef C O N F I G _ 6 4 B I T
# ifdef C O N F I G _ D Y N A M I C _ F T R A C E
.globl _mcount
2008-12-25 15:38:56 +03:00
_mcount :
br % r14
2009-06-12 12:26:44 +04:00
.globl ftrace_caller
ftrace_caller :
2009-06-12 12:26:45 +04:00
larl % r1 ,f u n c t i o n _ t r a c e _ s t o p
icm % r1 ,0 x f ,0 ( % r1 )
bnzr % r14
2009-06-12 12:26:44 +04:00
stmg % r2 ,% r5 ,3 2 ( % r15 )
stg % r14 ,1 1 2 ( % r15 )
lgr % r1 ,% r15
aghi % r15 ,- 1 6 0
stg % r1 ,_ _ S F _ B A C K C H A I N ( % r15 )
lgr % r2 ,% r14
lg % r3 ,1 6 8 ( % r15 )
larl % r14 ,f t r a c e _ d y n _ f u n c
lg % r14 ,0 ( % r14 )
basr % r14 ,% r14
aghi % r15 ,1 6 0
lmg % r2 ,% r5 ,3 2 ( % r15 )
lg % r14 ,1 1 2 ( % r15 )
2008-12-25 15:38:56 +03:00
br % r14
2009-06-12 12:26:44 +04:00
.data
.globl ftrace_dyn_func
ftrace_dyn_func :
.quad ftrace_stub
.previous
# else / * C O N F I G _ D Y N A M I C _ F T R A C E * /
2008-12-25 15:38:56 +03:00
2009-06-12 12:26:44 +04:00
.globl _mcount
2008-12-25 15:38:56 +03:00
_mcount :
2009-06-12 12:26:45 +04:00
larl % r1 ,f u n c t i o n _ t r a c e _ s t o p
icm % r1 ,0 x f ,0 ( % r1 )
bnzr % r14
2009-06-12 12:26:44 +04:00
stmg % r2 ,% r5 ,3 2 ( % r15 )
2008-12-25 15:38:56 +03:00
stg % r14 ,1 1 2 ( % r15 )
lgr % r1 ,% r15
aghi % r15 ,- 1 6 0
2009-03-18 15:27:34 +03:00
stg % r1 ,_ _ S F _ B A C K C H A I N ( % r15 )
2008-12-25 15:38:56 +03:00
lgr % r2 ,% r14
lg % r3 ,1 6 8 ( % r15 )
larl % r14 ,f t r a c e _ t r a c e _ f u n c t i o n
lg % r14 ,0 ( % r14 )
basr % r14 ,% r14
aghi % r15 ,1 6 0
2009-06-12 12:26:44 +04:00
lmg % r2 ,% r5 ,3 2 ( % r15 )
2008-12-25 15:38:56 +03:00
lg % r14 ,1 1 2 ( % r15 )
br % r14
2009-06-12 12:26:44 +04:00
# endif / * C O N F I G _ D Y N A M I C _ F T R A C E * /
# else / * C O N F I G _ 6 4 B I T * /
# ifdef C O N F I G _ D Y N A M I C _ F T R A C E
.globl _mcount
_mcount :
br % r14
.globl ftrace_caller
ftrace_caller :
stm % r2 ,% r5 ,1 6 ( % r15 )
2009-06-12 12:26:45 +04:00
bras % r1 ,2 f
0 : .long f t r a c e _ t r a c e _ f u n c t i o n
1 : .long f u n c t i o n _ t r a c e _ s t o p
2 : l % r2 ,1 b - 0 b ( % r1 )
icm % r2 ,0 x f ,0 ( % r2 )
jnz 3 f
2009-06-12 12:26:44 +04:00
st % r14 ,5 6 ( % r15 )
2009-06-12 12:26:45 +04:00
lr % r0 ,% r15
2009-06-12 12:26:44 +04:00
ahi % r15 ,- 9 6
l % r3 ,1 0 0 ( % r15 )
la % r2 ,0 ( % r14 )
2009-06-12 12:26:45 +04:00
st % r0 ,_ _ S F _ B A C K C H A I N ( % r15 )
2009-06-12 12:26:44 +04:00
la % r3 ,0 ( % r3 )
2009-06-12 12:26:45 +04:00
l % r14 ,0 b - 0 b ( % r1 )
2009-06-12 12:26:44 +04:00
l % r14 ,0 ( % r14 )
basr % r14 ,% r14
ahi % r15 ,9 6
l % r14 ,5 6 ( % r15 )
2009-06-12 12:26:45 +04:00
3 : lm % r2 ,% r5 ,1 6 ( % r15 )
2009-06-12 12:26:44 +04:00
br % r14
.data
.globl ftrace_dyn_func
ftrace_dyn_func :
.long ftrace_stub
.previous
# else / * C O N F I G _ D Y N A M I C _ F T R A C E * /
.globl _mcount
_mcount :
stm % r2 ,% r5 ,1 6 ( % r15 )
2009-06-12 12:26:45 +04:00
bras % r1 ,2 f
0 : .long f t r a c e _ t r a c e _ f u n c t i o n
1 : .long f u n c t i o n _ t r a c e _ s t o p
2 : l % r2 ,1 b - 0 b ( % r1 )
icm % r2 ,0 x f ,0 ( % r2 )
jnz 3 f
2009-06-12 12:26:44 +04:00
st % r14 ,5 6 ( % r15 )
2009-06-12 12:26:45 +04:00
lr % r0 ,% r15
2009-06-12 12:26:44 +04:00
ahi % r15 ,- 9 6
l % r3 ,1 0 0 ( % r15 )
la % r2 ,0 ( % r14 )
2009-06-12 12:26:45 +04:00
st % r0 ,_ _ S F _ B A C K C H A I N ( % r15 )
2009-06-12 12:26:44 +04:00
la % r3 ,0 ( % r3 )
2009-06-12 12:26:45 +04:00
l % r14 ,0 b - 0 b ( % r1 )
2009-06-12 12:26:44 +04:00
l % r14 ,0 ( % r14 )
basr % r14 ,% r14
ahi % r15 ,9 6
l % r14 ,5 6 ( % r15 )
2009-06-12 12:26:45 +04:00
3 : lm % r2 ,% r5 ,1 6 ( % r15 )
2008-12-25 15:38:56 +03:00
br % r14
2009-06-12 12:26:44 +04:00
# endif / * C O N F I G _ D Y N A M I C _ F T R A C E * /
2008-12-25 15:38:56 +03:00
# endif / * C O N F I G _ 6 4 B I T * /