2017-04-25 19:25:53 +05:30
/ *
* Split f r o m e n t r y _ 6 4 . S
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* as p u b l i s h e d b y t h e F r e e S o f t w a r e F o u n d a t i o n ; either version
* 2 of t h e L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
* /
# include < l i n u x / m a g i c . h >
# include < a s m / p p c _ a s m . h >
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / f t r a c e . h >
# include < a s m / p p c - o p c o d e . h >
# include < a s m / e x p o r t . h >
# ifdef C O N F I G _ D Y N A M I C _ F T R A C E
_ GLOBAL( m c o u n t )
_ GLOBAL( _ m c o u n t )
EXPORT_ S Y M B O L ( _ m c o u n t )
mflr r12
mtctr r12
mtlr r0
bctr
2017-04-25 19:25:54 +05:30
# else / * C O N F I G _ D Y N A M I C _ F T R A C E * /
2017-04-25 19:25:53 +05:30
_ GLOBAL_ T O C ( _ m c o u n t )
EXPORT_ S Y M B O L ( _ m c o u n t )
/* Taken from output of objdump from lib64/glibc */
mflr r3
ld r11 , 0 ( r1 )
stdu r1 , - 1 1 2 ( r1 )
std r3 , 1 2 8 ( r1 )
ld r4 , 1 6 ( r11 )
subi r3 , r3 , M C O U N T _ I N S N _ S I Z E
LOAD_ R E G _ A D D R ( r5 ,f t r a c e _ t r a c e _ f u n c t i o n )
ld r5 ,0 ( r5 )
ld r5 ,0 ( r5 )
mtctr r5
bctrl
nop
# 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
b f t r a c e _ g r a p h _ c a l l e r
# endif
ld r0 , 1 2 8 ( r1 )
mtlr r0
addi r1 , r1 , 1 1 2
_ GLOBAL( f t r a c e _ s t u b )
blr
# endif / * C O N F I G _ D Y N A M I C _ F T R A C E * /
# 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
_ GLOBAL( r e t u r n _ t o _ h a n d l e r )
/* need to save return values */
std r4 , - 3 2 ( r1 )
std r3 , - 2 4 ( r1 )
/* save TOC */
std r2 , - 1 6 ( r1 )
std r31 , - 8 ( r1 )
mr r31 , r1
stdu r1 , - 1 1 2 ( r1 )
/ *
* We m i g h t b e c a l l e d f r o m a m o d u l e .
* Switch t o o u r T O C t o r u n i n s i d e t h e c o r e k e r n e l .
* /
ld r2 , P A C A T O C ( r13 )
bl f t r a c e _ r e t u r n _ t o _ h a n d l e r
nop
/* return value has real return address */
mtlr r3
ld r1 , 0 ( r1 )
ld r4 , - 3 2 ( r1 )
ld r3 , - 2 4 ( r1 )
ld r2 , - 1 6 ( r1 )
ld r31 , - 8 ( r1 )
/* Jump back to real return address */
blr
# endif / * 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 * /