This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/4] powerpc: Refactor of _get_timebase_freq


Since BZ#19767 is at least fixed for powerpc, we can now use the same
code in an agnostic way for static and shared linkage. Also because all
vDSO symbol do no fail we can simplify the vDSO calling without most of
the wrapper macros.

We keep the /proc/cpuinfo parsing as fallback if a kernel is built
without vDSO support

This implements the solution drafted by Adhemerval Zanella
<adhemerval.zanella@linaro.org> on the mailing list:

  https://www.sourceware.org/ml/libc-alpha/2019-05/msg00658.html

ChangeLog:

2019-06-13  Raoni Fassina Firmino  <raoni@linux.ibm.com>

	* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
	(__get_timebase_freq): Refactoring.
---
 sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
index c245e97526..959c311acb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
+++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
@@ -28,12 +28,12 @@ __get_timebase_freq (void)
 {
   hp_timing_t result = 0L;
 
-#ifdef SHARED
-  /* The vDSO does not return an error (it clear cr0.so on returning).  */
-  INTERNAL_SYSCALL_DECL (err);
-  result =
-    INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, uint64_t, 0);
-#else
+  /* The vDSO does not fail (it clears cr0.so on returning).  */
+  __typeof (VDSO_SYMBOL(get_tbfreq)) vdsop = VDSO_SYMBOL(get_tbfreq);
+  PTR_DEMANGLE (vdsop);
+  if (vdsop != NULL)
+    return vdsop ();
+
   /* We read the information from the /proc filesystem.  /proc/cpuinfo
      contains at least one line like:
      timebase        : 33333333
@@ -99,7 +99,6 @@ __get_timebase_freq (void)
 	    }
 	}
     }
-#endif
 
   return result;
 }
-- 
2.20.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]