xref: /titanic_50/usr/src/uts/i86pc/vm/hment.h (revision 29e83d4b25fd82feb8e0e0fbe89f7e2a8438533d)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 
37 struct hment;
38 typedef struct hment hment_t;
39 
40 #if defined(_KERNEL)
41 
42 /*
43  * Remove a page mapping, finds the matching mapping and unlinks it from
44  * the page_t. If it returns a non-NULL pointer, the pointer must be
45  * freed via hment_free() after doing x86_hm_exit().
46  */
47 extern hment_t *hment_remove(page_t *, htable_t *ht, uint_t entry);
48 extern void hment_free(hment_t *);
49 
50 /*
51  * Iterator to walk through all mappings of a page.
52  */
53 extern hment_t *hment_walk(page_t *, htable_t **, uint_t *, hment_t *);
54 
55 /*
56  * Prepare a page for a new mapping
57  */
58 extern hment_t *hment_prepare(htable_t *ht, uint_t entry, page_t *);
59 
60 /*
61  * Add a mapping to a page's mapping list
62  */
63 extern void hment_assign(htable_t *ht, uint_t entry, page_t *, hment_t *);
64 
65 /*
66  * initialize hment data structures
67  */
68 extern void hment_init(void);
69 
70 /*
71  * lock/unlock a page_t's mapping list/pte entry
72  */
73 extern void x86_hm_enter(page_t *);
74 extern void x86_hm_exit(page_t *);
75 extern int x86_hm_held(page_t *pp);
76 
77 /*
78  * Called to allocate additional hments for reserve.
79  *
80  * The hment_reserve_count is exported for use by htable_hment_steal()
81  */
82 extern void hment_reserve(uint_t);
83 extern uint_t hment_reserve_count;
84 
85 /*
86  * Used to readjust the hment reserve after the reserve list has been used.
87  * Also called after boot to release left over boot reserves.
88  */
89 extern void hment_adjust_reserve(void);
90 
91 /*
92  * Return the number of mappings of a page_t
93  */
94 extern uint_t hment_mapcnt(page_t *);
95 
96 #endif	/* _KERNEL */
97 
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif	/* _VM_HMENT_H */
104