xref: /illumos-gate/usr/src/uts/common/vm/hat.h (revision 1bd5c35f)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bd9Sstevel@tonic-gate  * The Regents of the University of California
337c478bd9Sstevel@tonic-gate  * All Rights Reserved
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
367c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
377c478bd9Sstevel@tonic-gate  * contributors.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifndef	_VM_HAT_H
417c478bd9Sstevel@tonic-gate #define	_VM_HAT_H
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #include <sys/types.h>
467c478bd9Sstevel@tonic-gate #include <sys/t_lock.h>
477c478bd9Sstevel@tonic-gate #include <vm/faultcode.h>
487c478bd9Sstevel@tonic-gate #include <sys/kstat.h>
497c478bd9Sstevel@tonic-gate #include <sys/siginfo.h>
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
527c478bd9Sstevel@tonic-gate extern "C" {
537c478bd9Sstevel@tonic-gate #endif
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * VM - Hardware Address Translation management.
577c478bd9Sstevel@tonic-gate  *
587c478bd9Sstevel@tonic-gate  * This file describes the machine independent interfaces to
597c478bd9Sstevel@tonic-gate  * the hardware address translation management routines.  Other
607c478bd9Sstevel@tonic-gate  * machine specific interfaces and structures are defined
617c478bd9Sstevel@tonic-gate  * in <vm/hat_xxx.h>.  The hat layer manages the address
627c478bd9Sstevel@tonic-gate  * translation hardware as a cache driven by calls from the
637c478bd9Sstevel@tonic-gate  * higher levels of the VM system.
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate struct hat;
677c478bd9Sstevel@tonic-gate struct kpme;
687c478bd9Sstevel@tonic-gate struct memseg;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #include <vm/page.h>
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * a callback used with hat_unload_callback()
747c478bd9Sstevel@tonic-gate  * start and end mark are set to a range of unloaded addresses
757c478bd9Sstevel@tonic-gate  * and the function is invoked with a pointer to this data structure
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate typedef struct hat_callback {
787c478bd9Sstevel@tonic-gate 	caddr_t	hcb_start_addr;
797c478bd9Sstevel@tonic-gate 	caddr_t hcb_end_addr;
807c478bd9Sstevel@tonic-gate 	void	(*hcb_function)(struct hat_callback *);
817c478bd9Sstevel@tonic-gate 	void	*hcb_data;
827c478bd9Sstevel@tonic-gate } hat_callback_t;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * One time hat initialization
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate void	hat_init(void);
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * Notify hat of a system dump
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate void	hat_dump(void);
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Operations on an address space:
987c478bd9Sstevel@tonic-gate  *
997c478bd9Sstevel@tonic-gate  * struct hat *hat_alloc(as)
1007c478bd9Sstevel@tonic-gate  *	allocated a hat structure for as.
1017c478bd9Sstevel@tonic-gate  *
1027c478bd9Sstevel@tonic-gate  * void hat_free_start(hat)
1037c478bd9Sstevel@tonic-gate  *	informs hat layer process has finished executing but as has not
1047c478bd9Sstevel@tonic-gate  *	been cleaned up yet.
1057c478bd9Sstevel@tonic-gate  *
1067c478bd9Sstevel@tonic-gate  * void hat_free_end(hat)
1077c478bd9Sstevel@tonic-gate  *	informs hat layer as is being destroyed.  hat layer cannot use as
1087c478bd9Sstevel@tonic-gate  *	pointer after this call.
1097c478bd9Sstevel@tonic-gate  *
1107c478bd9Sstevel@tonic-gate  * void hat_swapin(hat)
1117c478bd9Sstevel@tonic-gate  *	allocate any hat resources required for process being swapped in.
1127c478bd9Sstevel@tonic-gate  *
1137c478bd9Sstevel@tonic-gate  * void hat_swapout(hat)
1147c478bd9Sstevel@tonic-gate  *	deallocate hat resources for process being swapped out.
1157c478bd9Sstevel@tonic-gate  *
1167c478bd9Sstevel@tonic-gate  * size_t hat_get_mapped_size(hat)
1177c478bd9Sstevel@tonic-gate  *	returns number of bytes that have valid mappings in hat.
1187c478bd9Sstevel@tonic-gate  *
1197c478bd9Sstevel@tonic-gate  * void hat_stats_enable(hat)
1207c478bd9Sstevel@tonic-gate  * void hat_stats_disable(hat)
1217c478bd9Sstevel@tonic-gate  *	enables/disables collection of stats for hat.
1227c478bd9Sstevel@tonic-gate  *
1237c478bd9Sstevel@tonic-gate  * int hat_dup(parenthat, childhat, addr, len, flags)
1247c478bd9Sstevel@tonic-gate  *	Duplicate address translations of the parent to the child.  Supports
1257c478bd9Sstevel@tonic-gate  *	the entire address range or a range depending on flag,
1267c478bd9Sstevel@tonic-gate  *	zero returned on success, non-zero on error
1277c478bd9Sstevel@tonic-gate  *
1287c478bd9Sstevel@tonic-gate  * void hat_thread_exit(thread)
1297c478bd9Sstevel@tonic-gate  *	Notifies the HAT that a thread is exiting, called after it has been
1307c478bd9Sstevel@tonic-gate  *	reassigned to the kernel AS.
1317c478bd9Sstevel@tonic-gate  */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate struct hat *hat_alloc(struct as *);
1347c478bd9Sstevel@tonic-gate void	hat_free_start(struct hat *);
1357c478bd9Sstevel@tonic-gate void	hat_free_end(struct hat *);
1367c478bd9Sstevel@tonic-gate int	hat_dup(struct hat *, struct hat *, caddr_t, size_t, uint_t);
1377c478bd9Sstevel@tonic-gate void	hat_swapin(struct hat *);
1387c478bd9Sstevel@tonic-gate void	hat_swapout(struct hat *);
1397c478bd9Sstevel@tonic-gate size_t	hat_get_mapped_size(struct hat *);
1407c478bd9Sstevel@tonic-gate int	hat_stats_enable(struct hat *);
1417c478bd9Sstevel@tonic-gate void	hat_stats_disable(struct hat *);
1427c478bd9Sstevel@tonic-gate void	hat_thread_exit(kthread_t *);
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate /*
1457c478bd9Sstevel@tonic-gate  * Operations on a named address within a segment:
1467c478bd9Sstevel@tonic-gate  *
1477c478bd9Sstevel@tonic-gate  * void hat_memload(hat, addr, pp, attr, flags)
1487c478bd9Sstevel@tonic-gate  *	load/lock the given page struct
1497c478bd9Sstevel@tonic-gate  *
1507c478bd9Sstevel@tonic-gate  * void hat_memload_array(hat, addr, len, ppa, attr, flags)
1517c478bd9Sstevel@tonic-gate  *	load/lock the given array of page structs
1527c478bd9Sstevel@tonic-gate  *
1537c478bd9Sstevel@tonic-gate  * void hat_devload(hat, addr, len, pf, attr, flags)
1547c478bd9Sstevel@tonic-gate  *	load/lock the given page frame number
1557c478bd9Sstevel@tonic-gate  *
1567c478bd9Sstevel@tonic-gate  * void hat_unlock(hat, addr, len)
1577c478bd9Sstevel@tonic-gate  *	unlock a given range of addresses
1587c478bd9Sstevel@tonic-gate  *
1597c478bd9Sstevel@tonic-gate  * void hat_unload(hat, addr, len, flags)
1607c478bd9Sstevel@tonic-gate  * void hat_unload_callback(hat, addr, len, flags, callback)
1617c478bd9Sstevel@tonic-gate  *	unload a given range of addresses (has optional callback)
1627c478bd9Sstevel@tonic-gate  *
1637c478bd9Sstevel@tonic-gate  * void hat_sync(hat, addr, len, flags)
1647c478bd9Sstevel@tonic-gate  *	synchronize mapping with software data structures
1657c478bd9Sstevel@tonic-gate  *
1667c478bd9Sstevel@tonic-gate  * void	hat_map(hat, addr, len, flags)
1677c478bd9Sstevel@tonic-gate  *
1687c478bd9Sstevel@tonic-gate  * void hat_setattr(hat, addr, len, attr)
1697c478bd9Sstevel@tonic-gate  * void hat_clrattr(hat, addr, len, attr)
1707c478bd9Sstevel@tonic-gate  * void hat_chgattr(hat, addr, len, attr)
1717c478bd9Sstevel@tonic-gate  *	modify attributes for a range of addresses. skips any invalid mappings
1727c478bd9Sstevel@tonic-gate  *
1737c478bd9Sstevel@tonic-gate  * uint_t hat_getattr(hat, addr, *attr)
1747c478bd9Sstevel@tonic-gate  *	returns attr for <hat,addr> in *attr.  returns 0 if there was a
1757c478bd9Sstevel@tonic-gate  *	mapping and *attr is valid, nonzero if there was no mapping and
1767c478bd9Sstevel@tonic-gate  *	*attr is not valid.
1777c478bd9Sstevel@tonic-gate  *
1787c478bd9Sstevel@tonic-gate  * size_t hat_getpagesize(hat, addr)
1797c478bd9Sstevel@tonic-gate  *	returns pagesize in bytes for <hat, addr>. returns -1 if there is
1807c478bd9Sstevel@tonic-gate  *	no mapping. This is an advisory call.
1817c478bd9Sstevel@tonic-gate  *
1827c478bd9Sstevel@tonic-gate  * pfn_t hat_getpfnum(hat, addr)
1837c478bd9Sstevel@tonic-gate  *	returns pfn for <hat, addr> or PFN_INVALID if mapping is invalid.
1847c478bd9Sstevel@tonic-gate  *
1857c478bd9Sstevel@tonic-gate  * pfn_t hat_getkpfnum(addr)
1867c478bd9Sstevel@tonic-gate  *	returns pfn for non-memory mapped addr in kernel address space
1877c478bd9Sstevel@tonic-gate  *	or PFN_INVALID if mapping is invalid or is kernel memory.
1887c478bd9Sstevel@tonic-gate  *
1897c478bd9Sstevel@tonic-gate  * int hat_probe(hat, addr)
1907c478bd9Sstevel@tonic-gate  *	return 0 if no valid mapping is present.  Faster version
1917c478bd9Sstevel@tonic-gate  *	of hat_getattr in certain architectures.
1927c478bd9Sstevel@tonic-gate  *
1937c478bd9Sstevel@tonic-gate  * int hat_share(dhat, daddr, shat, saddr, len, szc)
1947c478bd9Sstevel@tonic-gate  *
1957c478bd9Sstevel@tonic-gate  * void hat_unshare(hat, addr, len, szc)
1967c478bd9Sstevel@tonic-gate  *
1977c478bd9Sstevel@tonic-gate  * void hat_chgprot(hat, addr, len, vprot)
1987c478bd9Sstevel@tonic-gate  *	This is a deprecated call.  New segment drivers should store
1997c478bd9Sstevel@tonic-gate  *	all attributes and use hat_*attr calls.
2007c478bd9Sstevel@tonic-gate  *	Change the protections in the virtual address range
2017c478bd9Sstevel@tonic-gate  *	given to the specified virtual protection.  If vprot is ~PROT_WRITE,
2027c478bd9Sstevel@tonic-gate  *	then remove write permission, leaving the other permissions
2037c478bd9Sstevel@tonic-gate  *	unchanged.  If vprot is ~PROT_USER, remove user permissions.
2047c478bd9Sstevel@tonic-gate  */
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate void	hat_memload(struct hat *, caddr_t, struct page *, uint_t, uint_t);
2077c478bd9Sstevel@tonic-gate void	hat_memload_array(struct hat *, caddr_t, size_t, struct page **,
2087c478bd9Sstevel@tonic-gate 		uint_t, uint_t);
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate void	hat_devload(struct hat *, caddr_t, size_t, pfn_t, uint_t, int);
2117c478bd9Sstevel@tonic-gate void	hat_unlock(struct hat *, caddr_t, size_t);
2127c478bd9Sstevel@tonic-gate void	hat_unload(struct hat *, caddr_t, size_t, uint_t);
2137c478bd9Sstevel@tonic-gate void	hat_unload_callback(struct hat *, caddr_t, size_t, uint_t,
2147c478bd9Sstevel@tonic-gate 		hat_callback_t *);
2157c478bd9Sstevel@tonic-gate void	hat_sync(struct hat *, caddr_t, size_t, uint_t);
2167c478bd9Sstevel@tonic-gate void	hat_map(struct hat *, caddr_t, size_t, uint_t);
2177c478bd9Sstevel@tonic-gate void	hat_setattr(struct hat *, caddr_t, size_t, uint_t);
2187c478bd9Sstevel@tonic-gate void	hat_clrattr(struct hat *, caddr_t, size_t, uint_t);
2197c478bd9Sstevel@tonic-gate void	hat_chgattr(struct hat *, caddr_t, size_t, uint_t);
2207c478bd9Sstevel@tonic-gate uint_t	hat_getattr(struct hat *, caddr_t, uint_t *);
2217c478bd9Sstevel@tonic-gate ssize_t	hat_getpagesize(struct hat *, caddr_t);
2227c478bd9Sstevel@tonic-gate pfn_t	hat_getpfnum(struct hat *, caddr_t);
2237c478bd9Sstevel@tonic-gate int	hat_probe(struct hat *, caddr_t);
2247c478bd9Sstevel@tonic-gate int	hat_share(struct hat *, caddr_t, struct hat *, caddr_t, size_t, uint_t);
2257c478bd9Sstevel@tonic-gate void	hat_unshare(struct hat *, caddr_t, size_t, uint_t);
2267c478bd9Sstevel@tonic-gate void	hat_chgprot(struct hat *, caddr_t, size_t, uint_t);
2277c478bd9Sstevel@tonic-gate void	hat_reserve(struct as *, caddr_t, size_t);
2287c478bd9Sstevel@tonic-gate pfn_t	va_to_pfn(void *);
2297c478bd9Sstevel@tonic-gate uint64_t va_to_pa(void *);
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate /*
2327c478bd9Sstevel@tonic-gate  * hat_getkpfnum() is never supported on amd64 and will be
2337c478bd9Sstevel@tonic-gate  * removed from other platforms in future release
2347c478bd9Sstevel@tonic-gate  */
2357c478bd9Sstevel@tonic-gate #if !defined(__amd64)
2367c478bd9Sstevel@tonic-gate pfn_t	hat_getkpfnum(caddr_t);
2377c478bd9Sstevel@tonic-gate #endif
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate /*
2417c478bd9Sstevel@tonic-gate  * Kernel Physical Mapping (segkpm) hat interface routines.
2427c478bd9Sstevel@tonic-gate  */
2437c478bd9Sstevel@tonic-gate caddr_t	hat_kpm_mapin(struct page *, struct kpme *);
2447c478bd9Sstevel@tonic-gate void	hat_kpm_mapout(struct page *, struct kpme *, caddr_t);
2457c478bd9Sstevel@tonic-gate caddr_t	hat_kpm_page2va(struct page *, int);
2467c478bd9Sstevel@tonic-gate struct page *hat_kpm_vaddr2page(caddr_t);
2477c478bd9Sstevel@tonic-gate int	hat_kpm_fault(struct hat *, caddr_t);
2487c478bd9Sstevel@tonic-gate void	hat_kpm_mseghash_clear(int);
2497c478bd9Sstevel@tonic-gate void	hat_kpm_mseghash_update(pgcnt_t, struct memseg *);
2507c478bd9Sstevel@tonic-gate void	hat_kpm_addmem_mseg_update(struct memseg *, pgcnt_t, offset_t);
2517c478bd9Sstevel@tonic-gate void	hat_kpm_addmem_mseg_insert(struct memseg *);
2527c478bd9Sstevel@tonic-gate void	hat_kpm_addmem_memsegs_update(struct memseg *);
2537c478bd9Sstevel@tonic-gate caddr_t hat_kpm_mseg_reuse(struct memseg *);
2547c478bd9Sstevel@tonic-gate void	hat_kpm_delmem_mseg_update(struct memseg *, struct memseg **);
2557c478bd9Sstevel@tonic-gate void	hat_kpm_split_mseg_update(struct memseg *, struct memseg **,
2567c478bd9Sstevel@tonic-gate 			struct memseg *, struct memseg *, struct memseg *);
2577c478bd9Sstevel@tonic-gate void	hat_kpm_walk(void (*)(void *, void *, size_t), void *);
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate /*
2607c478bd9Sstevel@tonic-gate  * Operations on all translations for a given page(s)
2617c478bd9Sstevel@tonic-gate  *
2627c478bd9Sstevel@tonic-gate  * void hat_page_setattr(pp, flag)
2637c478bd9Sstevel@tonic-gate  * void hat_page_clrattr(pp, flag)
2647c478bd9Sstevel@tonic-gate  *	used to set/clr red/mod bits.
2657c478bd9Sstevel@tonic-gate  *
2667c478bd9Sstevel@tonic-gate  * uint hat_page_getattr(pp, flag)
2677c478bd9Sstevel@tonic-gate  *	If flag is specified, returns 0 if attribute is disabled
2687c478bd9Sstevel@tonic-gate  *	and non zero if enabled.  If flag specifes multiple attributs
2697c478bd9Sstevel@tonic-gate  *	then returns 0 if ALL atriibutes are disabled.  This is an advisory
2707c478bd9Sstevel@tonic-gate  *	call.
2717c478bd9Sstevel@tonic-gate  *
2727c478bd9Sstevel@tonic-gate  * int hat_pageunload(pp, forceflag)
2737c478bd9Sstevel@tonic-gate  *	unload all translations attached to pp.
2747c478bd9Sstevel@tonic-gate  *
2757c478bd9Sstevel@tonic-gate  * uint_t hat_pagesync(pp, flags)
2767c478bd9Sstevel@tonic-gate  *	get hw stats from hardware into page struct and reset hw stats
2777c478bd9Sstevel@tonic-gate  *	returns attributes of page
2787c478bd9Sstevel@tonic-gate  *
2797c478bd9Sstevel@tonic-gate  * ulong_t hat_page_getshare(pp)
2807c478bd9Sstevel@tonic-gate  *	returns approx number of mappings to this pp.  A return of 0 implies
2817c478bd9Sstevel@tonic-gate  *	there are no mappings to the page.
2827c478bd9Sstevel@tonic-gate  *
2837c478bd9Sstevel@tonic-gate  * faultcode_t hat_softlock(hat, addr, lenp, ppp, flags);
2847c478bd9Sstevel@tonic-gate  *	called to softlock pages for zero copy tcp
2857c478bd9Sstevel@tonic-gate  *
2867c478bd9Sstevel@tonic-gate  * void hat_page_demote(pp);
2877c478bd9Sstevel@tonic-gate  *	unload all large mappings to pp and decrease p_szc of all
2887c478bd9Sstevel@tonic-gate  *	constituent pages according to the remaining mappings.
2897c478bd9Sstevel@tonic-gate  */
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate void	hat_page_setattr(struct page *, uint_t);
2927c478bd9Sstevel@tonic-gate void	hat_page_clrattr(struct page *, uint_t);
2937c478bd9Sstevel@tonic-gate uint_t	hat_page_getattr(struct page *, uint_t);
2947c478bd9Sstevel@tonic-gate int	hat_pageunload(struct page *, uint_t);
2957c478bd9Sstevel@tonic-gate uint_t	hat_pagesync(struct page *, uint_t);
2967c478bd9Sstevel@tonic-gate ulong_t	hat_page_getshare(struct page *);
2977c478bd9Sstevel@tonic-gate faultcode_t hat_softlock(struct hat *, caddr_t, size_t *,
2987c478bd9Sstevel@tonic-gate 			struct page **, uint_t);
2997c478bd9Sstevel@tonic-gate void	hat_page_demote(struct page *);
3007c478bd9Sstevel@tonic-gate 
3017c478bd9Sstevel@tonic-gate /*
3027c478bd9Sstevel@tonic-gate  * Rountine to expose supported HAT features to PIM.
3037c478bd9Sstevel@tonic-gate  */
3047c478bd9Sstevel@tonic-gate enum hat_features {
3057c478bd9Sstevel@tonic-gate 	HAT_SHARED_PT,		/* Shared page tables */
3067c478bd9Sstevel@tonic-gate 	HAT_DYNAMIC_ISM_UNMAP,	/* hat_pageunload() handles ISM pages */
3077c478bd9Sstevel@tonic-gate 	HAT_VMODSORT		/* support for VMODSORT flag of vnode */
3087c478bd9Sstevel@tonic-gate };
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate int hat_supported(enum hat_features, void *);
3117c478bd9Sstevel@tonic-gate 
3127c478bd9Sstevel@tonic-gate /*
3137c478bd9Sstevel@tonic-gate  * Services provided to the hat:
3147c478bd9Sstevel@tonic-gate  *
3157c478bd9Sstevel@tonic-gate  * void as_signal_proc(as, siginfo)
3167c478bd9Sstevel@tonic-gate  *	deliver signal to all processes that have this as.
3177c478bd9Sstevel@tonic-gate  *
3187c478bd9Sstevel@tonic-gate  * int hat_setstat(as, addr, len, rmbits)
3197c478bd9Sstevel@tonic-gate  *	informs hatstat layer that ref/mod bits need to be updated for
3207c478bd9Sstevel@tonic-gate  *	address range. Returns 0 on success, 1 for failure.
3217c478bd9Sstevel@tonic-gate  */
3227c478bd9Sstevel@tonic-gate void	as_signal_proc(struct as *, k_siginfo_t *siginfo);
3237c478bd9Sstevel@tonic-gate void	hat_setstat(struct as *, caddr_t, size_t, uint_t);
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate /*
3267c478bd9Sstevel@tonic-gate  * Flags to pass to hat routines.
3277c478bd9Sstevel@tonic-gate  *
3287c478bd9Sstevel@tonic-gate  * Certain flags only apply to some interfaces:
3297c478bd9Sstevel@tonic-gate  *
3307c478bd9Sstevel@tonic-gate  * 	HAT_LOAD	Default flags to load a translation to the page.
3317c478bd9Sstevel@tonic-gate  * 	HAT_LOAD_LOCK	Lock down mapping resources; hat_map(), hat_memload(),
3327c478bd9Sstevel@tonic-gate  *			and hat_devload().
3337c478bd9Sstevel@tonic-gate  *	HAT_LOAD_ADV	Advisory load - Load translation if and only if
3347c478bd9Sstevel@tonic-gate  *			sufficient MMU resources exist (i.e., do not steal).
3357c478bd9Sstevel@tonic-gate  *	HAT_LOAD_SHARE	A flag to hat_memload() to indicate h/w page tables
3367c478bd9Sstevel@tonic-gate  *			that map some user pages (not kas) is shared by more
3377c478bd9Sstevel@tonic-gate  *			than one process (eg. ISM).
3387c478bd9Sstevel@tonic-gate  *	HAT_LOAD_CONTIG	Pages are contigous
3397c478bd9Sstevel@tonic-gate  *	HAT_LOAD_NOCONSIST Do not add mapping to mapping list.
3407c478bd9Sstevel@tonic-gate  *	HAT_LOAD_REMAP	Reload a valid pte with a different page frame.
3417c478bd9Sstevel@tonic-gate  *	HAT_RELOAD_SHARE Reload a shared page table entry. Some platforms
3427c478bd9Sstevel@tonic-gate  *			 may require different actions than on the first
3437c478bd9Sstevel@tonic-gate  *			 load of a shared mapping.
3447c478bd9Sstevel@tonic-gate  *	HAT_NO_KALLOC	Do not kmem_alloc while creating the mapping; at this
3457c478bd9Sstevel@tonic-gate  *			point, it's setting up mapping to allocate internal
3467c478bd9Sstevel@tonic-gate  *			hat layer data structures.  This flag forces hat layer
3477c478bd9Sstevel@tonic-gate  *			to tap its reserves in order to prevent infinite
3487c478bd9Sstevel@tonic-gate  *			recursion.
3497c478bd9Sstevel@tonic-gate  *	HAT_LOAD_AUTOLPG Get MMU specific disable_auto_large_pages
3507c478bd9Sstevel@tonic-gate  */
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate /*
3537c478bd9Sstevel@tonic-gate  * Flags for hat_memload/hat_devload
3547c478bd9Sstevel@tonic-gate  */
3557c478bd9Sstevel@tonic-gate #define	HAT_FLAGS_RESV		0xFF000000	/* resv for hat impl */
3567c478bd9Sstevel@tonic-gate #define	HAT_LOAD		0x00
3577c478bd9Sstevel@tonic-gate #define	HAT_LOAD_LOCK		0x01
3587c478bd9Sstevel@tonic-gate #define	HAT_LOAD_ADV		0x04
3597c478bd9Sstevel@tonic-gate #define	HAT_LOAD_CONTIG		0x10
3607c478bd9Sstevel@tonic-gate #define	HAT_LOAD_NOCONSIST	0x20
3617c478bd9Sstevel@tonic-gate #define	HAT_LOAD_SHARE		0x40
3627c478bd9Sstevel@tonic-gate #define	HAT_LOAD_REMAP		0x80
3637c478bd9Sstevel@tonic-gate #define	HAT_RELOAD_SHARE	0x100
3647c478bd9Sstevel@tonic-gate #define	HAT_NO_KALLOC		0x200
3657c478bd9Sstevel@tonic-gate #define	HAT_LOAD_TEXT		0x400
3667c478bd9Sstevel@tonic-gate #define	HAT_LOAD_AUTOLPG	0x800
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate /*
3697c478bd9Sstevel@tonic-gate  * Attributes for hat_memload/hat_devload/hat_*attr
3707c478bd9Sstevel@tonic-gate  * are a superset of prot flags defined in mman.h.
3717c478bd9Sstevel@tonic-gate  */
3727c478bd9Sstevel@tonic-gate #define	HAT_PLAT_ATTR_MASK	0xF00000
3737c478bd9Sstevel@tonic-gate #define	HAT_PROT_MASK		0x0F
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate #define	HAT_NOFAULT		0x10
3767c478bd9Sstevel@tonic-gate #define	HAT_NOSYNC		0x20
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate /*
3797c478bd9Sstevel@tonic-gate  * Advisory ordering attributes. Apply only to device mappings.
3807c478bd9Sstevel@tonic-gate  *
3817c478bd9Sstevel@tonic-gate  * HAT_STRICTORDER: the CPU must issue the references in order, as the
3827c478bd9Sstevel@tonic-gate  *	programmer specified.  This is the default.
3837c478bd9Sstevel@tonic-gate  * HAT_UNORDERED_OK: the CPU may reorder the references (this is all kinds
3847c478bd9Sstevel@tonic-gate  *	of reordering; store or load with store or load).
3857c478bd9Sstevel@tonic-gate  * HAT_MERGING_OK: merging and batching: the CPU may merge individual stores
3867c478bd9Sstevel@tonic-gate  *	to consecutive locations (for example, turn two consecutive byte
3877c478bd9Sstevel@tonic-gate  *	stores into one halfword store), and it may batch individual loads
3887c478bd9Sstevel@tonic-gate  *	(for example, turn two consecutive byte loads into one halfword load).
3897c478bd9Sstevel@tonic-gate  *	This also implies re-ordering.
3907c478bd9Sstevel@tonic-gate  * HAT_LOADCACHING_OK: the CPU may cache the data it fetches and reuse it
3917c478bd9Sstevel@tonic-gate  *	until another store occurs.  The default is to fetch new data
3927c478bd9Sstevel@tonic-gate  *	on every load.  This also implies merging.
3937c478bd9Sstevel@tonic-gate  * HAT_STORECACHING_OK: the CPU may keep the data in the cache and push it to
3947c478bd9Sstevel@tonic-gate  *	the device (perhaps with other data) at a later time.  The default is
3957c478bd9Sstevel@tonic-gate  *	to push the data right away.  This also implies load caching.
3967c478bd9Sstevel@tonic-gate  */
3977c478bd9Sstevel@tonic-gate #define	HAT_STRICTORDER		0x0000
3987c478bd9Sstevel@tonic-gate #define	HAT_UNORDERED_OK	0x0100
3997c478bd9Sstevel@tonic-gate #define	HAT_MERGING_OK		0x0200
4007c478bd9Sstevel@tonic-gate #define	HAT_LOADCACHING_OK	0x0300
4017c478bd9Sstevel@tonic-gate #define	HAT_STORECACHING_OK	0x0400
4027c478bd9Sstevel@tonic-gate #define	HAT_ORDER_MASK		0x0700
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate /* endian attributes */
4057c478bd9Sstevel@tonic-gate #define	HAT_NEVERSWAP		0x0000
4067c478bd9Sstevel@tonic-gate #define	HAT_STRUCTURE_BE	0x1000
4077c478bd9Sstevel@tonic-gate #define	HAT_STRUCTURE_LE	0x2000
4087c478bd9Sstevel@tonic-gate #define	HAT_ENDIAN_MASK		0x3000
4097c478bd9Sstevel@tonic-gate 
4107c478bd9Sstevel@tonic-gate /* flags for hat_softlock */
4117c478bd9Sstevel@tonic-gate #define	HAT_COW			0x0001
4127c478bd9Sstevel@tonic-gate 
4137c478bd9Sstevel@tonic-gate /*
4147c478bd9Sstevel@tonic-gate  * Flags for hat_unload
4157c478bd9Sstevel@tonic-gate  */
4167c478bd9Sstevel@tonic-gate #define	HAT_UNLOAD		0x00
4177c478bd9Sstevel@tonic-gate #define	HAT_UNLOAD_NOSYNC	0x02
4187c478bd9Sstevel@tonic-gate #define	HAT_UNLOAD_UNLOCK	0x04
4197c478bd9Sstevel@tonic-gate #define	HAT_UNLOAD_OTHER	0x08
4207c478bd9Sstevel@tonic-gate #define	HAT_UNLOAD_UNMAP	0x10
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate /*
4237c478bd9Sstevel@tonic-gate  * Flags for hat_pagesync, hat_getstat, hat_sync
4247c478bd9Sstevel@tonic-gate  */
4257c478bd9Sstevel@tonic-gate #define	HAT_SYNC_DONTZERO	0x00
4267c478bd9Sstevel@tonic-gate #define	HAT_SYNC_ZERORM		0x01
4277c478bd9Sstevel@tonic-gate /* Additional flags for hat_pagesync */
4287c478bd9Sstevel@tonic-gate #define	HAT_SYNC_STOPON_REF	0x02
4297c478bd9Sstevel@tonic-gate #define	HAT_SYNC_STOPON_MOD	0x04
4307c478bd9Sstevel@tonic-gate #define	HAT_SYNC_STOPON_RM	(HAT_SYNC_STOPON_REF | HAT_SYNC_STOPON_MOD)
4317c478bd9Sstevel@tonic-gate #define	HAT_SYNC_STOPON_SHARED	0x08
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate /*
4347c478bd9Sstevel@tonic-gate  * Flags for hat_dup
4357c478bd9Sstevel@tonic-gate  *
4367c478bd9Sstevel@tonic-gate  * HAT_DUP_ALL dup entire address space
4377c478bd9Sstevel@tonic-gate  * HAT_DUP_COW dup plus hat_clrattr(..PROT_WRITE) on newas
4387c478bd9Sstevel@tonic-gate  */
4397c478bd9Sstevel@tonic-gate #define	HAT_DUP_ALL		1
4407c478bd9Sstevel@tonic-gate #define	HAT_DUP_COW		2
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate /*
4447c478bd9Sstevel@tonic-gate  * Flags for hat_map
4457c478bd9Sstevel@tonic-gate  */
4467c478bd9Sstevel@tonic-gate #define	HAT_MAP			0x00
4477c478bd9Sstevel@tonic-gate 
4487c478bd9Sstevel@tonic-gate /*
4497c478bd9Sstevel@tonic-gate  * Flag for hat_pageunload
4507c478bd9Sstevel@tonic-gate  */
4517c478bd9Sstevel@tonic-gate #define	HAT_ADV_PGUNLOAD	0x00
4527c478bd9Sstevel@tonic-gate #define	HAT_FORCE_PGUNLOAD	0x01
4537c478bd9Sstevel@tonic-gate 
4547c478bd9Sstevel@tonic-gate /*
4557c478bd9Sstevel@tonic-gate  * Attributes for hat_page_*attr, hat_setstats and
4567c478bd9Sstevel@tonic-gate  * returned by hat_pagesync.
4577c478bd9Sstevel@tonic-gate  */
4587c478bd9Sstevel@tonic-gate #define	P_MOD	0x1		/* the modified bit */
4597c478bd9Sstevel@tonic-gate #define	P_REF	0x2		/* the referenced bit */
4607c478bd9Sstevel@tonic-gate #define	P_RO	0x4		/* Read only page */
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate #define	hat_ismod(pp)		(hat_page_getattr(pp, P_MOD))
4637c478bd9Sstevel@tonic-gate #define	hat_isref(pp)		(hat_page_getattr(pp, P_REF))
4647c478bd9Sstevel@tonic-gate #define	hat_isro(pp)		(hat_page_getattr(pp, P_RO))
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate #define	hat_setmod(pp)		(hat_page_setattr(pp, P_MOD))
4677c478bd9Sstevel@tonic-gate #define	hat_setref(pp)		(hat_page_setattr(pp, P_REF))
4687c478bd9Sstevel@tonic-gate #define	hat_setrefmod(pp)	(hat_page_setattr(pp, P_REF|P_MOD))
4697c478bd9Sstevel@tonic-gate 
4707c478bd9Sstevel@tonic-gate #define	hat_clrmod(pp)		(hat_page_clrattr(pp, P_MOD))
4717c478bd9Sstevel@tonic-gate #define	hat_clrref(pp)		(hat_page_clrattr(pp, P_REF))
4727c478bd9Sstevel@tonic-gate #define	hat_clrrefmod(pp)	(hat_page_clrattr(pp, P_REF|P_MOD))
4737c478bd9Sstevel@tonic-gate 
4747c478bd9Sstevel@tonic-gate #define	hat_page_is_mapped(pp)	(hat_page_getshare(pp))
4757c478bd9Sstevel@tonic-gate 
4767c478bd9Sstevel@tonic-gate /*
4777c478bd9Sstevel@tonic-gate  * hat_setup is being used in sparc/os/sundep.c
4787c478bd9Sstevel@tonic-gate  */
4797c478bd9Sstevel@tonic-gate void	hat_setup(struct hat *, int);
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate /*
4827c478bd9Sstevel@tonic-gate  * Flags for hat_setup
4837c478bd9Sstevel@tonic-gate  */
4847c478bd9Sstevel@tonic-gate #define	HAT_DONTALLOC		0
4857c478bd9Sstevel@tonic-gate #define	HAT_ALLOC		1
4867c478bd9Sstevel@tonic-gate #define	HAT_INIT		2
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate /*
4897c478bd9Sstevel@tonic-gate  * Other routines, for statistics
4907c478bd9Sstevel@tonic-gate  */
4917c478bd9Sstevel@tonic-gate int	hat_startstat(struct as *);
4927c478bd9Sstevel@tonic-gate void	hat_getstat(struct as *, caddr_t, size_t, uint_t, char *, int);
4937c478bd9Sstevel@tonic-gate void	hat_freestat(struct as *, int);
4947c478bd9Sstevel@tonic-gate void	hat_resvstat(size_t, struct as *, caddr_t);
4957c478bd9Sstevel@tonic-gate 
4967c478bd9Sstevel@tonic-gate /*
4977c478bd9Sstevel@tonic-gate  * Transitionary routine while we still allow hat_getkpfnum(caddr_t)
4987c478bd9Sstevel@tonic-gate  * to return a pfn for kernel memory, but want to warn the user that
4997c478bd9Sstevel@tonic-gate  * it isn't supported.
5007c478bd9Sstevel@tonic-gate  */
5017c478bd9Sstevel@tonic-gate void	hat_getkpfnum_badcall(void *caller);
5027c478bd9Sstevel@tonic-gate 
5037c478bd9Sstevel@tonic-gate /*
5047c478bd9Sstevel@tonic-gate  * Relocation callback routines. Currently only sfmmu HAT supports
5057c478bd9Sstevel@tonic-gate  * these.
5067c478bd9Sstevel@tonic-gate  */
5077c478bd9Sstevel@tonic-gate extern int	hat_add_callback(id_t, caddr_t, uint_t, uint_t, void *,
5087c478bd9Sstevel@tonic-gate 	pfn_t *);
509*1bd5c35fSelowe extern id_t	hat_register_callback(int,
5107c478bd9Sstevel@tonic-gate 	int (*prehandler)(caddr_t, uint_t, uint_t, void *),
5117c478bd9Sstevel@tonic-gate 	int (*posthandler)(caddr_t, uint_t, uint_t, void *, pfn_t),
5127c478bd9Sstevel@tonic-gate 	int (*errhandler)(caddr_t, uint_t, uint_t, void *), int);
5137c478bd9Sstevel@tonic-gate extern void	hat_delete_callback(caddr_t, uint_t, void *, uint_t);
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate /*
5167c478bd9Sstevel@tonic-gate  * hat_add_callback()/hat_delete_callback() flags.
5177c478bd9Sstevel@tonic-gate  */
5187c478bd9Sstevel@tonic-gate #define	HAC_NOSLEEP	0x0
5197c478bd9Sstevel@tonic-gate #define	HAC_SLEEP	0x1
5207c478bd9Sstevel@tonic-gate #define	HAC_PAGELOCK	0x2
5217c478bd9Sstevel@tonic-gate 
5227c478bd9Sstevel@tonic-gate /*
5237c478bd9Sstevel@tonic-gate  * Suspend/unsuspend handler callback arguments.
5247c478bd9Sstevel@tonic-gate  */
5257c478bd9Sstevel@tonic-gate #define	HAT_SUSPEND		0x0010
5267c478bd9Sstevel@tonic-gate #define	HAT_UNSUSPEND		0x0010
5277c478bd9Sstevel@tonic-gate #define	HAT_PRESUSPEND		0x0020
5287c478bd9Sstevel@tonic-gate #define	HAT_POSTUNSUSPEND	0x0020
5297c478bd9Sstevel@tonic-gate 
5307c478bd9Sstevel@tonic-gate /*
5317c478bd9Sstevel@tonic-gate  * Error handler callback arguments. See the block comments
5327c478bd9Sstevel@tonic-gate  * before the implementation of hat_add_callback() for an
5337c478bd9Sstevel@tonic-gate  * explanation of what these mean.
5347c478bd9Sstevel@tonic-gate  */
5357c478bd9Sstevel@tonic-gate #define	HAT_CB_ERR_LEAKED	0x1
5367c478bd9Sstevel@tonic-gate 
5377c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
5387c478bd9Sstevel@tonic-gate 
5397c478bd9Sstevel@tonic-gate /*
5407c478bd9Sstevel@tonic-gate  * The size of the bit array for ref and mod bit storage must be a power of 2.
5417c478bd9Sstevel@tonic-gate  * 2 bits are collected for each page.  Below the power used is 4,
5427c478bd9Sstevel@tonic-gate  * which is 16 8-bit characters = 128 bits, ref and mod bit information
5437c478bd9Sstevel@tonic-gate  * for 64 pages.
5447c478bd9Sstevel@tonic-gate  */
5457c478bd9Sstevel@tonic-gate #define	HRM_SHIFT		4
5467c478bd9Sstevel@tonic-gate #define	HRM_BYTES		(1 << HRM_SHIFT)
5477c478bd9Sstevel@tonic-gate #define	HRM_PAGES		((HRM_BYTES * NBBY) / 2)
5487c478bd9Sstevel@tonic-gate #define	HRM_PGPERBYTE		(NBBY/2)
5497c478bd9Sstevel@tonic-gate #define	HRM_PGBYTEMASK		(HRM_PGPERBYTE-1)
5507c478bd9Sstevel@tonic-gate 
5517c478bd9Sstevel@tonic-gate #define	HRM_PGOFFMASK		((HRM_PGPERBYTE-1) << MMU_PAGESHIFT)
5527c478bd9Sstevel@tonic-gate #define	HRM_BASEOFFSET		(((MMU_PAGESIZE * HRM_PAGES) - 1))
5537c478bd9Sstevel@tonic-gate #define	HRM_BASEMASK		(~(HRM_BASEOFFSET))
5547c478bd9Sstevel@tonic-gate 
5557c478bd9Sstevel@tonic-gate #define	HRM_BASESHIFT		(MMU_PAGESHIFT + (HRM_SHIFT + 2))
5567c478bd9Sstevel@tonic-gate #define	HRM_PAGEMASK		(MMU_PAGEMASK ^ HRM_BASEMASK)
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate #define	HRM_HASHSIZE		0x200
5597c478bd9Sstevel@tonic-gate #define	HRM_HASHMASK		(HRM_HASHSIZE - 1)
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate #define	HRM_BLIST_INCR		0x200
5627c478bd9Sstevel@tonic-gate 
5637c478bd9Sstevel@tonic-gate /*
5647c478bd9Sstevel@tonic-gate  * The structure for maintaining referenced and modified information
5657c478bd9Sstevel@tonic-gate  */
5667c478bd9Sstevel@tonic-gate struct hrmstat {
5677c478bd9Sstevel@tonic-gate 	struct as	*hrm_as;	/* stat block belongs to this as */
5687c478bd9Sstevel@tonic-gate 	uintptr_t	hrm_base;	/* base of block */
5697c478bd9Sstevel@tonic-gate 	ushort_t	hrm_id;		/* opaque identifier, one of a_vbits */
5707c478bd9Sstevel@tonic-gate 	struct hrmstat	*hrm_anext;	/* as statistics block list */
5717c478bd9Sstevel@tonic-gate 	struct hrmstat	*hrm_hnext;	/* list for hashed blocks */
5727c478bd9Sstevel@tonic-gate 	uchar_t		hrm_bits[HRM_BYTES]; /* the ref and mod bits */
5737c478bd9Sstevel@tonic-gate };
5747c478bd9Sstevel@tonic-gate 
5757c478bd9Sstevel@tonic-gate /*
5767c478bd9Sstevel@tonic-gate  * For global monitoring of the reference and modified bits
5777c478bd9Sstevel@tonic-gate  * of all address spaces we reserve one id bit.
5787c478bd9Sstevel@tonic-gate  */
5797c478bd9Sstevel@tonic-gate #define	HRM_SWSMONID	1
5807c478bd9Sstevel@tonic-gate 
5817c478bd9Sstevel@tonic-gate 
5827c478bd9Sstevel@tonic-gate #ifdef _KERNEL
5837c478bd9Sstevel@tonic-gate 
5847c478bd9Sstevel@tonic-gate /*
5857c478bd9Sstevel@tonic-gate  * Hat locking functions
5867c478bd9Sstevel@tonic-gate  * XXX - these two functions are currently being used by hatstats
5877c478bd9Sstevel@tonic-gate  * 	they can be removed by using a per-as mutex for hatstats.
5887c478bd9Sstevel@tonic-gate  */
5897c478bd9Sstevel@tonic-gate void	hat_enter(struct hat *);
5907c478bd9Sstevel@tonic-gate void	hat_exit(struct hat *);
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
5937c478bd9Sstevel@tonic-gate 
5947c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
5957c478bd9Sstevel@tonic-gate }
5967c478bd9Sstevel@tonic-gate #endif
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate #endif	/* _VM_HAT_H */
599