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.
17 #include <sys/types.h>
18 #include <sys/thread.h>
21 #include <sys/vmsystm.h>
23 #include <vm/seg_umap.h>
25 #include <sys/comm_page.h>
28 * Map in the comm page.
30 * The contents of the comm page are only defined on non-xpv x86 at this time.
31 * Furthermore, the data is only valid in userspace (32-bit or 64-bit) when
32 * mapped from a 64-bit kernel.
33 * See: "uts/i86pc/sys/comm_page.h"
38 #if defined(__amd64) && !defined(__xpv)
41 size_t len
= COMM_PAGE_SIZE
;
42 uint_t prot
= PROT_USER
| PROT_READ
;
43 segumap_crargs_t suarg
;
45 map_addr(&addr
, len
, (offset_t
)0, 1, 0);
46 if (addr
== NULL
|| valid_usr_range(addr
, len
, prot
, p
->p_as
,
47 p
->p_as
->a_userlimit
) != RANGE_OKAY
) {
51 suarg
.kaddr
= (caddr_t
)&comm_page
;
52 suarg
.prot
= suarg
.maxprot
= prot
;
53 if (as_map(p
->p_as
, addr
, len
, segumap_create
, &suarg
) != 0) {
57 #else /* defined(__amd64) && !defined(__xpv) */
59 #endif /* defined(__amd64) && !defined(__xpv) */