2008-12-25 15:38:36 +03:00
/ *
* Userland i m p l e m e n t a t i o n o f c l o c k _ g e t r e s ( ) f o r 6 4 b i t s p r o c e s s e s i n a
* s3 9 0 k e r n e l f o r u s e i n t h e v D S O
*
* Copyright I B M C o r p . 2 0 0 8
* Author( s ) : M a r t i n S c h w i d e f s k y ( s c h w i d e f s k y @de.ibm.com)
*
* 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
* it 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 ( v e r s i o n 2 o n l y )
* 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 .
* /
# include < a s m / v d s o . h >
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / u n i s t d . h >
.text
.align 4
.globl __kernel_clock_getres
.type _ _ kernel_ c l o c k _ g e t r e s ,@function
__kernel_clock_getres :
.cfi_startproc
2014-08-29 14:31:45 +04:00
larl % r1 ,4 f
cghi % r2 ,_ _ C L O C K _ R E A L T I M E _ C O A R S E
je 0 f
cghi % r2 ,_ _ C L O C K _ M O N O T O N I C _ C O A R S E
je 0 f
larl % r1 ,3 f
2010-10-29 18:50:41 +04:00
cghi % r2 ,_ _ C L O C K _ R E A L T I M E
2008-12-25 15:38:36 +03:00
je 0 f
2010-10-29 18:50:41 +04:00
cghi % r2 ,_ _ C L O C K _ M O N O T O N I C
2008-12-31 17:11:42 +03:00
je 0 f
2013-12-02 17:54:56 +04:00
cghi % r2 ,_ _ C L O C K _ T H R E A D _ C P U T I M E _ I D
je 0 f
cghi % r2 ,- 2 / * P e r - t h r e a d C P U C L O C K w i t h P I D =0 , V I R T =1 * /
2008-12-25 15:38:36 +03:00
jne 2 f
2008-12-31 17:11:42 +03:00
larl % r5 ,_ v d s o _ d a t a
icm % r0 ,1 5 ,_ _ L C _ E C T G _ O K ( % r5 )
jz 2 f
2008-12-25 15:38:36 +03:00
0 : ltgr % r3 ,% r3
jz 1 f / * r e s = = N U L L * /
lg % r0 ,0 ( % r1 )
xc 0 ( 8 ,% r3 ) ,0 ( % r3 ) / * s e t t p - > t v _ s e c t o z e r o * /
stg % r0 ,8 ( % r3 ) / * s t o r e t p - > t v _ u s e c * /
1 : lghi % r2 ,0
br % r14
2 : lghi % r1 ,_ _ N R _ c l o c k _ g e t r e s / * f a l l b a c k t o s v c * /
svc 0
br % r14
2010-10-29 18:50:41 +04:00
3 : .quad _ _ C L O C K _ R E A L T I M E _ R E S
2014-08-29 14:31:45 +04:00
4 : .quad _ _ C L O C K _ C O A R S E _ R E S
2008-12-25 15:38:36 +03:00
.cfi_endproc
.size _ _ kernel_ c l o c k _ g e t r e s ,. - _ _ k e r n e l _ c l o c k _ g e t r e s