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 5d0662dbfSelowe * Common Development and Distribution License (the "License"). 6d0662dbfSelowe * 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 /* 22d20abfaaSPavel Tatashin * 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_HAT_H 407c478bd9Sstevel@tonic-gate #define _VM_HAT_H 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #include <sys/types.h> 437c478bd9Sstevel@tonic-gate #include <sys/t_lock.h> 447c478bd9Sstevel@tonic-gate #include <vm/faultcode.h> 457c478bd9Sstevel@tonic-gate #include <sys/kstat.h> 467c478bd9Sstevel@tonic-gate #include <sys/siginfo.h> 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #ifdef __cplusplus 497c478bd9Sstevel@tonic-gate extern "C" { 507c478bd9Sstevel@tonic-gate #endif 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* 537c478bd9Sstevel@tonic-gate * VM - Hardware Address Translation management. 547c478bd9Sstevel@tonic-gate * 557c478bd9Sstevel@tonic-gate * This file describes the machine independent interfaces to 567c478bd9Sstevel@tonic-gate * the hardware address translation management routines. Other 577c478bd9Sstevel@tonic-gate * machine specific interfaces and structures are defined 587c478bd9Sstevel@tonic-gate * in <vm/hat_xxx.h>. The hat layer manages the address 597c478bd9Sstevel@tonic-gate * translation hardware as a cache driven by calls from the 607c478bd9Sstevel@tonic-gate * higher levels of the VM system. 617c478bd9Sstevel@tonic-gate */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate struct hat; 647c478bd9Sstevel@tonic-gate struct kpme; 657c478bd9Sstevel@tonic-gate struct memseg; 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate #include <vm/page.h> 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * a callback used with hat_unload_callback() 717c478bd9Sstevel@tonic-gate * start and end mark are set to a range of unloaded addresses 727c478bd9Sstevel@tonic-gate * and the function is invoked with a pointer to this data structure 737c478bd9Sstevel@tonic-gate */ 747c478bd9Sstevel@tonic-gate typedef struct hat_callback { 757c478bd9Sstevel@tonic-gate caddr_t hcb_start_addr; 767c478bd9Sstevel@tonic-gate caddr_t hcb_end_addr; 777c478bd9Sstevel@tonic-gate void (*hcb_function)(struct hat_callback *); 787c478bd9Sstevel@tonic-gate void *hcb_data; 797c478bd9Sstevel@tonic-gate } hat_callback_t; 807c478bd9Sstevel@tonic-gate 8105d3dc4bSpaulsan typedef void *hat_region_cookie_t; 8205d3dc4bSpaulsan 837c478bd9Sstevel@tonic-gate #ifdef _KERNEL 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * One time hat initialization 877c478bd9Sstevel@tonic-gate */ 887c478bd9Sstevel@tonic-gate void hat_init(void); 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * Notify hat of a system dump 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate void hat_dump(void); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate /* 967c478bd9Sstevel@tonic-gate * Operations on an address space: 977c478bd9Sstevel@tonic-gate * 987c478bd9Sstevel@tonic-gate * struct hat *hat_alloc(as) 997c478bd9Sstevel@tonic-gate * allocated a hat structure for as. 1007c478bd9Sstevel@tonic-gate * 1017c478bd9Sstevel@tonic-gate * void hat_free_start(hat) 1027c478bd9Sstevel@tonic-gate * informs hat layer process has finished executing but as has not 1037c478bd9Sstevel@tonic-gate * been cleaned up yet. 1047c478bd9Sstevel@tonic-gate * 1057c478bd9Sstevel@tonic-gate * void hat_free_end(hat) 1067c478bd9Sstevel@tonic-gate * informs hat layer as is being destroyed. hat layer cannot use as 1077c478bd9Sstevel@tonic-gate * pointer after this call. 1087c478bd9Sstevel@tonic-gate * 1097c478bd9Sstevel@tonic-gate * void hat_swapin(hat) 1107c478bd9Sstevel@tonic-gate * allocate any hat resources required for process being swapped in. 1117c478bd9Sstevel@tonic-gate * 1127c478bd9Sstevel@tonic-gate * void hat_swapout(hat) 1137c478bd9Sstevel@tonic-gate * deallocate hat resources for process being swapped out. 1147c478bd9Sstevel@tonic-gate * 1157c478bd9Sstevel@tonic-gate * size_t hat_get_mapped_size(hat) 1167c478bd9Sstevel@tonic-gate * returns number of bytes that have valid mappings in hat. 1177c478bd9Sstevel@tonic-gate * 1187c478bd9Sstevel@tonic-gate * void hat_stats_enable(hat) 1197c478bd9Sstevel@tonic-gate * void hat_stats_disable(hat) 1207c478bd9Sstevel@tonic-gate * enables/disables collection of stats for hat. 1217c478bd9Sstevel@tonic-gate * 1227c478bd9Sstevel@tonic-gate * int hat_dup(parenthat, childhat, addr, len, flags) 1237c478bd9Sstevel@tonic-gate * Duplicate address translations of the parent to the child. Supports 1247c478bd9Sstevel@tonic-gate * the entire address range or a range depending on flag, 1257c478bd9Sstevel@tonic-gate * zero returned on success, non-zero on error 1267c478bd9Sstevel@tonic-gate * 1277c478bd9Sstevel@tonic-gate * void hat_thread_exit(thread) 1287c478bd9Sstevel@tonic-gate * Notifies the HAT that a thread is exiting, called after it has been 1297c478bd9Sstevel@tonic-gate * reassigned to the kernel AS. 1307c478bd9Sstevel@tonic-gate */ 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate struct hat *hat_alloc(struct as *); 1337c478bd9Sstevel@tonic-gate void hat_free_start(struct hat *); 1347c478bd9Sstevel@tonic-gate void hat_free_end(struct hat *); 1357c478bd9Sstevel@tonic-gate int hat_dup(struct hat *, struct hat *, caddr_t, size_t, uint_t); 1367c478bd9Sstevel@tonic-gate void hat_swapin(struct hat *); 1377c478bd9Sstevel@tonic-gate void hat_swapout(struct hat *); 1387c478bd9Sstevel@tonic-gate size_t hat_get_mapped_size(struct hat *); 1397c478bd9Sstevel@tonic-gate int hat_stats_enable(struct hat *); 1407c478bd9Sstevel@tonic-gate void hat_stats_disable(struct hat *); 1417c478bd9Sstevel@tonic-gate void hat_thread_exit(kthread_t *); 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /* 1447c478bd9Sstevel@tonic-gate * Operations on a named address within a segment: 1457c478bd9Sstevel@tonic-gate * 1467c478bd9Sstevel@tonic-gate * void hat_memload(hat, addr, pp, attr, flags) 1477c478bd9Sstevel@tonic-gate * load/lock the given page struct 1487c478bd9Sstevel@tonic-gate * 1497c478bd9Sstevel@tonic-gate * void hat_memload_array(hat, addr, len, ppa, attr, flags) 1507c478bd9Sstevel@tonic-gate * load/lock the given array of page structs 1517c478bd9Sstevel@tonic-gate * 1527c478bd9Sstevel@tonic-gate * void hat_devload(hat, addr, len, pf, attr, flags) 1537c478bd9Sstevel@tonic-gate * load/lock the given page frame number 1547c478bd9Sstevel@tonic-gate * 1557c478bd9Sstevel@tonic-gate * void hat_unlock(hat, addr, len) 1567c478bd9Sstevel@tonic-gate * unlock a given range of addresses 1577c478bd9Sstevel@tonic-gate * 1587c478bd9Sstevel@tonic-gate * void hat_unload(hat, addr, len, flags) 1597c478bd9Sstevel@tonic-gate * void hat_unload_callback(hat, addr, len, flags, callback) 1607c478bd9Sstevel@tonic-gate * unload a given range of addresses (has optional callback) 1617c478bd9Sstevel@tonic-gate * 1627c478bd9Sstevel@tonic-gate * void hat_sync(hat, addr, len, flags) 1637c478bd9Sstevel@tonic-gate * synchronize mapping with software data structures 1647c478bd9Sstevel@tonic-gate * 1657c478bd9Sstevel@tonic-gate * void hat_map(hat, addr, len, flags) 1667c478bd9Sstevel@tonic-gate * 1677c478bd9Sstevel@tonic-gate * void hat_setattr(hat, addr, len, attr) 1687c478bd9Sstevel@tonic-gate * void hat_clrattr(hat, addr, len, attr) 1697c478bd9Sstevel@tonic-gate * void hat_chgattr(hat, addr, len, attr) 1707c478bd9Sstevel@tonic-gate * modify attributes for a range of addresses. skips any invalid mappings 1717c478bd9Sstevel@tonic-gate * 1727c478bd9Sstevel@tonic-gate * uint_t hat_getattr(hat, addr, *attr) 1737c478bd9Sstevel@tonic-gate * returns attr for <hat,addr> in *attr. returns 0 if there was a 1747c478bd9Sstevel@tonic-gate * mapping and *attr is valid, nonzero if there was no mapping and 1757c478bd9Sstevel@tonic-gate * *attr is not valid. 1767c478bd9Sstevel@tonic-gate * 1777c478bd9Sstevel@tonic-gate * size_t hat_getpagesize(hat, addr) 1787c478bd9Sstevel@tonic-gate * returns pagesize in bytes for <hat, addr>. returns -1 if there is 1797c478bd9Sstevel@tonic-gate * no mapping. This is an advisory call. 1807c478bd9Sstevel@tonic-gate * 1817c478bd9Sstevel@tonic-gate * pfn_t hat_getpfnum(hat, addr) 1827c478bd9Sstevel@tonic-gate * returns pfn for <hat, addr> or PFN_INVALID if mapping is invalid. 1837c478bd9Sstevel@tonic-gate * 1847c478bd9Sstevel@tonic-gate * int hat_probe(hat, addr) 1857c478bd9Sstevel@tonic-gate * return 0 if no valid mapping is present. Faster version 1867c478bd9Sstevel@tonic-gate * of hat_getattr in certain architectures. 1877c478bd9Sstevel@tonic-gate * 1887c478bd9Sstevel@tonic-gate * int hat_share(dhat, daddr, shat, saddr, len, szc) 1897c478bd9Sstevel@tonic-gate * 1907c478bd9Sstevel@tonic-gate * void hat_unshare(hat, addr, len, szc) 1917c478bd9Sstevel@tonic-gate * 1927c478bd9Sstevel@tonic-gate * void hat_chgprot(hat, addr, len, vprot) 1937c478bd9Sstevel@tonic-gate * This is a deprecated call. New segment drivers should store 1947c478bd9Sstevel@tonic-gate * all attributes and use hat_*attr calls. 1957c478bd9Sstevel@tonic-gate * Change the protections in the virtual address range 1967c478bd9Sstevel@tonic-gate * given to the specified virtual protection. If vprot is ~PROT_WRITE, 1977c478bd9Sstevel@tonic-gate * then remove write permission, leaving the other permissions 1987c478bd9Sstevel@tonic-gate * unchanged. If vprot is ~PROT_USER, remove user permissions. 199*ca3e8d88SDave Plauger * 200*ca3e8d88SDave Plauger * void hat_flush_range(hat, addr, size) 201*ca3e8d88SDave Plauger * Invalidate a virtual address translation for the local CPU. 2027c478bd9Sstevel@tonic-gate */ 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate void hat_memload(struct hat *, caddr_t, struct page *, uint_t, uint_t); 2057c478bd9Sstevel@tonic-gate void hat_memload_array(struct hat *, caddr_t, size_t, struct page **, 2067c478bd9Sstevel@tonic-gate uint_t, uint_t); 20705d3dc4bSpaulsan void hat_memload_region(struct hat *, caddr_t, struct page *, uint_t, 20805d3dc4bSpaulsan uint_t, hat_region_cookie_t); 20905d3dc4bSpaulsan void hat_memload_array_region(struct hat *, caddr_t, size_t, struct page **, 21005d3dc4bSpaulsan uint_t, uint_t, hat_region_cookie_t); 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate void hat_devload(struct hat *, caddr_t, size_t, pfn_t, uint_t, int); 21305d3dc4bSpaulsan 2147c478bd9Sstevel@tonic-gate void hat_unlock(struct hat *, caddr_t, size_t); 21505d3dc4bSpaulsan void hat_unlock_region(struct hat *, caddr_t, size_t, hat_region_cookie_t); 21605d3dc4bSpaulsan 2177c478bd9Sstevel@tonic-gate void hat_unload(struct hat *, caddr_t, size_t, uint_t); 2187c478bd9Sstevel@tonic-gate void hat_unload_callback(struct hat *, caddr_t, size_t, uint_t, 2197c478bd9Sstevel@tonic-gate hat_callback_t *); 220*ca3e8d88SDave Plauger void hat_flush_range(struct hat *, caddr_t, size_t); 2217c478bd9Sstevel@tonic-gate void hat_sync(struct hat *, caddr_t, size_t, uint_t); 2227c478bd9Sstevel@tonic-gate void hat_map(struct hat *, caddr_t, size_t, uint_t); 2237c478bd9Sstevel@tonic-gate void hat_setattr(struct hat *, caddr_t, size_t, uint_t); 2247c478bd9Sstevel@tonic-gate void hat_clrattr(struct hat *, caddr_t, size_t, uint_t); 2257c478bd9Sstevel@tonic-gate void hat_chgattr(struct hat *, caddr_t, size_t, uint_t); 2267c478bd9Sstevel@tonic-gate uint_t hat_getattr(struct hat *, caddr_t, uint_t *); 2277c478bd9Sstevel@tonic-gate ssize_t hat_getpagesize(struct hat *, caddr_t); 2287c478bd9Sstevel@tonic-gate pfn_t hat_getpfnum(struct hat *, caddr_t); 2297c478bd9Sstevel@tonic-gate int hat_probe(struct hat *, caddr_t); 2307c478bd9Sstevel@tonic-gate int hat_share(struct hat *, caddr_t, struct hat *, caddr_t, size_t, uint_t); 2317c478bd9Sstevel@tonic-gate void hat_unshare(struct hat *, caddr_t, size_t, uint_t); 2327c478bd9Sstevel@tonic-gate void hat_chgprot(struct hat *, caddr_t, size_t, uint_t); 2337c478bd9Sstevel@tonic-gate void hat_reserve(struct as *, caddr_t, size_t); 2347c478bd9Sstevel@tonic-gate pfn_t va_to_pfn(void *); 2357c478bd9Sstevel@tonic-gate uint64_t va_to_pa(void *); 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate /* 2387c478bd9Sstevel@tonic-gate * Kernel Physical Mapping (segkpm) hat interface routines. 2397c478bd9Sstevel@tonic-gate */ 2407c478bd9Sstevel@tonic-gate caddr_t hat_kpm_mapin(struct page *, struct kpme *); 2417c478bd9Sstevel@tonic-gate void hat_kpm_mapout(struct page *, struct kpme *, caddr_t); 242d20abfaaSPavel Tatashin caddr_t hat_kpm_mapin_pfn(pfn_t); 243d20abfaaSPavel Tatashin void hat_kpm_mapout_pfn(pfn_t); 2447c478bd9Sstevel@tonic-gate caddr_t hat_kpm_page2va(struct page *, int); 2457c478bd9Sstevel@tonic-gate struct page *hat_kpm_vaddr2page(caddr_t); 2467c478bd9Sstevel@tonic-gate int hat_kpm_fault(struct hat *, caddr_t); 2477c478bd9Sstevel@tonic-gate void hat_kpm_mseghash_clear(int); 2487c478bd9Sstevel@tonic-gate void hat_kpm_mseghash_update(pgcnt_t, struct memseg *); 2497c478bd9Sstevel@tonic-gate void hat_kpm_addmem_mseg_update(struct memseg *, pgcnt_t, offset_t); 2507c478bd9Sstevel@tonic-gate void hat_kpm_addmem_mseg_insert(struct memseg *); 2517c478bd9Sstevel@tonic-gate void hat_kpm_addmem_memsegs_update(struct memseg *); 2527c478bd9Sstevel@tonic-gate caddr_t hat_kpm_mseg_reuse(struct memseg *); 2537c478bd9Sstevel@tonic-gate void hat_kpm_delmem_mseg_update(struct memseg *, struct memseg **); 2547c478bd9Sstevel@tonic-gate void hat_kpm_split_mseg_update(struct memseg *, struct memseg **, 2557c478bd9Sstevel@tonic-gate struct memseg *, struct memseg *, struct memseg *); 2567c478bd9Sstevel@tonic-gate void hat_kpm_walk(void (*)(void *, void *, size_t), void *); 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate /* 2597c478bd9Sstevel@tonic-gate * Operations on all translations for a given page(s) 2607c478bd9Sstevel@tonic-gate * 2617c478bd9Sstevel@tonic-gate * void hat_page_setattr(pp, flag) 2627c478bd9Sstevel@tonic-gate * void hat_page_clrattr(pp, flag) 2637c478bd9Sstevel@tonic-gate * used to set/clr red/mod bits. 2647c478bd9Sstevel@tonic-gate * 2657c478bd9Sstevel@tonic-gate * uint hat_page_getattr(pp, flag) 2667c478bd9Sstevel@tonic-gate * If flag is specified, returns 0 if attribute is disabled 2677c478bd9Sstevel@tonic-gate * and non zero if enabled. If flag specifes multiple attributs 2687c478bd9Sstevel@tonic-gate * then returns 0 if ALL atriibutes are disabled. This is an advisory 2697c478bd9Sstevel@tonic-gate * call. 2707c478bd9Sstevel@tonic-gate * 2717c478bd9Sstevel@tonic-gate * int hat_pageunload(pp, forceflag) 2727c478bd9Sstevel@tonic-gate * unload all translations attached to pp. 2737c478bd9Sstevel@tonic-gate * 2747c478bd9Sstevel@tonic-gate * uint_t hat_pagesync(pp, flags) 2757c478bd9Sstevel@tonic-gate * get hw stats from hardware into page struct and reset hw stats 2767c478bd9Sstevel@tonic-gate * returns attributes of page 2777c478bd9Sstevel@tonic-gate * 2787c478bd9Sstevel@tonic-gate * ulong_t hat_page_getshare(pp) 2797c478bd9Sstevel@tonic-gate * returns approx number of mappings to this pp. A return of 0 implies 2807c478bd9Sstevel@tonic-gate * there are no mappings to the page. 2817c478bd9Sstevel@tonic-gate * 2827c478bd9Sstevel@tonic-gate * faultcode_t hat_softlock(hat, addr, lenp, ppp, flags); 2837c478bd9Sstevel@tonic-gate * called to softlock pages for zero copy tcp 2847c478bd9Sstevel@tonic-gate * 2857c478bd9Sstevel@tonic-gate * void hat_page_demote(pp); 2867c478bd9Sstevel@tonic-gate * unload all large mappings to pp and decrease p_szc of all 2877c478bd9Sstevel@tonic-gate * constituent pages according to the remaining mappings. 2887c478bd9Sstevel@tonic-gate */ 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate void hat_page_setattr(struct page *, uint_t); 2917c478bd9Sstevel@tonic-gate void hat_page_clrattr(struct page *, uint_t); 2927c478bd9Sstevel@tonic-gate uint_t hat_page_getattr(struct page *, uint_t); 2937c478bd9Sstevel@tonic-gate int hat_pageunload(struct page *, uint_t); 2947c478bd9Sstevel@tonic-gate uint_t hat_pagesync(struct page *, uint_t); 2957c478bd9Sstevel@tonic-gate ulong_t hat_page_getshare(struct page *); 29605d3dc4bSpaulsan int hat_page_checkshare(struct page *, ulong_t); 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 */ 30705d3dc4bSpaulsan HAT_VMODSORT, /* support for VMODSORT flag of vnode */ 30805d3dc4bSpaulsan HAT_SHARED_REGIONS /* shared regions support */ 3097c478bd9Sstevel@tonic-gate }; 3107c478bd9Sstevel@tonic-gate 3117c478bd9Sstevel@tonic-gate int hat_supported(enum hat_features, void *); 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate /* 3147c478bd9Sstevel@tonic-gate * Services provided to the hat: 3157c478bd9Sstevel@tonic-gate * 3167c478bd9Sstevel@tonic-gate * void as_signal_proc(as, siginfo) 3177c478bd9Sstevel@tonic-gate * deliver signal to all processes that have this as. 3187c478bd9Sstevel@tonic-gate * 3197c478bd9Sstevel@tonic-gate * int hat_setstat(as, addr, len, rmbits) 3207c478bd9Sstevel@tonic-gate * informs hatstat layer that ref/mod bits need to be updated for 3217c478bd9Sstevel@tonic-gate * address range. Returns 0 on success, 1 for failure. 3227c478bd9Sstevel@tonic-gate */ 3237c478bd9Sstevel@tonic-gate void as_signal_proc(struct as *, k_siginfo_t *siginfo); 3247c478bd9Sstevel@tonic-gate void hat_setstat(struct as *, caddr_t, size_t, uint_t); 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate /* 3277c478bd9Sstevel@tonic-gate * Flags to pass to hat routines. 3287c478bd9Sstevel@tonic-gate * 3297c478bd9Sstevel@tonic-gate * Certain flags only apply to some interfaces: 3307c478bd9Sstevel@tonic-gate * 3317c478bd9Sstevel@tonic-gate * HAT_LOAD Default flags to load a translation to the page. 3327c478bd9Sstevel@tonic-gate * HAT_LOAD_LOCK Lock down mapping resources; hat_map(), hat_memload(), 3337c478bd9Sstevel@tonic-gate * and hat_devload(). 3347c478bd9Sstevel@tonic-gate * HAT_LOAD_ADV Advisory load - Load translation if and only if 3357c478bd9Sstevel@tonic-gate * sufficient MMU resources exist (i.e., do not steal). 3367c478bd9Sstevel@tonic-gate * HAT_LOAD_SHARE A flag to hat_memload() to indicate h/w page tables 3377c478bd9Sstevel@tonic-gate * that map some user pages (not kas) is shared by more 3387c478bd9Sstevel@tonic-gate * than one process (eg. ISM). 3397c478bd9Sstevel@tonic-gate * HAT_LOAD_CONTIG Pages are contigous 3407c478bd9Sstevel@tonic-gate * HAT_LOAD_NOCONSIST Do not add mapping to mapping list. 3417c478bd9Sstevel@tonic-gate * HAT_LOAD_REMAP Reload a valid pte with a different page frame. 3427c478bd9Sstevel@tonic-gate * HAT_RELOAD_SHARE Reload a shared page table entry. Some platforms 3437c478bd9Sstevel@tonic-gate * may require different actions than on the first 3447c478bd9Sstevel@tonic-gate * load of a shared mapping. 3457c478bd9Sstevel@tonic-gate * HAT_NO_KALLOC Do not kmem_alloc while creating the mapping; at this 3467c478bd9Sstevel@tonic-gate * point, it's setting up mapping to allocate internal 3477c478bd9Sstevel@tonic-gate * hat layer data structures. This flag forces hat layer 3487c478bd9Sstevel@tonic-gate * to tap its reserves in order to prevent infinite 3497c478bd9Sstevel@tonic-gate * recursion. 350ec25b48fSsusans * HAT_LOAD_TEXT A flag to hat_memload() to indicate loading text pages. 3517c478bd9Sstevel@tonic-gate */ 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate /* 3547c478bd9Sstevel@tonic-gate * Flags for hat_memload/hat_devload 3557c478bd9Sstevel@tonic-gate */ 3567c478bd9Sstevel@tonic-gate #define HAT_FLAGS_RESV 0xFF000000 /* resv for hat impl */ 3577c478bd9Sstevel@tonic-gate #define HAT_LOAD 0x00 3587c478bd9Sstevel@tonic-gate #define HAT_LOAD_LOCK 0x01 3597c478bd9Sstevel@tonic-gate #define HAT_LOAD_ADV 0x04 3607c478bd9Sstevel@tonic-gate #define HAT_LOAD_CONTIG 0x10 3617c478bd9Sstevel@tonic-gate #define HAT_LOAD_NOCONSIST 0x20 3627c478bd9Sstevel@tonic-gate #define HAT_LOAD_SHARE 0x40 3637c478bd9Sstevel@tonic-gate #define HAT_LOAD_REMAP 0x80 3647c478bd9Sstevel@tonic-gate #define HAT_RELOAD_SHARE 0x100 3657c478bd9Sstevel@tonic-gate #define HAT_NO_KALLOC 0x200 3667c478bd9Sstevel@tonic-gate #define HAT_LOAD_TEXT 0x400 367ec25b48fSsusans 368ec25b48fSsusans /* 369ec25b48fSsusans * Flags for initializing disable_*large_pages. 370ec25b48fSsusans * 371ec25b48fSsusans * HAT_AUTO_TEXT Get MMU specific disable_auto_text_large_pages 372ec25b48fSsusans * HAT_AUTO_DATA Get MMU specific disable_auto_data_large_pages 373ec25b48fSsusans */ 374ec25b48fSsusans #define HAT_AUTO_TEXT 0x800 375ec25b48fSsusans #define HAT_AUTO_DATA 0x1000 3767c478bd9Sstevel@tonic-gate 3777c478bd9Sstevel@tonic-gate /* 3787c478bd9Sstevel@tonic-gate * Attributes for hat_memload/hat_devload/hat_*attr 3797c478bd9Sstevel@tonic-gate * are a superset of prot flags defined in mman.h. 3807c478bd9Sstevel@tonic-gate */ 3817c478bd9Sstevel@tonic-gate #define HAT_PLAT_ATTR_MASK 0xF00000 3827c478bd9Sstevel@tonic-gate #define HAT_PROT_MASK 0x0F 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate #define HAT_NOFAULT 0x10 3857c478bd9Sstevel@tonic-gate #define HAT_NOSYNC 0x20 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate /* 3887c478bd9Sstevel@tonic-gate * Advisory ordering attributes. Apply only to device mappings. 3897c478bd9Sstevel@tonic-gate * 3907c478bd9Sstevel@tonic-gate * HAT_STRICTORDER: the CPU must issue the references in order, as the 3917c478bd9Sstevel@tonic-gate * programmer specified. This is the default. 3927c478bd9Sstevel@tonic-gate * HAT_UNORDERED_OK: the CPU may reorder the references (this is all kinds 3937c478bd9Sstevel@tonic-gate * of reordering; store or load with store or load). 3947c478bd9Sstevel@tonic-gate * HAT_MERGING_OK: merging and batching: the CPU may merge individual stores 3957c478bd9Sstevel@tonic-gate * to consecutive locations (for example, turn two consecutive byte 3967c478bd9Sstevel@tonic-gate * stores into one halfword store), and it may batch individual loads 3977c478bd9Sstevel@tonic-gate * (for example, turn two consecutive byte loads into one halfword load). 3987c478bd9Sstevel@tonic-gate * This also implies re-ordering. 3997c478bd9Sstevel@tonic-gate * HAT_LOADCACHING_OK: the CPU may cache the data it fetches and reuse it 4007c478bd9Sstevel@tonic-gate * until another store occurs. The default is to fetch new data 4017c478bd9Sstevel@tonic-gate * on every load. This also implies merging. 4027c478bd9Sstevel@tonic-gate * HAT_STORECACHING_OK: the CPU may keep the data in the cache and push it to 4037c478bd9Sstevel@tonic-gate * the device (perhaps with other data) at a later time. The default is 4047c478bd9Sstevel@tonic-gate * to push the data right away. This also implies load caching. 4057c478bd9Sstevel@tonic-gate */ 4067c478bd9Sstevel@tonic-gate #define HAT_STRICTORDER 0x0000 4077c478bd9Sstevel@tonic-gate #define HAT_UNORDERED_OK 0x0100 4087c478bd9Sstevel@tonic-gate #define HAT_MERGING_OK 0x0200 4097c478bd9Sstevel@tonic-gate #define HAT_LOADCACHING_OK 0x0300 4107c478bd9Sstevel@tonic-gate #define HAT_STORECACHING_OK 0x0400 4117c478bd9Sstevel@tonic-gate #define HAT_ORDER_MASK 0x0700 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate /* endian attributes */ 4147c478bd9Sstevel@tonic-gate #define HAT_NEVERSWAP 0x0000 4157c478bd9Sstevel@tonic-gate #define HAT_STRUCTURE_BE 0x1000 4167c478bd9Sstevel@tonic-gate #define HAT_STRUCTURE_LE 0x2000 4177c478bd9Sstevel@tonic-gate #define HAT_ENDIAN_MASK 0x3000 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate /* flags for hat_softlock */ 4207c478bd9Sstevel@tonic-gate #define HAT_COW 0x0001 4217c478bd9Sstevel@tonic-gate 4227c478bd9Sstevel@tonic-gate /* 4237c478bd9Sstevel@tonic-gate * Flags for hat_unload 4247c478bd9Sstevel@tonic-gate */ 4257c478bd9Sstevel@tonic-gate #define HAT_UNLOAD 0x00 4267c478bd9Sstevel@tonic-gate #define HAT_UNLOAD_NOSYNC 0x02 4277c478bd9Sstevel@tonic-gate #define HAT_UNLOAD_UNLOCK 0x04 4287c478bd9Sstevel@tonic-gate #define HAT_UNLOAD_OTHER 0x08 4297c478bd9Sstevel@tonic-gate #define HAT_UNLOAD_UNMAP 0x10 4307c478bd9Sstevel@tonic-gate 4317c478bd9Sstevel@tonic-gate /* 4327c478bd9Sstevel@tonic-gate * Flags for hat_pagesync, hat_getstat, hat_sync 4337c478bd9Sstevel@tonic-gate */ 4347c478bd9Sstevel@tonic-gate #define HAT_SYNC_DONTZERO 0x00 4357c478bd9Sstevel@tonic-gate #define HAT_SYNC_ZERORM 0x01 4367c478bd9Sstevel@tonic-gate /* Additional flags for hat_pagesync */ 4377c478bd9Sstevel@tonic-gate #define HAT_SYNC_STOPON_REF 0x02 4387c478bd9Sstevel@tonic-gate #define HAT_SYNC_STOPON_MOD 0x04 4397c478bd9Sstevel@tonic-gate #define HAT_SYNC_STOPON_RM (HAT_SYNC_STOPON_REF | HAT_SYNC_STOPON_MOD) 4407c478bd9Sstevel@tonic-gate #define HAT_SYNC_STOPON_SHARED 0x08 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate /* 4437c478bd9Sstevel@tonic-gate * Flags for hat_dup 4447c478bd9Sstevel@tonic-gate * 4457c478bd9Sstevel@tonic-gate * HAT_DUP_ALL dup entire address space 4467c478bd9Sstevel@tonic-gate * HAT_DUP_COW dup plus hat_clrattr(..PROT_WRITE) on newas 4477c478bd9Sstevel@tonic-gate */ 4487c478bd9Sstevel@tonic-gate #define HAT_DUP_ALL 1 4497c478bd9Sstevel@tonic-gate #define HAT_DUP_COW 2 45005d3dc4bSpaulsan #define HAT_DUP_SRD 3 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate 4537c478bd9Sstevel@tonic-gate /* 4547c478bd9Sstevel@tonic-gate * Flags for hat_map 4557c478bd9Sstevel@tonic-gate */ 4567c478bd9Sstevel@tonic-gate #define HAT_MAP 0x00 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gate /* 4597c478bd9Sstevel@tonic-gate * Flag for hat_pageunload 4607c478bd9Sstevel@tonic-gate */ 4617c478bd9Sstevel@tonic-gate #define HAT_ADV_PGUNLOAD 0x00 4627c478bd9Sstevel@tonic-gate #define HAT_FORCE_PGUNLOAD 0x01 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate /* 4657c478bd9Sstevel@tonic-gate * Attributes for hat_page_*attr, hat_setstats and 4667c478bd9Sstevel@tonic-gate * returned by hat_pagesync. 4677c478bd9Sstevel@tonic-gate */ 4687c478bd9Sstevel@tonic-gate #define P_MOD 0x1 /* the modified bit */ 4697c478bd9Sstevel@tonic-gate #define P_REF 0x2 /* the referenced bit */ 4707c478bd9Sstevel@tonic-gate #define P_RO 0x4 /* Read only page */ 471d9615970Sqiao #define P_NSH 0x8 /* Not to shuffle v_pages */ 4727c478bd9Sstevel@tonic-gate 4737c478bd9Sstevel@tonic-gate #define hat_ismod(pp) (hat_page_getattr(pp, P_MOD)) 4747c478bd9Sstevel@tonic-gate #define hat_isref(pp) (hat_page_getattr(pp, P_REF)) 4757c478bd9Sstevel@tonic-gate #define hat_isro(pp) (hat_page_getattr(pp, P_RO)) 4767c478bd9Sstevel@tonic-gate 4777c478bd9Sstevel@tonic-gate #define hat_setmod(pp) (hat_page_setattr(pp, P_MOD)) 478d9615970Sqiao #define hat_setmod_only(pp) (hat_page_setattr(pp, P_MOD|P_NSH)) 4797c478bd9Sstevel@tonic-gate #define hat_setref(pp) (hat_page_setattr(pp, P_REF)) 4807c478bd9Sstevel@tonic-gate #define hat_setrefmod(pp) (hat_page_setattr(pp, P_REF|P_MOD)) 4817c478bd9Sstevel@tonic-gate 4827c478bd9Sstevel@tonic-gate #define hat_clrmod(pp) (hat_page_clrattr(pp, P_MOD)) 4837c478bd9Sstevel@tonic-gate #define hat_clrref(pp) (hat_page_clrattr(pp, P_REF)) 4847c478bd9Sstevel@tonic-gate #define hat_clrrefmod(pp) (hat_page_clrattr(pp, P_REF|P_MOD)) 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate #define hat_page_is_mapped(pp) (hat_page_getshare(pp)) 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate /* 4897c478bd9Sstevel@tonic-gate * hat_setup is being used in sparc/os/sundep.c 4907c478bd9Sstevel@tonic-gate */ 4917c478bd9Sstevel@tonic-gate void hat_setup(struct hat *, int); 4927c478bd9Sstevel@tonic-gate 4937c478bd9Sstevel@tonic-gate /* 4947c478bd9Sstevel@tonic-gate * Flags for hat_setup 4957c478bd9Sstevel@tonic-gate */ 4967c478bd9Sstevel@tonic-gate #define HAT_DONTALLOC 0 4977c478bd9Sstevel@tonic-gate #define HAT_ALLOC 1 4987c478bd9Sstevel@tonic-gate #define HAT_INIT 2 4997c478bd9Sstevel@tonic-gate 5007c478bd9Sstevel@tonic-gate /* 5017c478bd9Sstevel@tonic-gate * Other routines, for statistics 5027c478bd9Sstevel@tonic-gate */ 5037c478bd9Sstevel@tonic-gate int hat_startstat(struct as *); 5047c478bd9Sstevel@tonic-gate void hat_getstat(struct as *, caddr_t, size_t, uint_t, char *, int); 5057c478bd9Sstevel@tonic-gate void hat_freestat(struct as *, int); 5067c478bd9Sstevel@tonic-gate void hat_resvstat(size_t, struct as *, caddr_t); 5077c478bd9Sstevel@tonic-gate 5087c478bd9Sstevel@tonic-gate /* 5097c478bd9Sstevel@tonic-gate * Relocation callback routines. Currently only sfmmu HAT supports 5107c478bd9Sstevel@tonic-gate * these. 5117c478bd9Sstevel@tonic-gate */ 5127c478bd9Sstevel@tonic-gate extern int hat_add_callback(id_t, caddr_t, uint_t, uint_t, void *, 513d0662dbfSelowe pfn_t *, void **); 5141bd5c35fSelowe extern id_t hat_register_callback(int, 5157c478bd9Sstevel@tonic-gate int (*prehandler)(caddr_t, uint_t, uint_t, void *), 5167c478bd9Sstevel@tonic-gate int (*posthandler)(caddr_t, uint_t, uint_t, void *, pfn_t), 5177c478bd9Sstevel@tonic-gate int (*errhandler)(caddr_t, uint_t, uint_t, void *), int); 518d0662dbfSelowe extern void hat_delete_callback(caddr_t, uint_t, void *, uint_t, void *); 5197c478bd9Sstevel@tonic-gate 5207c478bd9Sstevel@tonic-gate /* 5217c478bd9Sstevel@tonic-gate * hat_add_callback()/hat_delete_callback() flags. 5227c478bd9Sstevel@tonic-gate */ 5237c478bd9Sstevel@tonic-gate #define HAC_NOSLEEP 0x0 5247c478bd9Sstevel@tonic-gate #define HAC_SLEEP 0x1 5257c478bd9Sstevel@tonic-gate #define HAC_PAGELOCK 0x2 5267c478bd9Sstevel@tonic-gate 5277c478bd9Sstevel@tonic-gate /* 5287c478bd9Sstevel@tonic-gate * Suspend/unsuspend handler callback arguments. 5297c478bd9Sstevel@tonic-gate */ 5307c478bd9Sstevel@tonic-gate #define HAT_SUSPEND 0x0010 5317c478bd9Sstevel@tonic-gate #define HAT_UNSUSPEND 0x0010 5327c478bd9Sstevel@tonic-gate #define HAT_PRESUSPEND 0x0020 5337c478bd9Sstevel@tonic-gate #define HAT_POSTUNSUSPEND 0x0020 5347c478bd9Sstevel@tonic-gate 5357c478bd9Sstevel@tonic-gate /* 5367c478bd9Sstevel@tonic-gate * Error handler callback arguments. See the block comments 5377c478bd9Sstevel@tonic-gate * before the implementation of hat_add_callback() for an 5387c478bd9Sstevel@tonic-gate * explanation of what these mean. 5397c478bd9Sstevel@tonic-gate */ 5407c478bd9Sstevel@tonic-gate #define HAT_CB_ERR_LEAKED 0x1 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 5437c478bd9Sstevel@tonic-gate 5447c478bd9Sstevel@tonic-gate /* 5457c478bd9Sstevel@tonic-gate * The size of the bit array for ref and mod bit storage must be a power of 2. 5467c478bd9Sstevel@tonic-gate * 2 bits are collected for each page. Below the power used is 4, 5477c478bd9Sstevel@tonic-gate * which is 16 8-bit characters = 128 bits, ref and mod bit information 5487c478bd9Sstevel@tonic-gate * for 64 pages. 5497c478bd9Sstevel@tonic-gate */ 5507c478bd9Sstevel@tonic-gate #define HRM_SHIFT 4 5517c478bd9Sstevel@tonic-gate #define HRM_BYTES (1 << HRM_SHIFT) 5527c478bd9Sstevel@tonic-gate #define HRM_PAGES ((HRM_BYTES * NBBY) / 2) 5537c478bd9Sstevel@tonic-gate #define HRM_PGPERBYTE (NBBY/2) 5547c478bd9Sstevel@tonic-gate #define HRM_PGBYTEMASK (HRM_PGPERBYTE-1) 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate #define HRM_PGOFFMASK ((HRM_PGPERBYTE-1) << MMU_PAGESHIFT) 5577c478bd9Sstevel@tonic-gate #define HRM_BASEOFFSET (((MMU_PAGESIZE * HRM_PAGES) - 1)) 5587c478bd9Sstevel@tonic-gate #define HRM_BASEMASK (~(HRM_BASEOFFSET)) 5597c478bd9Sstevel@tonic-gate 5607c478bd9Sstevel@tonic-gate #define HRM_BASESHIFT (MMU_PAGESHIFT + (HRM_SHIFT + 2)) 5617c478bd9Sstevel@tonic-gate #define HRM_PAGEMASK (MMU_PAGEMASK ^ HRM_BASEMASK) 5627c478bd9Sstevel@tonic-gate 5637c478bd9Sstevel@tonic-gate #define HRM_HASHSIZE 0x200 5647c478bd9Sstevel@tonic-gate #define HRM_HASHMASK (HRM_HASHSIZE - 1) 5657c478bd9Sstevel@tonic-gate 5667c478bd9Sstevel@tonic-gate #define HRM_BLIST_INCR 0x200 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate /* 5697c478bd9Sstevel@tonic-gate * The structure for maintaining referenced and modified information 5707c478bd9Sstevel@tonic-gate */ 5717c478bd9Sstevel@tonic-gate struct hrmstat { 5727c478bd9Sstevel@tonic-gate struct as *hrm_as; /* stat block belongs to this as */ 5737c478bd9Sstevel@tonic-gate uintptr_t hrm_base; /* base of block */ 5747c478bd9Sstevel@tonic-gate ushort_t hrm_id; /* opaque identifier, one of a_vbits */ 5757c478bd9Sstevel@tonic-gate struct hrmstat *hrm_anext; /* as statistics block list */ 5767c478bd9Sstevel@tonic-gate struct hrmstat *hrm_hnext; /* list for hashed blocks */ 5777c478bd9Sstevel@tonic-gate uchar_t hrm_bits[HRM_BYTES]; /* the ref and mod bits */ 5787c478bd9Sstevel@tonic-gate }; 5797c478bd9Sstevel@tonic-gate 5809d9461f9Strevtom extern struct hrmstat **hrm_hashtab; 5819d9461f9Strevtom 5827c478bd9Sstevel@tonic-gate /* 5837c478bd9Sstevel@tonic-gate * For global monitoring of the reference and modified bits 5847c478bd9Sstevel@tonic-gate * of all address spaces we reserve one id bit. 5857c478bd9Sstevel@tonic-gate */ 5867c478bd9Sstevel@tonic-gate #define HRM_SWSMONID 1 5877c478bd9Sstevel@tonic-gate 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gate #ifdef _KERNEL 5907c478bd9Sstevel@tonic-gate 5917c478bd9Sstevel@tonic-gate /* 5927c478bd9Sstevel@tonic-gate * Hat locking functions 5937c478bd9Sstevel@tonic-gate * XXX - these two functions are currently being used by hatstats 5947c478bd9Sstevel@tonic-gate * they can be removed by using a per-as mutex for hatstats. 5957c478bd9Sstevel@tonic-gate */ 5967c478bd9Sstevel@tonic-gate void hat_enter(struct hat *); 5977c478bd9Sstevel@tonic-gate void hat_exit(struct hat *); 5987c478bd9Sstevel@tonic-gate 59905d3dc4bSpaulsan typedef void (*hat_rgn_cb_func_t)(caddr_t, caddr_t, caddr_t, 60005d3dc4bSpaulsan size_t, void *, u_offset_t); 60105d3dc4bSpaulsan 60205d3dc4bSpaulsan void hat_join_srd(struct hat *, vnode_t *); 60305d3dc4bSpaulsan 60405d3dc4bSpaulsan hat_region_cookie_t hat_join_region(struct hat *, caddr_t, size_t, void *, 60505d3dc4bSpaulsan u_offset_t, uchar_t, uchar_t, hat_rgn_cb_func_t, 60605d3dc4bSpaulsan uint_t); 60705d3dc4bSpaulsan void hat_leave_region(struct hat *, hat_region_cookie_t, 60805d3dc4bSpaulsan uint_t); 60905d3dc4bSpaulsan void hat_dup_region(struct hat *, hat_region_cookie_t); 61005d3dc4bSpaulsan 61105d3dc4bSpaulsan #define HAT_INVALID_REGION_COOKIE ((hat_region_cookie_t)-1) 61205d3dc4bSpaulsan #define HAT_IS_REGION_COOKIE_VALID(c) ((c) != HAT_INVALID_REGION_COOKIE) 61305d3dc4bSpaulsan 61405d3dc4bSpaulsan /* hat_join_region() flags */ 61505d3dc4bSpaulsan 61605d3dc4bSpaulsan #define HAT_REGION_TEXT 0x1 /* passed by segvn */ 61705d3dc4bSpaulsan #define HAT_REGION_ISM 0x2 /* for hat_share()/hat_unshare() */ 61805d3dc4bSpaulsan 61905d3dc4bSpaulsan #define HAT_REGION_TYPE_MASK (0x7) 62005d3dc4bSpaulsan 6217c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 6227c478bd9Sstevel@tonic-gate 6237c478bd9Sstevel@tonic-gate #ifdef __cplusplus 6247c478bd9Sstevel@tonic-gate } 6257c478bd9Sstevel@tonic-gate #endif 6267c478bd9Sstevel@tonic-gate 6277c478bd9Sstevel@tonic-gate #endif /* _VM_HAT_H */ 628