xref: /illumos-gate/usr/src/uts/common/vm/as.h (revision bb5ca623)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5c6939658Ssl  * Common Development and Distribution License (the "License").
6c6939658Ssl  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*bb5ca623SVamsi Nagineni  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
277c478bd9Sstevel@tonic-gate /*	 All Rights Reserved   */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
317c478bd9Sstevel@tonic-gate  * The Regents of the University of California
327c478bd9Sstevel@tonic-gate  * All Rights Reserved
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
357c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
367c478bd9Sstevel@tonic-gate  * contributors.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef	_VM_AS_H
407c478bd9Sstevel@tonic-gate #define	_VM_AS_H
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include <sys/watchpoint.h>
437c478bd9Sstevel@tonic-gate #include <vm/seg.h>
447c478bd9Sstevel@tonic-gate #include <vm/faultcode.h>
457c478bd9Sstevel@tonic-gate #include <vm/hat.h>
467c478bd9Sstevel@tonic-gate #include <sys/avl.h>
47c6939658Ssl #include <sys/proc.h>
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
507c478bd9Sstevel@tonic-gate extern "C" {
517c478bd9Sstevel@tonic-gate #endif
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * VM - Address spaces.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Each address space consists of a sorted list of segments
597c478bd9Sstevel@tonic-gate  * and machine dependent address translation information.
607c478bd9Sstevel@tonic-gate  *
617c478bd9Sstevel@tonic-gate  * All the hard work is in the segment drivers and the
627c478bd9Sstevel@tonic-gate  * hardware address translation code.
637c478bd9Sstevel@tonic-gate  *
647c478bd9Sstevel@tonic-gate  * The segment list is represented as an AVL tree.
657c478bd9Sstevel@tonic-gate  *
667c478bd9Sstevel@tonic-gate  * The address space lock (a_lock) is a long term lock which serializes
677c478bd9Sstevel@tonic-gate  * access to certain operations (as_map, as_unmap) and protects the
687c478bd9Sstevel@tonic-gate  * underlying generic segment data (seg.h) along with some fields in the
697c478bd9Sstevel@tonic-gate  * address space structure as shown below:
707c478bd9Sstevel@tonic-gate  *
717c478bd9Sstevel@tonic-gate  *	address space structure 	segment structure
727c478bd9Sstevel@tonic-gate  *
737c478bd9Sstevel@tonic-gate  *	a_segtree			s_base
747c478bd9Sstevel@tonic-gate  *	a_size				s_size
757c478bd9Sstevel@tonic-gate  *	a_lastgap			s_link
767c478bd9Sstevel@tonic-gate  *	a_seglast			s_ops
777c478bd9Sstevel@tonic-gate  *					s_as
787c478bd9Sstevel@tonic-gate  *					s_data
797c478bd9Sstevel@tonic-gate  *
807c478bd9Sstevel@tonic-gate  * The address space contents lock (a_contents) is a short term
817c478bd9Sstevel@tonic-gate  * lock that protects most of the data in the address space structure.
827c478bd9Sstevel@tonic-gate  * This lock is always acquired after the "a_lock" in all situations
837c478bd9Sstevel@tonic-gate  * except while dealing with AS_CLAIMGAP to avoid deadlocks.
847c478bd9Sstevel@tonic-gate  *
857c478bd9Sstevel@tonic-gate  * The following fields are protected by this lock:
867c478bd9Sstevel@tonic-gate  *
877c478bd9Sstevel@tonic-gate  *	a_flags (AS_PAGLCK, AS_CLAIMGAP, etc.)
887c478bd9Sstevel@tonic-gate  *	a_unmapwait
897c478bd9Sstevel@tonic-gate  *	a_seglast
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  * The address space lock (a_lock) is always held prior to any segment
927c478bd9Sstevel@tonic-gate  * operation.  Some segment drivers use the address space lock to protect
937c478bd9Sstevel@tonic-gate  * some or all of their segment private data, provided the version of
947c478bd9Sstevel@tonic-gate  * "a_lock" (read vs. write) is consistent with the use of the data.
957c478bd9Sstevel@tonic-gate  *
967c478bd9Sstevel@tonic-gate  * The following fields are protected by the hat layer lock:
977c478bd9Sstevel@tonic-gate  *
987c478bd9Sstevel@tonic-gate  *	a_vbits
997c478bd9Sstevel@tonic-gate  *	a_hat
1007c478bd9Sstevel@tonic-gate  *	a_hrm
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate struct as {
1047c478bd9Sstevel@tonic-gate 	kmutex_t a_contents;	/* protect certain fields in the structure */
1057c478bd9Sstevel@tonic-gate 	uchar_t  a_flags;	/* as attributes */
1067c478bd9Sstevel@tonic-gate 	uchar_t	a_vbits;	/* used for collecting statistics */
1077c478bd9Sstevel@tonic-gate 	kcondvar_t a_cv;	/* used by as_rangelock */
1087c478bd9Sstevel@tonic-gate 	struct	hat *a_hat;	/* hat structure */
1097c478bd9Sstevel@tonic-gate 	struct	hrmstat *a_hrm; /* ref and mod bits */
1107c478bd9Sstevel@tonic-gate 	caddr_t	a_userlimit;	/* highest allowable address in this as */
1117c478bd9Sstevel@tonic-gate 	struct seg *a_seglast;	/* last segment hit on the addr space */
1127c478bd9Sstevel@tonic-gate 	krwlock_t a_lock;	/* protects segment related fields */
1137c478bd9Sstevel@tonic-gate 	size_t	a_size;		/* size of address space */
1147c478bd9Sstevel@tonic-gate 	struct seg *a_lastgap;	/* last seg found by as_gap() w/ AS_HI (mmap) */
1157c478bd9Sstevel@tonic-gate 	struct seg *a_lastgaphl; /* last seg saved in as_gap() either for */
1167c478bd9Sstevel@tonic-gate 				/* AS_HI or AS_LO used in as_addseg() */
1177c478bd9Sstevel@tonic-gate 	avl_tree_t a_segtree;	/* segments in this address space. (AVL tree) */
1187c478bd9Sstevel@tonic-gate 	avl_tree_t a_wpage;	/* watched pages (procfs) */
1197c478bd9Sstevel@tonic-gate 	uchar_t	a_updatedir;	/* mappings changed, rebuild a_objectdir */
1207c478bd9Sstevel@tonic-gate 	timespec_t a_updatetime;	/* time when mappings last changed */
1217c478bd9Sstevel@tonic-gate 	vnode_t	**a_objectdir;	/* object directory (procfs) */
1227c478bd9Sstevel@tonic-gate 	size_t	a_sizedir;	/* size of object directory */
1237c478bd9Sstevel@tonic-gate 	struct as_callback *a_callbacks; /* callback list */
1247c478bd9Sstevel@tonic-gate 	void *a_xhat;		/* list of xhat providers */
125c6939658Ssl 	proc_t	*a_proc;	/* back pointer to proc */
1267c478bd9Sstevel@tonic-gate };
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	AS_PAGLCK		0x80
1297c478bd9Sstevel@tonic-gate #define	AS_CLAIMGAP		0x40
1307c478bd9Sstevel@tonic-gate #define	AS_UNMAPWAIT		0x20
1317c478bd9Sstevel@tonic-gate #define	AS_NEEDSPURGE		0x10	/* mostly for seg_nf, see as_purge() */
132a98e9dbfSaguzovsk #define	AS_NOUNMAPWAIT		0x02
1337c478bd9Sstevel@tonic-gate #define	AS_BUSY			0x01	/* needed by XHAT framework */
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #define	AS_ISPGLCK(as)		((as)->a_flags & AS_PAGLCK)
1367c478bd9Sstevel@tonic-gate #define	AS_ISCLAIMGAP(as)	((as)->a_flags & AS_CLAIMGAP)
1377c478bd9Sstevel@tonic-gate #define	AS_ISUNMAPWAIT(as)	((as)->a_flags & AS_UNMAPWAIT)
1387c478bd9Sstevel@tonic-gate #define	AS_ISBUSY(as)		((as)->a_flags & AS_BUSY)
139a98e9dbfSaguzovsk #define	AS_ISNOUNMAPWAIT(as)	((as)->a_flags & AS_NOUNMAPWAIT)
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #define	AS_SETPGLCK(as)		((as)->a_flags |= AS_PAGLCK)
1427c478bd9Sstevel@tonic-gate #define	AS_SETCLAIMGAP(as)	((as)->a_flags |= AS_CLAIMGAP)
1437c478bd9Sstevel@tonic-gate #define	AS_SETUNMAPWAIT(as)	((as)->a_flags |= AS_UNMAPWAIT)
1447c478bd9Sstevel@tonic-gate #define	AS_SETBUSY(as)		((as)->a_flags |= AS_BUSY)
145a98e9dbfSaguzovsk #define	AS_SETNOUNMAPWAIT(as)	((as)->a_flags |= AS_NOUNMAPWAIT)
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate #define	AS_CLRPGLCK(as)		((as)->a_flags &= ~AS_PAGLCK)
1487c478bd9Sstevel@tonic-gate #define	AS_CLRCLAIMGAP(as)	((as)->a_flags &= ~AS_CLAIMGAP)
1497c478bd9Sstevel@tonic-gate #define	AS_CLRUNMAPWAIT(as)	((as)->a_flags &= ~AS_UNMAPWAIT)
1507c478bd9Sstevel@tonic-gate #define	AS_CLRBUSY(as)		((as)->a_flags &= ~AS_BUSY)
151a98e9dbfSaguzovsk #define	AS_CLRNOUNMAPWAIT(as)	((as)->a_flags &= ~AS_NOUNMAPWAIT)
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #define	AS_TYPE_64BIT(as)	\
1547c478bd9Sstevel@tonic-gate 	    (((as)->a_userlimit > (caddr_t)UINT32_MAX) ? 1 : 0)
1557c478bd9Sstevel@tonic-gate 
156ec25b48fSsusans /*
157ec25b48fSsusans  * Flags for as_map/as_map_ansegs
158ec25b48fSsusans  */
159ec25b48fSsusans #define	AS_MAP_NO_LPOOB		((uint_t)-1)
160ec25b48fSsusans #define	AS_MAP_HEAP		((uint_t)-2)
161ec25b48fSsusans #define	AS_MAP_STACK		((uint_t)-3)
162ec25b48fSsusans 
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate  * The as_callback is the basic structure which supports the ability to
1657c478bd9Sstevel@tonic-gate  * inform clients of specific events pertaining to address space management.
1667c478bd9Sstevel@tonic-gate  * A user calls as_add_callback to register an address space callback
1677c478bd9Sstevel@tonic-gate  * for a range of pages, specifying the events that need to occur.
1687c478bd9Sstevel@tonic-gate  * When as_do_callbacks is called and finds a 'matching' entry, the
1697c478bd9Sstevel@tonic-gate  * callback is called once, and the callback function MUST call
1707c478bd9Sstevel@tonic-gate  * as_delete_callback when all callback activities are complete.
1717c478bd9Sstevel@tonic-gate  * The thread calling as_do_callbacks blocks until the as_delete_callback
1727c478bd9Sstevel@tonic-gate  * is called.  This allows for asynchorous events to subside before the
1737c478bd9Sstevel@tonic-gate  * as_do_callbacks thread continues.
1747c478bd9Sstevel@tonic-gate  *
1757c478bd9Sstevel@tonic-gate  * An example of the need for this is a driver which has done long-term
1767c478bd9Sstevel@tonic-gate  * locking of memory.  Address space management operations (events) such
1777c478bd9Sstevel@tonic-gate  * as as_free, as_umap, and as_setprot will block indefinitely until the
1787c478bd9Sstevel@tonic-gate  * pertinent memory is unlocked.  The callback mechanism provides the
1797c478bd9Sstevel@tonic-gate  * way to inform the driver of the event so that the driver may do the
1807c478bd9Sstevel@tonic-gate  * necessary unlocking.
1817c478bd9Sstevel@tonic-gate  *
1827c478bd9Sstevel@tonic-gate  * The contents of this structure is protected by a_contents lock
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate typedef void (*callback_func_t)(struct as *, void *, uint_t);
1857c478bd9Sstevel@tonic-gate struct as_callback {
1867c478bd9Sstevel@tonic-gate 	struct as_callback	*ascb_next;		/* list link */
1877c478bd9Sstevel@tonic-gate 	uint_t			ascb_events;		/* event types */
1887c478bd9Sstevel@tonic-gate 	callback_func_t		ascb_func;   		/* callback function */
1897c478bd9Sstevel@tonic-gate 	void			*ascb_arg;		/* callback argument */
1907c478bd9Sstevel@tonic-gate 	caddr_t			ascb_saddr;		/* start address */
1917c478bd9Sstevel@tonic-gate 	size_t			ascb_len;		/* address range */
1927c478bd9Sstevel@tonic-gate };
1937c478bd9Sstevel@tonic-gate /*
1947c478bd9Sstevel@tonic-gate  * Callback events
1957c478bd9Sstevel@tonic-gate  */
1967c478bd9Sstevel@tonic-gate #define	AS_FREE_EVENT		0x1
1977c478bd9Sstevel@tonic-gate #define	AS_SETPROT_EVENT	0x2
1987c478bd9Sstevel@tonic-gate #define	AS_UNMAP_EVENT		0x4
1997c478bd9Sstevel@tonic-gate #define	AS_CALLBACK_CALLED	((uint_t)(1U << (8 * sizeof (uint_t) - 1U)))
2007c478bd9Sstevel@tonic-gate #define	AS_UNMAPWAIT_EVENT				\
2017c478bd9Sstevel@tonic-gate 		(AS_FREE_EVENT | AS_SETPROT_EVENT | AS_UNMAP_EVENT)
2027c478bd9Sstevel@tonic-gate #define	AS_ALL_EVENT					\
2037c478bd9Sstevel@tonic-gate 		(AS_FREE_EVENT | AS_SETPROT_EVENT | AS_UNMAP_EVENT)
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate /* Return code values for as_callback_delete */
2077c478bd9Sstevel@tonic-gate enum as_cbdelete_rc {
2087c478bd9Sstevel@tonic-gate 	AS_CALLBACK_DELETED,
2097c478bd9Sstevel@tonic-gate 	AS_CALLBACK_NOTFOUND,
2107c478bd9Sstevel@tonic-gate 	AS_CALLBACK_DELETE_DEFERRED
2117c478bd9Sstevel@tonic-gate };
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate #ifdef _KERNEL
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate /*
2167c478bd9Sstevel@tonic-gate  * Flags for as_gap.
2177c478bd9Sstevel@tonic-gate  */
2187c478bd9Sstevel@tonic-gate #define	AH_DIR		0x1	/* direction flag mask */
2197c478bd9Sstevel@tonic-gate #define	AH_LO		0x0	/* find lowest hole */
2207c478bd9Sstevel@tonic-gate #define	AH_HI		0x1	/* find highest hole */
2217c478bd9Sstevel@tonic-gate #define	AH_CONTAIN	0x2	/* hole must contain `addr' */
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate extern struct as kas;		/* kernel's address space */
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate /*
2267c478bd9Sstevel@tonic-gate  * Macros for address space locking.
2277c478bd9Sstevel@tonic-gate  */
2287c478bd9Sstevel@tonic-gate #define	AS_LOCK_ENTER(as, lock, type)		rw_enter((lock), (type))
2297c478bd9Sstevel@tonic-gate #define	AS_LOCK_EXIT(as, lock)			rw_exit((lock))
2307c478bd9Sstevel@tonic-gate #define	AS_LOCK_DESTROY(as, lock)		rw_destroy((lock))
2317c478bd9Sstevel@tonic-gate #define	AS_LOCK_TRYENTER(as, lock, type)	rw_tryenter((lock), (type))
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate /*
2347c478bd9Sstevel@tonic-gate  * Macros to test lock states.
2357c478bd9Sstevel@tonic-gate  */
2367c478bd9Sstevel@tonic-gate #define	AS_LOCK_HELD(as, lock)		RW_LOCK_HELD((lock))
2377c478bd9Sstevel@tonic-gate #define	AS_READ_HELD(as, lock)		RW_READ_HELD((lock))
2387c478bd9Sstevel@tonic-gate #define	AS_WRITE_HELD(as, lock)		RW_WRITE_HELD((lock))
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate /*
2417c478bd9Sstevel@tonic-gate  * macros to walk thru segment lists
2427c478bd9Sstevel@tonic-gate  */
2437c478bd9Sstevel@tonic-gate #define	AS_SEGFIRST(as)		avl_first(&(as)->a_segtree)
2447c478bd9Sstevel@tonic-gate #define	AS_SEGNEXT(as, seg)	AVL_NEXT(&(as)->a_segtree, (seg))
2457c478bd9Sstevel@tonic-gate #define	AS_SEGPREV(as, seg)	AVL_PREV(&(as)->a_segtree, (seg))
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate void	as_init(void);
2487c478bd9Sstevel@tonic-gate void	as_avlinit(struct as *);
2497c478bd9Sstevel@tonic-gate struct	seg *as_segat(struct as *as, caddr_t addr);
2507c478bd9Sstevel@tonic-gate void	as_rangelock(struct as *as);
2517c478bd9Sstevel@tonic-gate void	as_rangeunlock(struct as *as);
252c6939658Ssl struct	as *as_alloc();
2537c478bd9Sstevel@tonic-gate void	as_free(struct as *as);
254*bb5ca623SVamsi Nagineni int	as_dup(struct as *as, struct proc *forkedproc);
2557c478bd9Sstevel@tonic-gate struct	seg *as_findseg(struct as *as, caddr_t addr, int tail);
2567c478bd9Sstevel@tonic-gate int	as_addseg(struct as *as, struct seg *newseg);
2577c478bd9Sstevel@tonic-gate struct	seg *as_removeseg(struct as *as, struct seg *seg);
2587c478bd9Sstevel@tonic-gate faultcode_t as_fault(struct hat *hat, struct as *as, caddr_t addr, size_t size,
2597c478bd9Sstevel@tonic-gate 		enum fault_type type, enum seg_rw rw);
2607c478bd9Sstevel@tonic-gate faultcode_t as_faulta(struct as *as, caddr_t addr, size_t size);
2617c478bd9Sstevel@tonic-gate int	as_setprot(struct as *as, caddr_t addr, size_t size, uint_t prot);
2627c478bd9Sstevel@tonic-gate int	as_checkprot(struct as *as, caddr_t addr, size_t size, uint_t prot);
2637c478bd9Sstevel@tonic-gate int	as_unmap(struct as *as, caddr_t addr, size_t size);
2647c478bd9Sstevel@tonic-gate int	as_map(struct as *as, caddr_t addr, size_t size, int ((*crfp)()),
2657c478bd9Sstevel@tonic-gate 		void *argsp);
2667c478bd9Sstevel@tonic-gate void	as_purge(struct as *as);
2677c478bd9Sstevel@tonic-gate int	as_gap(struct as *as, size_t minlen, caddr_t *basep, size_t *lenp,
2687c478bd9Sstevel@tonic-gate 		uint_t flags, caddr_t addr);
26946ab9534Smec int	as_gap_aligned(struct as *as, size_t minlen, caddr_t *basep,
27046ab9534Smec 	    size_t *lenp, uint_t flags, caddr_t addr, size_t align,
27146ab9534Smec 	    size_t redzone, size_t off);
27246ab9534Smec 
2737c478bd9Sstevel@tonic-gate int	as_memory(struct as *as, caddr_t *basep, size_t *lenp);
2747c478bd9Sstevel@tonic-gate size_t	as_swapout(struct as *as);
2757c478bd9Sstevel@tonic-gate int	as_incore(struct as *as, caddr_t addr, size_t size, char *vec,
2767c478bd9Sstevel@tonic-gate 		size_t *sizep);
2777c478bd9Sstevel@tonic-gate int	as_ctl(struct as *as, caddr_t addr, size_t size, int func, int attr,
2787c478bd9Sstevel@tonic-gate 		uintptr_t arg, ulong_t *lock_map, size_t pos);
2797c478bd9Sstevel@tonic-gate int	as_exec(struct as *oas, caddr_t ostka, size_t stksz,
2807c478bd9Sstevel@tonic-gate 		struct as *nas, caddr_t nstka, uint_t hatflag);
2817c478bd9Sstevel@tonic-gate int	as_pagelock(struct as *as, struct page ***ppp, caddr_t addr,
2827c478bd9Sstevel@tonic-gate 		size_t size, enum seg_rw rw);
2837c478bd9Sstevel@tonic-gate void	as_pageunlock(struct as *as, struct page **pp, caddr_t addr,
2847c478bd9Sstevel@tonic-gate 		size_t size, enum seg_rw rw);
2857c478bd9Sstevel@tonic-gate int	as_setpagesize(struct as *as, caddr_t addr, size_t size, uint_t szc,
2867c478bd9Sstevel@tonic-gate 		boolean_t wait);
287ec25b48fSsusans int	as_set_default_lpsize(struct as *as, caddr_t addr, size_t size);
2887c478bd9Sstevel@tonic-gate void	as_setwatch(struct as *as);
2897c478bd9Sstevel@tonic-gate void	as_clearwatch(struct as *as);
2907c478bd9Sstevel@tonic-gate int	as_getmemid(struct as *, caddr_t, memid_t *);
2917c478bd9Sstevel@tonic-gate 
2927c478bd9Sstevel@tonic-gate int	as_add_callback(struct as *, void (*)(), void *, uint_t,
2937c478bd9Sstevel@tonic-gate 			caddr_t, size_t, int);
2947c478bd9Sstevel@tonic-gate uint_t	as_delete_callback(struct as *, void *);
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2997c478bd9Sstevel@tonic-gate }
3007c478bd9Sstevel@tonic-gate #endif
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate #endif	/* _VM_AS_H */
303