diff options
Diffstat (limited to 'usr/src/uts/intel/asm/clock.h')
-rw-r--r-- | usr/src/uts/intel/asm/clock.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/usr/src/uts/intel/asm/clock.h b/usr/src/uts/intel/asm/clock.h index 6effcbc30a..bb855499ed 100644 --- a/usr/src/uts/intel/asm/clock.h +++ b/usr/src/uts/intel/asm/clock.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,7 +48,9 @@ extern __inline__ void unlock_hres_lock(void) : "cc"); } -extern __inline__ hrtime_t tsc_read(void) +#if defined(__xpv) + +extern __inline__ hrtime_t __rdtsc_insn(void) { #if defined(__amd64) uint32_t lobits, hibits; @@ -70,6 +71,25 @@ extern __inline__ hrtime_t tsc_read(void) #endif } +#else /* __xpv */ + +/* + * rdtsc may not exist on 32-bit, so we don't have an inline for it. + */ +#if defined(__amd64) +extern __inline__ hrtime_t tsc_read(void) +{ + uint32_t lobits, hibits; + + __asm__ __volatile__( + "rdtsc" + : "=a" (lobits), "=d" (hibits)); + return (lobits | ((hrtime_t)hibits << 32)); +} +#endif /* __amd64 */ + +#endif /* __xpv */ + #endif /* !__lint && __GNUC__ */ #ifdef __cplusplus |