Print this page
patch vm-cleanup
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/vm/xhat.h
+++ new/usr/src/uts/common/vm/xhat.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 #ifndef _VM_XHAT_H
28 28 #define _VM_XHAT_H
29 29
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 -
33 30 #ifdef __cplusplus
34 31 extern "C" {
35 32 #endif
36 33
37 34 #ifndef _ASM
38 35
39 36 #include <sys/types.h>
40 37 #include <vm/page.h>
41 38 #include <sys/kmem.h>
42 39
43 40 struct xhat;
44 41 struct xhat_hme_blk;
45 42
46 43 struct xhat_ops {
47 44 struct xhat *(*xhat_alloc)(void *);
48 45 void (*xhat_free)(struct xhat *);
49 46 void (*xhat_free_start)(struct xhat *);
50 47 void (*xhat_free_end)(struct xhat *);
51 48 int (*xhat_dup)(struct xhat *, struct xhat *, caddr_t,
52 49 size_t, uint_t);
53 - void (*xhat_swapin)(struct xhat *);
54 - void (*xhat_swapout)(struct xhat *);
55 50 void (*xhat_memload)(struct xhat *, caddr_t, struct page *,
56 51 uint_t, uint_t);
57 52 void (*xhat_memload_array)(struct xhat *, caddr_t, size_t,
58 53 struct page **, uint_t, uint_t);
59 54 void (*xhat_devload)(struct xhat *, caddr_t, size_t, pfn_t,
60 55 uint_t, int);
61 56 void (*xhat_unload)(struct xhat *, caddr_t, size_t, uint_t);
62 57 void (*xhat_unload_callback)(struct xhat *, caddr_t, size_t,
63 58 uint_t, hat_callback_t *);
64 59 void (*xhat_setattr)(struct xhat *, caddr_t, size_t, uint_t);
65 60 void (*xhat_clrattr)(struct xhat *, caddr_t, size_t, uint_t);
66 61 void (*xhat_chgattr)(struct xhat *, caddr_t, size_t, uint_t);
67 62 void (*xhat_unshare)(struct xhat *, caddr_t, size_t);
68 63 void (*xhat_chgprot)(struct xhat *, caddr_t, size_t, uint_t);
69 64 int (*xhat_pageunload)(struct xhat *, struct page *, uint_t,
70 65 void *);
71 66 };
72 67
73 68
74 69 #define XHAT_POPS(_p) (_p)->xhat_provider_ops
75 70 #define XHAT_PROPS(_h) XHAT_POPS(((struct xhat *)(_h))->xhat_provider)
76 71 #define XHAT_HOPS(hat, func, args) \
77 72 { \
78 73 if (XHAT_PROPS(hat)-> /* */ func) \
79 74 XHAT_PROPS(hat)-> /* */ func /* */ args; \
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
80 75 }
81 76
82 77 #define XHAT_FREE_START(a) \
83 78 XHAT_HOPS(a, xhat_free_start, ((struct xhat *)(a)))
84 79 #define XHAT_FREE_END(a) \
85 80 XHAT_HOPS(a, xhat_free_end, ((struct xhat *)(a)))
86 81 #define XHAT_DUP(a, b, c, d, e) \
87 82 ((XHAT_PROPS(a)->xhat_dup == NULL) ? (0) : \
88 83 XHAT_PROPS(a)->xhat_dup((struct xhat *)(a), \
89 84 (struct xhat *)(b), c, d, e))
90 -#define XHAT_SWAPIN(a) \
91 - XHAT_HOPS(a, xhat_swapin, ((struct xhat *)(a)))
92 -#define XHAT_SWAPOUT(a) \
93 - XHAT_HOPS(a, xhat_swapout, ((struct xhat *)(a)))
94 85 #define XHAT_MEMLOAD(a, b, c, d, e) \
95 86 XHAT_HOPS(a, xhat_memload, ((struct xhat *)(a), b, c, d, e))
96 87 #define XHAT_MEMLOAD_ARRAY(a, b, c, d, e, f) \
97 88 XHAT_HOPS(a, xhat_memload_array, ((struct xhat *)(a), b, c, d, e, f))
98 89 #define XHAT_DEVLOAD(a, b, c, d, e, f) \
99 90 XHAT_HOPS(a, xhat_devload, ((struct xhat *)(a), b, c, d, e, f))
100 91 #define XHAT_UNLOAD(a, b, c, d) \
101 92 XHAT_HOPS(a, xhat_unload, ((struct xhat *)(a), b, c, d))
102 93 #define XHAT_UNLOAD_CALLBACK(a, b, c, d, e) \
103 94 XHAT_HOPS(a, xhat_unload_callback, ((struct xhat *)(a), b, c, d, e))
104 95 #define XHAT_SETATTR(a, b, c, d) \
105 96 XHAT_HOPS(a, xhat_setattr, ((struct xhat *)(a), b, c, d))
106 97 #define XHAT_CLRATTR(a, b, c, d) \
107 98 XHAT_HOPS(a, xhat_clrattr, ((struct xhat *)(a), b, c, d))
108 99 #define XHAT_CHGATTR(a, b, c, d) \
109 100 XHAT_HOPS(a, xhat_chgattr, ((struct xhat *)(a), b, c, d))
110 101 #define XHAT_UNSHARE(a, b, c) \
111 102 XHAT_HOPS(a, xhat_unshare, ((struct xhat *)(a), b, c))
112 103 #define XHAT_CHGPROT(a, b, c, d) \
113 104 XHAT_HOPS(a, xhat_chgprot, ((struct xhat *)(a), b, c, d))
114 105 #define XHAT_PAGEUNLOAD(a, b, c, d) \
115 106 ((XHAT_PROPS(a)->xhat_pageunload == NULL) ? (0) : \
116 107 XHAT_PROPS(a)->xhat_pageunload((struct xhat *)(a), b, c, d))
117 108
118 109
119 110
120 111 #define XHAT_PROVIDER_VERSION 1
121 112
122 113 /*
123 114 * Provider name will be appended with "_cache"
124 115 * when initializing kmem cache.
125 116 * The resulting sring must be less than
126 117 * KMEM_CACHE_NAMELEN
127 118 */
128 119 #define XHAT_CACHE_NAMELEN 24
129 120
130 121 typedef struct xblk_cache {
131 122 kmutex_t lock;
132 123 kmem_cache_t *cache;
133 124 void *free_blks;
134 125 void (*reclaim)(void *);
135 126 } xblk_cache_t;
136 127
137 128 typedef struct xhat_provider {
138 129 int xhat_provider_version;
139 130 int xhat_provider_refcnt;
140 131 struct xhat_provider *next;
141 132 struct xhat_provider *prev;
142 133 char xhat_provider_name[XHAT_CACHE_NAMELEN];
143 134 xblk_cache_t *xblkcache;
144 135 struct xhat_ops *xhat_provider_ops;
145 136 int xhat_provider_blk_size;
146 137 } xhat_provider_t;
147 138
148 139 /*
149 140 * The xhat structure is protected by xhat_lock.
150 141 * A particular xhat implementation is a extension of the
151 142 * xhat structure and may contain its own lock(s) to
152 143 * protect those additional fields.
153 144 * The xhat structure is never allocated directly.
154 145 * Instead its allocation is provided by the hat implementation.
155 146 * The xhat provider ops xhat_alloc/xhat_free are used to
156 147 * alloc/free a implementation dependant xhat structure.
157 148 */
158 149 struct xhat {
159 150 xhat_provider_t *xhat_provider;
160 151 struct as *xhat_as;
161 152 void *arg;
162 153 struct xhat *prev;
163 154 struct xhat *next;
164 155 kmutex_t xhat_lock;
165 156 int xhat_refcnt;
166 157 kthread_t *holder;
167 158 };
168 159
169 160
170 161 /* Error codes */
171 162 #define XH_PRVDR (1) /* Provider-specific error */
172 163 #define XH_ASBUSY (2) /* Address space is busy */
173 164 #define XH_XHHELD (3) /* XHAT is being held */
174 165 #define XH_NOTATTCHD (4) /* Provider is not attached to as */
175 166
176 167
177 168 int xhat_provider_register(xhat_provider_t *);
178 169 int xhat_provider_unregister(xhat_provider_t *);
179 170 void xhat_init(void);
180 171 int xhat_attach_xhat(xhat_provider_t *, struct as *, struct xhat **,
181 172 void *);
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
182 173 int xhat_detach_xhat(xhat_provider_t *, struct as *);
183 174 pfn_t xhat_insert_xhatblk(page_t *, struct xhat *, void **);
184 175 int xhat_delete_xhatblk(void *, int);
185 176 void xhat_hat_hold(struct xhat *);
186 177 void xhat_hat_rele(struct xhat *);
187 178 int xhat_hat_holders(struct xhat *);
188 179
189 180 void xhat_free_start_all(struct as *);
190 181 void xhat_free_end_all(struct as *);
191 182 int xhat_dup_all(struct as *, struct as *, caddr_t, size_t, uint_t);
192 -void xhat_swapout_all(struct as *);
193 183 void xhat_unload_callback_all(struct as *, caddr_t, size_t, uint_t,
194 184 hat_callback_t *);
195 185 void xhat_setattr_all(struct as *, caddr_t, size_t, uint_t);
196 186 void xhat_clrattr_all(struct as *, caddr_t, size_t, uint_t);
197 187 void xhat_chgattr_all(struct as *, caddr_t, size_t, uint_t);
198 188 void xhat_chgprot_all(struct as *, caddr_t, size_t, uint_t);
199 189 void xhat_unshare_all(struct as *, caddr_t, size_t);
200 190
201 191
202 192 #endif /* _ASM */
203 193
204 194 #ifdef __cplusplus
205 195 }
206 196 #endif
207 197
208 198 #endif /* _VM_XHAT_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX