pkg: ship usr/lib/security/amd64/*.so links
[unleashed.git] / include / vm / seg_dev.h
blob5084a7b4bb21661a0ef037500eda4a535455f942
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2018 Joyent, Inc.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
40 #ifndef _VM_SEG_DEV_H
41 #define _VM_SEG_DEV_H
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 struct proc;
50 * Structure whose pointer is passed to the segdev_create routine
52 struct segdev_crargs {
53 offset_t offset; /* starting offset */
54 int (*mapfunc)(dev_t dev, off_t off, int prot); /* map function */
55 dev_t dev; /* device number */
56 uchar_t type; /* type of sharing done */
57 uchar_t prot; /* protection */
58 uchar_t maxprot; /* maximum protection */
59 uint_t hat_attr; /* hat attr */
60 uint_t hat_flags; /* currently, hat_flags is used ONLY for */
61 /* HAT_LOAD_NOCONSIST; in future, it can be */
62 /* expanded to include any flags that are */
63 /* not already part of hat_attr */
64 void *devmap_data; /* devmap_handle private data */
68 * (Semi) private data maintained by the seg_dev driver per segment mapping
70 * The segment lock is necessary to protect fields that are modified
71 * when the "read" version of the address space lock is held. This lock
72 * is not needed when the segment operation has the "write" version of
73 * the address space lock (it would be redundant).
75 * The following fields in segdev_data are read-only when the address
76 * space is "read" locked, and don't require the segment lock:
78 * vp
79 * offset
80 * mapfunc
81 * maxprot
83 struct segdev_data {
84 offset_t offset; /* device offset for start of mapping */
85 krwlock_t lock; /* protects segdev_data */
86 int (*mapfunc)(dev_t dev, off_t off, int prot);
87 struct vnode *vp; /* vnode associated with device */
88 uchar_t pageprot; /* true if per page protections present */
89 uchar_t prot; /* current segment prot if pageprot == 0 */
90 uchar_t maxprot; /* maximum segment protections */
91 uchar_t type; /* type of sharing done */
92 struct vpage *vpage; /* per-page information, if needed */
93 uint_t hat_attr; /* hat attr - pass to attr in hat_devload */
94 uint_t hat_flags; /* set HAT_LOAD_NOCONSIST flag in hat_devload */
95 /* see comments above in segdev_crargs */
96 size_t softlockcnt; /* # of SOFTLOCKED in seg */
97 void *devmap_data; /* devmap_handle private data */
100 /* Direct physical-userland mapping, without occupying kernel address space */
101 #define DEVMAP_PMEM_COOKIE ((ddi_umem_cookie_t)0x2)
104 * pmem_cookie:
105 * Records physical memory pages to be exported to userland.
107 struct devmap_pmem_cookie {
108 pgcnt_t dp_npages; /* number of allocated mem pages */
109 page_t **dp_pparray; /* pages allocated for this cookie */
110 vnode_t *dp_vnp; /* vnode associated with this cookie */
111 proc_t *dp_proc; /* proc ptr for resource control */
114 #ifdef _KERNEL
117 * Mappings of /dev/null come from segdev and have no mapping type.
120 #define SEG_IS_DEVNULL_MAPPING(seg) \
121 ((seg)->s_ops == &segdev_ops && \
122 ((segop_gettype((seg), (seg)->s_base) & \
123 (MAP_SHARED | MAP_PRIVATE)) == 0))
125 extern void segdev_init(void);
127 extern int segdev_create(struct seg **, void *);
129 extern int segdev_copyto(struct seg *, caddr_t, const void *, void *, size_t);
130 extern int segdev_copyfrom(struct seg *, caddr_t, const void *, void *, size_t);
131 extern const struct seg_ops segdev_ops;
133 #endif /* _KERNEL */
135 #ifdef __cplusplus
137 #endif
139 #endif /* _VM_SEG_DEV_H */