krping: Use get_cyclecount for get_cycles.

This avoids having to duplicate identical MD code.

Reviewed by:	np, emaste
Differential Revision:	https://reviews.freebsd.org/D38971
This commit is contained in:
John Baldwin 2023-03-08 15:06:59 -08:00
parent 6dcd6d199f
commit f4ea84cea2

View File

@ -69,13 +69,7 @@ MODULE_DEPEND(krping, linuxkpi, 1, 1, 1);
static __inline uint64_t
get_cycles(void)
{
#if defined(__amd64__) || defined(__i386__)
uint32_t low, high;
__asm __volatile("rdtsc" : "=a" (low), "=d" (high));
return (low | ((u_int64_t)high << 32));
#elif defined(__powerpc64__)
return __builtin_readcyclecounter();
#endif
return (get_cyclecount());
}
typedef uint64_t cycles_t;