__vdso_gettc.c (237434) | __vdso_gettc.c (246117) |
---|---|
1/*- 2 * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/lib/libc/i386/sys/__vdso_gettc.c 237434 2012-06-22 07:13:30Z kib $"); | 27__FBSDID("$FreeBSD: head/lib/libc/i386/sys/__vdso_gettc.c 246117 2013-01-30 12:48:16Z kib $"); |
28 29#include <sys/types.h> | 28 29#include <sys/types.h> |
30#include <sys/elf.h> |
|
30#include <sys/time.h> 31#include <sys/vdso.h> 32#include <machine/cpufunc.h> | 31#include <sys/time.h> 32#include <sys/vdso.h> 33#include <machine/cpufunc.h> |
34#include "libc_private.h" |
|
33 34static u_int 35__vdso_gettc_low(const struct vdso_timehands *th) 36{ 37 uint32_t rv; 38 39 __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" 40 : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); 41 return (rv); 42} 43 44#pragma weak __vdso_gettc 45u_int 46__vdso_gettc(const struct vdso_timehands *th) 47{ 48 49 return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); 50} | 35 36static u_int 37__vdso_gettc_low(const struct vdso_timehands *th) 38{ 39 uint32_t rv; 40 41 __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" 42 : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); 43 return (rv); 44} 45 46#pragma weak __vdso_gettc 47u_int 48__vdso_gettc(const struct vdso_timehands *th) 49{ 50 51 return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); 52} |
53 54#pragma weak __vdso_gettimekeep 55int 56__vdso_gettimekeep(struct vdso_timekeep **tk) 57{ 58 59 return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk))); 60} |
|