blob: 211c1c720bfc4af8046fed31ab0082f1f6f2deb7 [file] [log] [blame]
Andrew Geissler69721092021-07-23 12:57:00 -04001implement support for musl/ppc64
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
5+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
6@@ -58,7 +58,7 @@ Copyright (c) 2006, 2015, Percona and/or
7 #include <stdint.h>
8 #include <sys/time.h>
9 #include <time.h>
10-#if defined(__powerpc__)
11+#if defined(__powerpc__) && defined(__GLIBC__)
12 #include <sys/platform/ppc.h>
13 #endif
14
15@@ -131,8 +131,12 @@ static inline tokutime_t toku_time_now(v
16 uint64_t result;
Andrew Geisslerc5535c92023-01-27 16:10:19 -060017 __asm __volatile__("mrs %[rt], cntvct_el0" : [rt] "=r"(result));
Andrew Geissler69721092021-07-23 12:57:00 -040018 return result;
19-#elif defined(__powerpc__)
20+#elif defined(__powerpc__) && defined(__GLIBC__)
21 return __ppc_get_timebase();
22+#elif defined(__powerpc64__) || defined(__ppc64__)
23+ uint64_t result;
24+ asm volatile("mfspr %0, 268" : "=r"(result));
25+ return result;
Andrew Geissler87f5cff2022-09-30 13:13:31 -050026 #elif defined(__s390x__)
27 uint64_t result;
28 asm volatile("stckf %0" : "=Q"(result) : : "cc");