1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _VM_HMENT_H 28 #define _VM_HMENT_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 35 struct hment; 36 typedef struct hment hment_t; 37 38 #if defined(_KERNEL) 39 40 /* 41 * Remove a page mapping, finds the matching mapping and unlinks it from 42 * the page_t. If it returns a non-NULL pointer, the pointer must be 43 * freed via hment_free() after doing x86_hm_exit(). 44 */ 45 extern hment_t *hment_remove(page_t *, htable_t *ht, uint_t entry); 46 extern void hment_free(hment_t *); 47 48 /* 49 * Iterator to walk through all mappings of a page. 50 */ 51 extern hment_t *hment_walk(page_t *, htable_t **, uint_t *, hment_t *); 52 53 /* 54 * Prepare a page for a new mapping 55 */ 56 extern hment_t *hment_prepare(htable_t *ht, uint_t entry, page_t *); 57 58 /* 59 * Add a mapping to a page's mapping list 60 */ 61 extern void hment_assign(htable_t *ht, uint_t entry, page_t *, hment_t *); 62 63 /* 64 * initialize hment data structures 65 */ 66 extern void hment_init(void); 67 68 /* 69 * lock/unlock a page_t's mapping list/pte entry 70 */ 71 extern void x86_hm_enter(page_t *); 72 extern void x86_hm_exit(page_t *); 73 extern int x86_hm_held(page_t *pp); 74 75 /* 76 * Called to allocate additional hments for reserve. 77 * 78 * The hment_reserve_count is exported for use by htable_hment_steal() 79 */ 80 extern void hment_reserve(uint_t); 81 extern uint_t hment_reserve_count; 82 83 /* 84 * Used to readjust the hment reserve after the reserve list has been used. 85 * Also called after boot to release left over boot reserves. 86 */ 87 extern void hment_adjust_reserve(void); 88 89 /* 90 * Return the number of mappings of a page_t 91 */ 92 extern uint_t hment_mapcnt(page_t *); 93 94 #endif /* _KERNEL */ 95 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif /* _VM_HMENT_H */ 102