10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _VM_SEG_KP_H
28 #define _VM_SEG_KP_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 /*
33 * segkp (as in kernel pageable) is a segment driver that supports allocation
34 * of page-aligned variable size of vm resources.
35 *
36 * Each vm resource represents a page-aligned range of virtual addresses.
37 * The caller may specify whether the resource should include a redzone,
38 * be locked down, or be zero initialized.
39 */
40
41 #include <vm/seg.h>
42 #include <sys/vmem.h>
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 #ifdef _KERNEL
49
50 /*
51 * Private information per overall segkp segment (as opposed
126
127 #define SEGKP_MAPLEN(len, flags) \
128 (((flags) & KPD_HASREDZONE) ? (len) - PAGESIZE : (len))
129
130 extern struct seg *segkp;
131 /* If segkp becomes more than one seg this test will need changing. */
132 #define SEG_IS_SEGKP(SEG) ((SEG) == segkp)
133
134 /*
135 * Public routine declarations not part of the segment ops vector go here.
136 */
137 int segkp_create(struct seg *seg);
138 caddr_t segkp_get(struct seg *seg, size_t len, uint_t flags);
139 void segkp_release(struct seg *seg, caddr_t vaddr);
140 void * segkp_cache_init(struct seg *seg, int maxsize, size_t len,
141 uint_t flags);
142 void segkp_cache_free();
143 caddr_t segkp_cache_get(void *cookie);
144 int segkp_map_red(void);
145 void segkp_unmap_red(void);
146 size_t swapsize(caddr_t v);
147
148 /* Special currently only used by schedctl. */
149 struct anon_map; /* Make the compiler happy about the next line. */
150 caddr_t segkp_get_withanonmap(struct seg *, size_t, uint_t, struct anon_map *);
151
152 /*
153 * We allow explicit calls to segkp_fault, even though it's part
154 * of the segkp ops vector.
155 */
156 faultcode_t segkp_fault(struct hat *hat, struct seg *seg, caddr_t addr,
157 size_t len, enum fault_type type, enum seg_rw rw);
158
159 #endif /* _KERNEL */
160
161 #ifdef __cplusplus
162 }
163 #endif
164
165 #endif /* _VM_SEG_KP_H */
|
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _VM_SEG_KP_H
28 #define _VM_SEG_KP_H
29
30 /*
31 * segkp (as in kernel pageable) is a segment driver that supports allocation
32 * of page-aligned variable size of vm resources.
33 *
34 * Each vm resource represents a page-aligned range of virtual addresses.
35 * The caller may specify whether the resource should include a redzone,
36 * be locked down, or be zero initialized.
37 */
38
39 #include <vm/seg.h>
40 #include <sys/vmem.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 #ifdef _KERNEL
47
48 /*
49 * Private information per overall segkp segment (as opposed
124
125 #define SEGKP_MAPLEN(len, flags) \
126 (((flags) & KPD_HASREDZONE) ? (len) - PAGESIZE : (len))
127
128 extern struct seg *segkp;
129 /* If segkp becomes more than one seg this test will need changing. */
130 #define SEG_IS_SEGKP(SEG) ((SEG) == segkp)
131
132 /*
133 * Public routine declarations not part of the segment ops vector go here.
134 */
135 int segkp_create(struct seg *seg);
136 caddr_t segkp_get(struct seg *seg, size_t len, uint_t flags);
137 void segkp_release(struct seg *seg, caddr_t vaddr);
138 void * segkp_cache_init(struct seg *seg, int maxsize, size_t len,
139 uint_t flags);
140 void segkp_cache_free();
141 caddr_t segkp_cache_get(void *cookie);
142 int segkp_map_red(void);
143 void segkp_unmap_red(void);
144
145 /* Special currently only used by schedctl. */
146 struct anon_map; /* Make the compiler happy about the next line. */
147 caddr_t segkp_get_withanonmap(struct seg *, size_t, uint_t, struct anon_map *);
148
149 /*
150 * We allow explicit calls to segkp_fault, even though it's part
151 * of the segkp ops vector.
152 */
153 faultcode_t segkp_fault(struct hat *hat, struct seg *seg, caddr_t addr,
154 size_t len, enum fault_type type, enum seg_rw rw);
155
156 #endif /* _KERNEL */
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162 #endif /* _VM_SEG_KP_H */
|