aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/lib/xray/xray_powerpc64.inc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/xray/xray_powerpc64.inc')
-rw-r--r--compiler-rt/lib/xray/xray_powerpc64.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/lib/xray/xray_powerpc64.inc b/compiler-rt/lib/xray/xray_powerpc64.inc
index e4e16d5b28e0..7e872b5b42e6 100644
--- a/compiler-rt/lib/xray/xray_powerpc64.inc
+++ b/compiler-rt/lib/xray/xray_powerpc64.inc
@@ -12,7 +12,22 @@
#include <cstdint>
#include <mutex>
+#ifdef __linux__
#include <sys/platform/ppc.h>
+#elif defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#define __ppc_get_timebase __builtin_ppc_get_timebase
+
+uint64_t __ppc_get_timebase_freq (void)
+{
+ uint64_t tb_freq = 0;
+ size_t length = sizeof(tb_freq);
+ sysctlbyname("kern.timecounter.tc.timebase.frequency", &tb_freq, &length, nullptr, 0);
+ return tb_freq;
+}
+#endif
#include "xray_defs.h"