xref: /titanic_52/usr/src/uts/i86pc/ml/comm_page.s (revision 263f549e5da8b32c4922f586afb365b8ae388a6c)
1*263f549eSPatrick Mooney
2*263f549eSPatrick Mooney/*
3*263f549eSPatrick Mooney * This file and its contents are supplied under the terms of the
4*263f549eSPatrick Mooney * Common Development and Distribution License ("CDDL"), version 1.0.
5*263f549eSPatrick Mooney * You may only use this file in accordance with the terms of version
6*263f549eSPatrick Mooney * 1.0 of the CDDL.
7*263f549eSPatrick Mooney *
8*263f549eSPatrick Mooney * A full copy of the text of the CDDL should have accompanied this
9*263f549eSPatrick Mooney * source.  A copy of the CDDL is also available via the Internet at
10*263f549eSPatrick Mooney * http://www.illumos.org/license/CDDL.
11*263f549eSPatrick Mooney */
12*263f549eSPatrick Mooney
13*263f549eSPatrick Mooney/*
14*263f549eSPatrick Mooney * Copyright 2016 Joyent, Inc.
15*263f549eSPatrick Mooney */
16*263f549eSPatrick Mooney
17*263f549eSPatrick Mooney#include <sys/asm_linkage.h>
18*263f549eSPatrick Mooney#include <sys/asm_misc.h>
19*263f549eSPatrick Mooney#include <sys/param.h>
20*263f549eSPatrick Mooney#include <sys/comm_page.h>
21*263f549eSPatrick Mooney#include <sys/tsc.h>
22*263f549eSPatrick Mooney
23*263f549eSPatrick Mooney#if defined(_GENCTF) || defined(__lint)
24*263f549eSPatrick Mooney
25*263f549eSPatrick Mooneyhrtime_t tsc_last;
26*263f549eSPatrick Mooneyhrtime_t tsc_resume_cap;
27*263f549eSPatrick Mooneyhrtime_t tsc_hrtime_base;
28*263f549eSPatrick Mooneyuint32_t tsc_max_delta;
29*263f549eSPatrick Mooneyvolatile uint32_t hres_lock;
30*263f549eSPatrick Mooneyuint32_t tsc_type;
31*263f549eSPatrick Mooneyuint32_t nsec_scale;
32*263f549eSPatrick Mooneyint64_t hrestime_adj;
33*263f549eSPatrick Mooneyhrtime_t hres_last_tick;
34*263f549eSPatrick Mooneyuint32_t tsc_ncpu;
35*263f549eSPatrick Mooneyvolatile timestruc_t hrestime;
36*263f549eSPatrick Mooneyhrtime_t tsc_sync_tick_delta[NCPU];
37*263f549eSPatrick Mooney
38*263f549eSPatrick Mooneycomm_page_t comm_page;
39*263f549eSPatrick Mooney
40*263f549eSPatrick Mooney#else /* defined(_GENCTF) || defined(__lint) */
41*263f549eSPatrick Mooney
42*263f549eSPatrick Mooney#include "assym.h"
43*263f549eSPatrick Mooney
44*263f549eSPatrick Mooney/*
45*263f549eSPatrick Mooney * x86 Comm Page
46*263f549eSPatrick Mooney *
47*263f549eSPatrick Mooney * This is the definition for the comm page on x86.  The purpose of this struct
48*263f549eSPatrick Mooney * is to consolidate certain pieces of kernel state into one contiguous section
49*263f549eSPatrick Mooney * of memory in order for it to be exposed (read-only) to userspace.  The
50*263f549eSPatrick Mooney * struct contents are defined by hand so that member variables will maintain
51*263f549eSPatrick Mooney * their original symbols for use throughout the rest of the kernel.  This
52*263f549eSPatrick Mooney * layout must exactly match the C definition of comm_page_t.
53*263f549eSPatrick Mooney * See: "uts/i86pc/sys/comm_page.h"
54*263f549eSPatrick Mooney */
55*263f549eSPatrick Mooney
56*263f549eSPatrick Mooney	.data
57*263f549eSPatrick Mooney	DGDEF3(comm_page, COMM_PAGE_S_SIZE, 4096)
58*263f549eSPatrick Mooney	DGDEF2(tsc_last, 8)
59*263f549eSPatrick Mooney	.fill	1, 8, 0
60*263f549eSPatrick Mooney	DGDEF2(tsc_hrtime_base, 8)
61*263f549eSPatrick Mooney	.fill	1, 8, 0
62*263f549eSPatrick Mooney	DGDEF2(tsc_resume_cap, 8)
63*263f549eSPatrick Mooney	.fill	1, 8, 0
64*263f549eSPatrick Mooney	DGDEF2(tsc_type, 4);
65*263f549eSPatrick Mooney	.fill	1, 4, _CONST(TSC_RDTSC_CPUID)
66*263f549eSPatrick Mooney	DGDEF2(tsc_max_delta, 4);
67*263f549eSPatrick Mooney	.fill	1, 4, 0
68*263f549eSPatrick Mooney	DGDEF2(hres_lock, 4);
69*263f549eSPatrick Mooney	.fill	1, 4, 0
70*263f549eSPatrick Mooney	DGDEF2(nsec_scale, 4);
71*263f549eSPatrick Mooney	.fill	1, 4, 0
72*263f549eSPatrick Mooney	DGDEF2(hrestime_adj, 8)
73*263f549eSPatrick Mooney	.fill	1, 8, 0
74*263f549eSPatrick Mooney	DGDEF2(hres_last_tick, 8)
75*263f549eSPatrick Mooney	.fill	1, 8, 0
76*263f549eSPatrick Mooney	DGDEF2(tsc_ncpu, 4)
77*263f549eSPatrick Mooney	.fill	1, 4, 0
78*263f549eSPatrick Mooney	/* _cp_pad */
79*263f549eSPatrick Mooney	.fill	1, 4, 0
80*263f549eSPatrick Mooney	DGDEF2(hrestime, _MUL(2, 8))
81*263f549eSPatrick Mooney	.fill	2, 8, 0
82*263f549eSPatrick Mooney	DGDEF2(tsc_sync_tick_delta, _MUL(NCPU, 8))
83*263f549eSPatrick Mooney	.fill	_CONST(NCPU), 8, 0
84*263f549eSPatrick Mooney
85*263f549eSPatrick Mooney	/* pad out the rest of the page from the struct end */
86*263f549eSPatrick Mooney	.fill	_CONST(COMM_PAGE_SIZE - COMM_PAGE_S_SIZE), 1, 0
87*263f549eSPatrick Mooney
88*263f549eSPatrick Mooney#endif /* defined(_GENCTF) || defined(__lint) */
89