x86: cpufunc: Add rdtscp_aux()

Add a variant of 'rdtscp()' that retains and returns the 'IA32_TSC_AUX'
value read by 'rdtscp'.

Sponsored By:	Juniper Networks, Inc.
Sponsored By:	Klara, Inc.
Reviewed by:	markj, kib
Differential Revision:	https://reviews.freebsd.org/D31415
This commit is contained in:
Adam Fenn 2021-07-26 12:59:55 -07:00 committed by Konstantin Belousov
parent 0d71cea832
commit 908e277230
2 changed files with 18 additions and 0 deletions

View File

@ -364,6 +364,15 @@ rdtscp(void)
return (low | ((uint64_t)high << 32));
}
static __inline uint64_t
rdtscp_aux(uint32_t *aux)
{
uint32_t low, high;
__asm __volatile("rdtscp" : "=a" (low), "=d" (high), "=c" (*aux));
return (low | ((uint64_t)high << 32));
}
static __inline uint32_t
rdtsc32(void)
{

View File

@ -403,6 +403,15 @@ rdtscp(void)
return (rv);
}
static __inline uint64_t
rdtscp_aux(uint32_t *aux)
{
uint64_t rv;
__asm __volatile("rdtscp" : "=A" (rv), "=c" (*aux));
return (rv);
}
static __inline uint32_t
rdtsc32(void)
{