xref: /illumos-gate/usr/src/uts/common/vm/as.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28*7c478bd9Sstevel@tonic-gate /*	 All Rights Reserved   */
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate  * contributors.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #ifndef	_VM_AS_H
41*7c478bd9Sstevel@tonic-gate #define	_VM_AS_H
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #include <sys/watchpoint.h>
46*7c478bd9Sstevel@tonic-gate #include <vm/seg.h>
47*7c478bd9Sstevel@tonic-gate #include <vm/faultcode.h>
48*7c478bd9Sstevel@tonic-gate #include <vm/hat.h>
49*7c478bd9Sstevel@tonic-gate #include <sys/avl.h>
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
52*7c478bd9Sstevel@tonic-gate extern "C" {
53*7c478bd9Sstevel@tonic-gate #endif
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * VM - Address spaces.
57*7c478bd9Sstevel@tonic-gate  */
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate /*
60*7c478bd9Sstevel@tonic-gate  * Each address space consists of a sorted list of segments
61*7c478bd9Sstevel@tonic-gate  * and machine dependent address translation information.
62*7c478bd9Sstevel@tonic-gate  *
63*7c478bd9Sstevel@tonic-gate  * All the hard work is in the segment drivers and the
64*7c478bd9Sstevel@tonic-gate  * hardware address translation code.
65*7c478bd9Sstevel@tonic-gate  *
66*7c478bd9Sstevel@tonic-gate  * The segment list is represented as an AVL tree.
67*7c478bd9Sstevel@tonic-gate  *
68*7c478bd9Sstevel@tonic-gate  * The address space lock (a_lock) is a long term lock which serializes
69*7c478bd9Sstevel@tonic-gate  * access to certain operations (as_map, as_unmap) and protects the
70*7c478bd9Sstevel@tonic-gate  * underlying generic segment data (seg.h) along with some fields in the
71*7c478bd9Sstevel@tonic-gate  * address space structure as shown below:
72*7c478bd9Sstevel@tonic-gate  *
73*7c478bd9Sstevel@tonic-gate  *	address space structure 	segment structure
74*7c478bd9Sstevel@tonic-gate  *
75*7c478bd9Sstevel@tonic-gate  *	a_segtree			s_base
76*7c478bd9Sstevel@tonic-gate  *	a_size				s_size
77*7c478bd9Sstevel@tonic-gate  *	a_lastgap			s_link
78*7c478bd9Sstevel@tonic-gate  *	a_seglast			s_ops
79*7c478bd9Sstevel@tonic-gate  *					s_as
80*7c478bd9Sstevel@tonic-gate  *					s_data
81*7c478bd9Sstevel@tonic-gate  *
82*7c478bd9Sstevel@tonic-gate  * The address space contents lock (a_contents) is a short term
83*7c478bd9Sstevel@tonic-gate  * lock that protects most of the data in the address space structure.
84*7c478bd9Sstevel@tonic-gate  * This lock is always acquired after the "a_lock" in all situations
85*7c478bd9Sstevel@tonic-gate  * except while dealing with AS_CLAIMGAP to avoid deadlocks.
86*7c478bd9Sstevel@tonic-gate  *
87*7c478bd9Sstevel@tonic-gate  * The following fields are protected by this lock:
88*7c478bd9Sstevel@tonic-gate  *
89*7c478bd9Sstevel@tonic-gate  *	a_flags (AS_PAGLCK, AS_CLAIMGAP, etc.)
90*7c478bd9Sstevel@tonic-gate  *	a_unmapwait
91*7c478bd9Sstevel@tonic-gate  *	a_seglast
92*7c478bd9Sstevel@tonic-gate  *
93*7c478bd9Sstevel@tonic-gate  * The address space lock (a_lock) is always held prior to any segment
94*7c478bd9Sstevel@tonic-gate  * operation.  Some segment drivers use the address space lock to protect
95*7c478bd9Sstevel@tonic-gate  * some or all of their segment private data, provided the version of
96*7c478bd9Sstevel@tonic-gate  * "a_lock" (read vs. write) is consistent with the use of the data.
97*7c478bd9Sstevel@tonic-gate  *
98*7c478bd9Sstevel@tonic-gate  * The following fields are protected by the hat layer lock:
99*7c478bd9Sstevel@tonic-gate  *
100*7c478bd9Sstevel@tonic-gate  *	a_vbits
101*7c478bd9Sstevel@tonic-gate  *	a_hat
102*7c478bd9Sstevel@tonic-gate  *	a_hrm
103*7c478bd9Sstevel@tonic-gate  */
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate struct as {
106*7c478bd9Sstevel@tonic-gate 	kmutex_t a_contents;	/* protect certain fields in the structure */
107*7c478bd9Sstevel@tonic-gate 	uchar_t  a_flags;	/* as attributes */
108*7c478bd9Sstevel@tonic-gate 	uchar_t	a_vbits;	/* used for collecting statistics */
109*7c478bd9Sstevel@tonic-gate 	kcondvar_t a_cv;	/* used by as_rangelock */
110*7c478bd9Sstevel@tonic-gate 	struct	hat *a_hat;	/* hat structure */
111*7c478bd9Sstevel@tonic-gate 	struct	hrmstat *a_hrm; /* ref and mod bits */
112*7c478bd9Sstevel@tonic-gate 	caddr_t	a_userlimit;	/* highest allowable address in this as */
113*7c478bd9Sstevel@tonic-gate 	struct seg *a_seglast;	/* last segment hit on the addr space */
114*7c478bd9Sstevel@tonic-gate 	krwlock_t a_lock;	/* protects segment related fields */
115*7c478bd9Sstevel@tonic-gate 	size_t	a_size;		/* size of address space */
116*7c478bd9Sstevel@tonic-gate 	struct seg *a_lastgap;	/* last seg found by as_gap() w/ AS_HI (mmap) */
117*7c478bd9Sstevel@tonic-gate 	struct seg *a_lastgaphl; /* last seg saved in as_gap() either for */
118*7c478bd9Sstevel@tonic-gate 				/* AS_HI or AS_LO used in as_addseg() */
119*7c478bd9Sstevel@tonic-gate 	avl_tree_t a_segtree;	/* segments in this address space. (AVL tree) */
120*7c478bd9Sstevel@tonic-gate 	avl_tree_t a_wpage;	/* watched pages (procfs) */
121*7c478bd9Sstevel@tonic-gate 	uchar_t	a_updatedir;	/* mappings changed, rebuild a_objectdir */
122*7c478bd9Sstevel@tonic-gate 	timespec_t a_updatetime;	/* time when mappings last changed */
123*7c478bd9Sstevel@tonic-gate 	vnode_t	**a_objectdir;	/* object directory (procfs) */
124*7c478bd9Sstevel@tonic-gate 	size_t	a_sizedir;	/* size of object directory */
125*7c478bd9Sstevel@tonic-gate 	struct as_callback *a_callbacks; /* callback list */
126*7c478bd9Sstevel@tonic-gate 	void *a_xhat;		/* list of xhat providers */
127*7c478bd9Sstevel@tonic-gate };
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #define	AS_PAGLCK		0x80
130*7c478bd9Sstevel@tonic-gate #define	AS_CLAIMGAP		0x40
131*7c478bd9Sstevel@tonic-gate #define	AS_UNMAPWAIT		0x20
132*7c478bd9Sstevel@tonic-gate #define	AS_NEEDSPURGE		0x10	/* mostly for seg_nf, see as_purge() */
133*7c478bd9Sstevel@tonic-gate #define	AS_BUSY			0x01	/* needed by XHAT framework */
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate #define	AS_ISPGLCK(as)		((as)->a_flags & AS_PAGLCK)
136*7c478bd9Sstevel@tonic-gate #define	AS_ISCLAIMGAP(as)	((as)->a_flags & AS_CLAIMGAP)
137*7c478bd9Sstevel@tonic-gate #define	AS_ISUNMAPWAIT(as)	((as)->a_flags & AS_UNMAPWAIT)
138*7c478bd9Sstevel@tonic-gate #define	AS_ISBUSY(as)		((as)->a_flags & AS_BUSY)
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate #define	AS_SETPGLCK(as)		((as)->a_flags |= AS_PAGLCK)
142*7c478bd9Sstevel@tonic-gate #define	AS_SETCLAIMGAP(as)	((as)->a_flags |= AS_CLAIMGAP)
143*7c478bd9Sstevel@tonic-gate #define	AS_SETUNMAPWAIT(as)	((as)->a_flags |= AS_UNMAPWAIT)
144*7c478bd9Sstevel@tonic-gate #define	AS_SETBUSY(as)		((as)->a_flags |= AS_BUSY)
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #define	AS_CLRPGLCK(as)		((as)->a_flags &= ~AS_PAGLCK)
147*7c478bd9Sstevel@tonic-gate #define	AS_CLRCLAIMGAP(as)	((as)->a_flags &= ~AS_CLAIMGAP)
148*7c478bd9Sstevel@tonic-gate #define	AS_CLRUNMAPWAIT(as)	((as)->a_flags &= ~AS_UNMAPWAIT)
149*7c478bd9Sstevel@tonic-gate #define	AS_CLRBUSY(as)		((as)->a_flags &= ~AS_BUSY)
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate #define	AS_TYPE_64BIT(as)	\
152*7c478bd9Sstevel@tonic-gate 	    (((as)->a_userlimit > (caddr_t)UINT32_MAX) ? 1 : 0)
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate /*
155*7c478bd9Sstevel@tonic-gate  * The as_callback is the basic structure which supports the ability to
156*7c478bd9Sstevel@tonic-gate  * inform clients of specific events pertaining to address space management.
157*7c478bd9Sstevel@tonic-gate  * A user calls as_add_callback to register an address space callback
158*7c478bd9Sstevel@tonic-gate  * for a range of pages, specifying the events that need to occur.
159*7c478bd9Sstevel@tonic-gate  * When as_do_callbacks is called and finds a 'matching' entry, the
160*7c478bd9Sstevel@tonic-gate  * callback is called once, and the callback function MUST call
161*7c478bd9Sstevel@tonic-gate  * as_delete_callback when all callback activities are complete.
162*7c478bd9Sstevel@tonic-gate  * The thread calling as_do_callbacks blocks until the as_delete_callback
163*7c478bd9Sstevel@tonic-gate  * is called.  This allows for asynchorous events to subside before the
164*7c478bd9Sstevel@tonic-gate  * as_do_callbacks thread continues.
165*7c478bd9Sstevel@tonic-gate  *
166*7c478bd9Sstevel@tonic-gate  * An example of the need for this is a driver which has done long-term
167*7c478bd9Sstevel@tonic-gate  * locking of memory.  Address space management operations (events) such
168*7c478bd9Sstevel@tonic-gate  * as as_free, as_umap, and as_setprot will block indefinitely until the
169*7c478bd9Sstevel@tonic-gate  * pertinent memory is unlocked.  The callback mechanism provides the
170*7c478bd9Sstevel@tonic-gate  * way to inform the driver of the event so that the driver may do the
171*7c478bd9Sstevel@tonic-gate  * necessary unlocking.
172*7c478bd9Sstevel@tonic-gate  *
173*7c478bd9Sstevel@tonic-gate  * The contents of this structure is protected by a_contents lock
174*7c478bd9Sstevel@tonic-gate  */
175*7c478bd9Sstevel@tonic-gate typedef void (*callback_func_t)(struct as *, void *, uint_t);
176*7c478bd9Sstevel@tonic-gate struct as_callback {
177*7c478bd9Sstevel@tonic-gate 	struct as_callback	*ascb_next;		/* list link */
178*7c478bd9Sstevel@tonic-gate 	uint_t			ascb_events;		/* event types */
179*7c478bd9Sstevel@tonic-gate 	callback_func_t		ascb_func;   		/* callback function */
180*7c478bd9Sstevel@tonic-gate 	void			*ascb_arg;		/* callback argument */
181*7c478bd9Sstevel@tonic-gate 	caddr_t			ascb_saddr;		/* start address */
182*7c478bd9Sstevel@tonic-gate 	size_t			ascb_len;		/* address range */
183*7c478bd9Sstevel@tonic-gate };
184*7c478bd9Sstevel@tonic-gate /*
185*7c478bd9Sstevel@tonic-gate  * Callback events
186*7c478bd9Sstevel@tonic-gate  */
187*7c478bd9Sstevel@tonic-gate #define	AS_FREE_EVENT		0x1
188*7c478bd9Sstevel@tonic-gate #define	AS_SETPROT_EVENT	0x2
189*7c478bd9Sstevel@tonic-gate #define	AS_UNMAP_EVENT		0x4
190*7c478bd9Sstevel@tonic-gate #define	AS_CALLBACK_CALLED	((uint_t)(1U << (8 * sizeof (uint_t) - 1U)))
191*7c478bd9Sstevel@tonic-gate #define	AS_UNMAPWAIT_EVENT				\
192*7c478bd9Sstevel@tonic-gate 		(AS_FREE_EVENT | AS_SETPROT_EVENT | AS_UNMAP_EVENT)
193*7c478bd9Sstevel@tonic-gate #define	AS_ALL_EVENT					\
194*7c478bd9Sstevel@tonic-gate 		(AS_FREE_EVENT | AS_SETPROT_EVENT | AS_UNMAP_EVENT)
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate /* Return code values for as_callback_delete */
198*7c478bd9Sstevel@tonic-gate enum as_cbdelete_rc {
199*7c478bd9Sstevel@tonic-gate 	AS_CALLBACK_DELETED,
200*7c478bd9Sstevel@tonic-gate 	AS_CALLBACK_NOTFOUND,
201*7c478bd9Sstevel@tonic-gate 	AS_CALLBACK_DELETE_DEFERRED
202*7c478bd9Sstevel@tonic-gate };
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate /*
207*7c478bd9Sstevel@tonic-gate  * Flags for as_gap.
208*7c478bd9Sstevel@tonic-gate  */
209*7c478bd9Sstevel@tonic-gate #define	AH_DIR		0x1	/* direction flag mask */
210*7c478bd9Sstevel@tonic-gate #define	AH_LO		0x0	/* find lowest hole */
211*7c478bd9Sstevel@tonic-gate #define	AH_HI		0x1	/* find highest hole */
212*7c478bd9Sstevel@tonic-gate #define	AH_CONTAIN	0x2	/* hole must contain `addr' */
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate extern struct as kas;		/* kernel's address space */
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate /*
217*7c478bd9Sstevel@tonic-gate  * Macros for address space locking.
218*7c478bd9Sstevel@tonic-gate  */
219*7c478bd9Sstevel@tonic-gate #define	AS_LOCK_ENTER(as, lock, type)		rw_enter((lock), (type))
220*7c478bd9Sstevel@tonic-gate #define	AS_LOCK_EXIT(as, lock)			rw_exit((lock))
221*7c478bd9Sstevel@tonic-gate #define	AS_LOCK_DESTROY(as, lock)		rw_destroy((lock))
222*7c478bd9Sstevel@tonic-gate #define	AS_LOCK_TRYENTER(as, lock, type)	rw_tryenter((lock), (type))
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate /*
225*7c478bd9Sstevel@tonic-gate  * Macros to test lock states.
226*7c478bd9Sstevel@tonic-gate  */
227*7c478bd9Sstevel@tonic-gate #define	AS_LOCK_HELD(as, lock)		RW_LOCK_HELD((lock))
228*7c478bd9Sstevel@tonic-gate #define	AS_READ_HELD(as, lock)		RW_READ_HELD((lock))
229*7c478bd9Sstevel@tonic-gate #define	AS_WRITE_HELD(as, lock)		RW_WRITE_HELD((lock))
230*7c478bd9Sstevel@tonic-gate 
231*7c478bd9Sstevel@tonic-gate /*
232*7c478bd9Sstevel@tonic-gate  * macros to walk thru segment lists
233*7c478bd9Sstevel@tonic-gate  */
234*7c478bd9Sstevel@tonic-gate #define	AS_SEGFIRST(as)		avl_first(&(as)->a_segtree)
235*7c478bd9Sstevel@tonic-gate #define	AS_SEGNEXT(as, seg)	AVL_NEXT(&(as)->a_segtree, (seg))
236*7c478bd9Sstevel@tonic-gate #define	AS_SEGPREV(as, seg)	AVL_PREV(&(as)->a_segtree, (seg))
237*7c478bd9Sstevel@tonic-gate 
238*7c478bd9Sstevel@tonic-gate void	as_init(void);
239*7c478bd9Sstevel@tonic-gate void	as_avlinit(struct as *);
240*7c478bd9Sstevel@tonic-gate struct	seg *as_segat(struct as *as, caddr_t addr);
241*7c478bd9Sstevel@tonic-gate void	as_rangelock(struct as *as);
242*7c478bd9Sstevel@tonic-gate void	as_rangeunlock(struct as *as);
243*7c478bd9Sstevel@tonic-gate struct	as *as_alloc(void);
244*7c478bd9Sstevel@tonic-gate void	as_free(struct as *as);
245*7c478bd9Sstevel@tonic-gate int	as_dup(struct as *as, struct as **outas);
246*7c478bd9Sstevel@tonic-gate struct	seg *as_findseg(struct as *as, caddr_t addr, int tail);
247*7c478bd9Sstevel@tonic-gate int	as_addseg(struct as *as, struct seg *newseg);
248*7c478bd9Sstevel@tonic-gate struct	seg *as_removeseg(struct as *as, struct seg *seg);
249*7c478bd9Sstevel@tonic-gate faultcode_t as_fault(struct hat *hat, struct as *as, caddr_t addr, size_t size,
250*7c478bd9Sstevel@tonic-gate 		enum fault_type type, enum seg_rw rw);
251*7c478bd9Sstevel@tonic-gate faultcode_t as_faulta(struct as *as, caddr_t addr, size_t size);
252*7c478bd9Sstevel@tonic-gate int	as_setprot(struct as *as, caddr_t addr, size_t size, uint_t prot);
253*7c478bd9Sstevel@tonic-gate int	as_checkprot(struct as *as, caddr_t addr, size_t size, uint_t prot);
254*7c478bd9Sstevel@tonic-gate int	as_unmap(struct as *as, caddr_t addr, size_t size);
255*7c478bd9Sstevel@tonic-gate int	as_map(struct as *as, caddr_t addr, size_t size, int ((*crfp)()),
256*7c478bd9Sstevel@tonic-gate 		void *argsp);
257*7c478bd9Sstevel@tonic-gate void	as_purge(struct as *as);
258*7c478bd9Sstevel@tonic-gate int	as_gap(struct as *as, size_t minlen, caddr_t *basep, size_t *lenp,
259*7c478bd9Sstevel@tonic-gate 		uint_t flags, caddr_t addr);
260*7c478bd9Sstevel@tonic-gate int	as_memory(struct as *as, caddr_t *basep, size_t *lenp);
261*7c478bd9Sstevel@tonic-gate size_t	as_swapout(struct as *as);
262*7c478bd9Sstevel@tonic-gate int	as_incore(struct as *as, caddr_t addr, size_t size, char *vec,
263*7c478bd9Sstevel@tonic-gate 		size_t *sizep);
264*7c478bd9Sstevel@tonic-gate int	as_ctl(struct as *as, caddr_t addr, size_t size, int func, int attr,
265*7c478bd9Sstevel@tonic-gate 		uintptr_t arg, ulong_t *lock_map, size_t pos);
266*7c478bd9Sstevel@tonic-gate int	as_exec(struct as *oas, caddr_t ostka, size_t stksz,
267*7c478bd9Sstevel@tonic-gate 		struct as *nas, caddr_t nstka, uint_t hatflag);
268*7c478bd9Sstevel@tonic-gate int	as_pagelock(struct as *as, struct page ***ppp, caddr_t addr,
269*7c478bd9Sstevel@tonic-gate 		size_t size, enum seg_rw rw);
270*7c478bd9Sstevel@tonic-gate void	as_pageunlock(struct as *as, struct page **pp, caddr_t addr,
271*7c478bd9Sstevel@tonic-gate 		size_t size, enum seg_rw rw);
272*7c478bd9Sstevel@tonic-gate void	as_pagereclaim(struct as *as, struct page **pp, caddr_t addr,
273*7c478bd9Sstevel@tonic-gate 		size_t size, enum seg_rw rw);
274*7c478bd9Sstevel@tonic-gate int	as_setpagesize(struct as *as, caddr_t addr, size_t size, uint_t szc,
275*7c478bd9Sstevel@tonic-gate 		boolean_t wait);
276*7c478bd9Sstevel@tonic-gate void	as_setwatch(struct as *as);
277*7c478bd9Sstevel@tonic-gate void	as_clearwatch(struct as *as);
278*7c478bd9Sstevel@tonic-gate int	as_getmemid(struct as *, caddr_t, memid_t *);
279*7c478bd9Sstevel@tonic-gate 
280*7c478bd9Sstevel@tonic-gate int	as_add_callback(struct as *, void (*)(), void *, uint_t,
281*7c478bd9Sstevel@tonic-gate 			caddr_t, size_t, int);
282*7c478bd9Sstevel@tonic-gate uint_t	as_delete_callback(struct as *, void *);
283*7c478bd9Sstevel@tonic-gate 
284*7c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
287*7c478bd9Sstevel@tonic-gate }
288*7c478bd9Sstevel@tonic-gate #endif
289*7c478bd9Sstevel@tonic-gate 
290*7c478bd9Sstevel@tonic-gate #endif	/* _VM_AS_H */
291