2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2016 Joyent, Inc.
20 #include <sys/types.h>
21 #include <sys/param.h>
29 #define COMM_PAGE_SIZE PAGESIZE
36 * This struct defines the data format for the "comm page": kernel data made
37 * directly available to userspace for read-only operations. This enables
38 * facilities such as clock_gettime to operate entirely in userspace without
39 * the need for a trap or fasttrap.
41 * A note about 32-bit/64-bit compatibility:
42 * The current format of the comm page is designed to be consistent for both
43 * 32-bit and 64-bit programs running in a 64-bit kernel. On 32-bit kernels,
44 * the comm page is not exposed to userspace due to the difference in
47 * This struct is instantiated "by hand" in assembly to preserve the global
48 * symbols it contains. That layout must be kept in sync with the structure
50 * See: "uts/i86pc/ml/comm_page.s"
52 typedef struct comm_page_s
{
54 hrtime_t cp_tsc_hrtime_base
;
55 hrtime_t cp_tsc_resume_cap
;
57 uint32_t cp_tsc_max_delta
;
59 volatile uint32_t cp_hres_lock
; /* must be 8-byte aligned */
60 uint32_t cp_nsec_scale
;
61 int64_t cp_hrestime_adj
;
62 hrtime_t cp_hres_last_tick
;
65 volatile int64_t cp_hrestime
[2];
67 hrtime_t cp_tsc_sync_tick_delta
[NCPU
];
69 /* length resides in cp_ncpu */
70 hrtime_t cp_tsc_sync_tick_delta
[];
71 #endif /* defined(_MACHDEP) */
75 extern comm_page_t comm_page
;
78 extern hrtime_t tsc_last
;
79 extern hrtime_t tsc_hrtime_base
;
80 extern hrtime_t tsc_resume_cap
;
81 extern uint32_t tsc_type
;
82 extern uint32_t tsc_max_delta
;
83 extern volatile uint32_t hres_lock
;
84 extern uint32_t nsec_scale
;
85 extern int64_t hrestime_adj
;
86 extern hrtime_t hres_last_tick
;
87 extern uint32_t tsc_ncpu
;
88 extern volatile timestruc_t hrestime
;
89 extern hrtime_t tsc_sync_tick_delta
[NCPU
];
90 #endif /* defined(_MACHDEP) */
91 #endif /* defined(_KERNEL) */
99 #endif /* _COMM_PAGE_H */