xref: /freebsd/sys/x86/include/vdso.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1aea81038SKonstantin Belousov /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3ebf5747bSPedro F. Giffuni  *
4aea81038SKonstantin Belousov  * Copyright 2012 Konstantin Belousov <kib@FreeBSD.ORG>.
516808549SKonstantin Belousov  * Copyright 2016 The FreeBSD Foundation.
6aea81038SKonstantin Belousov  * All rights reserved.
7aea81038SKonstantin Belousov  *
816808549SKonstantin Belousov  * Portions of this software were developed by Konstantin Belousov
916808549SKonstantin Belousov  * under sponsorship from the FreeBSD Foundation.
1016808549SKonstantin Belousov  *
11aea81038SKonstantin Belousov  * Redistribution and use in source and binary forms, with or without
12aea81038SKonstantin Belousov  * modification, are permitted provided that the following conditions
13aea81038SKonstantin Belousov  * are met:
14aea81038SKonstantin Belousov  * 1. Redistributions of source code must retain the above copyright
15aea81038SKonstantin Belousov  *    notice, this list of conditions and the following disclaimer.
16aea81038SKonstantin Belousov  * 2. Redistributions in binary form must reproduce the above copyright
17aea81038SKonstantin Belousov  *    notice, this list of conditions and the following disclaimer in the
18aea81038SKonstantin Belousov  *    documentation and/or other materials provided with the distribution.
19aea81038SKonstantin Belousov  *
20aea81038SKonstantin Belousov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21aea81038SKonstantin Belousov  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22aea81038SKonstantin Belousov  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23aea81038SKonstantin Belousov  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24aea81038SKonstantin Belousov  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25aea81038SKonstantin Belousov  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26aea81038SKonstantin Belousov  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27aea81038SKonstantin Belousov  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28aea81038SKonstantin Belousov  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29aea81038SKonstantin Belousov  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30aea81038SKonstantin Belousov  */
31aea81038SKonstantin Belousov 
32aea81038SKonstantin Belousov #ifndef _X86_VDSO_H
33aea81038SKonstantin Belousov #define	_X86_VDSO_H
34aea81038SKonstantin Belousov 
35aea81038SKonstantin Belousov #define	VDSO_TIMEHANDS_MD			\
36aea81038SKonstantin Belousov 	uint32_t	th_x86_shift;		\
3716808549SKonstantin Belousov 	uint32_t	th_x86_hpet_idx;	\
38d4b2d303SAdam Fenn 	uint64_t	th_x86_pvc_last_systime;\
39d4b2d303SAdam Fenn 	uint8_t		th_x86_pvc_stable_mask;	\
40d4b2d303SAdam Fenn 	uint8_t		th_res[15];
4116808549SKonstantin Belousov 
4216808549SKonstantin Belousov #define	VDSO_TH_ALGO_X86_TSC	VDSO_TH_ALGO_1
4316808549SKonstantin Belousov #define	VDSO_TH_ALGO_X86_HPET	VDSO_TH_ALGO_2
44fff5be0bSSepherosa Ziehau #define	VDSO_TH_ALGO_X86_HVTSC	VDSO_TH_ALGO_3	/* Hyper-V ref. TSC */
45d4b2d303SAdam Fenn #define	VDSO_TH_ALGO_X86_PVCLK	VDSO_TH_ALGO_4	/* KVM/XEN paravirtual clock */
46aea81038SKonstantin Belousov 
47aea81038SKonstantin Belousov #ifdef _KERNEL
48aea81038SKonstantin Belousov #ifdef COMPAT_FREEBSD32
49aea81038SKonstantin Belousov 
50*93626d54SKonstantin Belousov #define	VDSO_TIMEHANDS_MD32			\
51*93626d54SKonstantin Belousov 	uint32_t	th_x86_shift;		\
52*93626d54SKonstantin Belousov 	uint32_t	th_x86_hpet_idx;	\
53*93626d54SKonstantin Belousov 	uint32_t	th_x86_pvc_last_systime[2];\
54*93626d54SKonstantin Belousov 	uint8_t		th_x86_pvc_stable_mask;	\
55*93626d54SKonstantin Belousov 	uint8_t		th_res[15];
56aea81038SKonstantin Belousov 
57aea81038SKonstantin Belousov #endif
58aea81038SKonstantin Belousov #endif
59aea81038SKonstantin Belousov #endif
60