Print this page
patch vm-cleanup


  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 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _VM_XHAT_H
  28 #define _VM_XHAT_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 #ifndef _ASM
  38 
  39 #include <sys/types.h>
  40 #include <vm/page.h>
  41 #include <sys/kmem.h>
  42 
  43 struct xhat;
  44 struct xhat_hme_blk;
  45 
  46 struct xhat_ops {
  47         struct xhat     *(*xhat_alloc)(void *);
  48         void            (*xhat_free)(struct xhat *);
  49         void            (*xhat_free_start)(struct xhat *);
  50         void            (*xhat_free_end)(struct xhat *);
  51         int             (*xhat_dup)(struct xhat *, struct xhat *, caddr_t,
  52             size_t, uint_t);
  53         void            (*xhat_swapin)(struct xhat *);
  54         void            (*xhat_swapout)(struct xhat *);
  55         void            (*xhat_memload)(struct xhat *, caddr_t, struct page *,
  56                             uint_t, uint_t);
  57         void            (*xhat_memload_array)(struct xhat *, caddr_t, size_t,
  58                             struct page **, uint_t, uint_t);
  59         void            (*xhat_devload)(struct xhat *, caddr_t, size_t, pfn_t,
  60             uint_t, int);
  61         void            (*xhat_unload)(struct xhat *, caddr_t, size_t, uint_t);
  62         void            (*xhat_unload_callback)(struct xhat *, caddr_t, size_t,
  63             uint_t, hat_callback_t *);
  64         void            (*xhat_setattr)(struct xhat *, caddr_t, size_t, uint_t);
  65         void            (*xhat_clrattr)(struct xhat *, caddr_t, size_t, uint_t);
  66         void            (*xhat_chgattr)(struct xhat *, caddr_t, size_t, uint_t);
  67         void            (*xhat_unshare)(struct xhat *, caddr_t, size_t);
  68         void            (*xhat_chgprot)(struct xhat *, caddr_t, size_t, uint_t);
  69         int             (*xhat_pageunload)(struct xhat *, struct page *, uint_t,
  70                             void *);
  71 };
  72 
  73 
  74 #define XHAT_POPS(_p)   (_p)->xhat_provider_ops
  75 #define XHAT_PROPS(_h)  XHAT_POPS(((struct xhat *)(_h))->xhat_provider)
  76 #define XHAT_HOPS(hat, func, args) \
  77         { \
  78                 if (XHAT_PROPS(hat)-> /* */ func) \
  79                         XHAT_PROPS(hat)-> /* */ func /* */ args; \
  80         }
  81 
  82 #define XHAT_FREE_START(a) \
  83         XHAT_HOPS(a, xhat_free_start, ((struct xhat *)(a)))
  84 #define XHAT_FREE_END(a) \
  85         XHAT_HOPS(a, xhat_free_end, ((struct xhat *)(a)))
  86 #define XHAT_DUP(a, b, c, d, e) \
  87         ((XHAT_PROPS(a)->xhat_dup == NULL) ? (0) : \
  88         XHAT_PROPS(a)->xhat_dup((struct xhat *)(a), \
  89                                 (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 #define XHAT_MEMLOAD(a, b, c, d, e) \
  95         XHAT_HOPS(a, xhat_memload, ((struct xhat *)(a), b, c, d, e))
  96 #define XHAT_MEMLOAD_ARRAY(a, b, c, d, e, f) \
  97         XHAT_HOPS(a, xhat_memload_array, ((struct xhat *)(a), b, c, d, e, f))
  98 #define XHAT_DEVLOAD(a, b, c, d, e, f) \
  99         XHAT_HOPS(a, xhat_devload, ((struct xhat *)(a), b, c, d, e, f))
 100 #define XHAT_UNLOAD(a, b, c, d) \
 101         XHAT_HOPS(a, xhat_unload, ((struct xhat *)(a), b, c, d))
 102 #define XHAT_UNLOAD_CALLBACK(a, b, c, d, e) \
 103         XHAT_HOPS(a, xhat_unload_callback, ((struct xhat *)(a), b, c, d, e))
 104 #define XHAT_SETATTR(a, b, c, d) \
 105         XHAT_HOPS(a, xhat_setattr, ((struct xhat *)(a), b, c, d))
 106 #define XHAT_CLRATTR(a, b, c, d) \
 107         XHAT_HOPS(a, xhat_clrattr, ((struct xhat *)(a), b, c, d))
 108 #define XHAT_CHGATTR(a, b, c, d) \
 109         XHAT_HOPS(a, xhat_chgattr, ((struct xhat *)(a), b, c, d))
 110 #define XHAT_UNSHARE(a, b, c) \
 111         XHAT_HOPS(a, xhat_unshare, ((struct xhat *)(a), b, c))
 112 #define XHAT_CHGPROT(a, b, c, d) \
 113         XHAT_HOPS(a, xhat_chgprot, ((struct xhat *)(a), b, c, d))


 172 #define XH_ASBUSY       (2)     /* Address space is busy */
 173 #define XH_XHHELD       (3)     /* XHAT is being held */
 174 #define XH_NOTATTCHD    (4)     /* Provider is not attached to as */
 175 
 176 
 177 int     xhat_provider_register(xhat_provider_t *);
 178 int     xhat_provider_unregister(xhat_provider_t *);
 179 void    xhat_init(void);
 180 int     xhat_attach_xhat(xhat_provider_t *, struct as *, struct xhat **,
 181     void *);
 182 int     xhat_detach_xhat(xhat_provider_t *, struct as *);
 183 pfn_t   xhat_insert_xhatblk(page_t *, struct xhat *, void **);
 184 int     xhat_delete_xhatblk(void *, int);
 185 void    xhat_hat_hold(struct xhat *);
 186 void    xhat_hat_rele(struct xhat *);
 187 int     xhat_hat_holders(struct xhat *);
 188 
 189 void    xhat_free_start_all(struct as *);
 190 void    xhat_free_end_all(struct as *);
 191 int     xhat_dup_all(struct as *, struct as *, caddr_t, size_t, uint_t);
 192 void    xhat_swapout_all(struct as *);
 193 void    xhat_unload_callback_all(struct as *, caddr_t, size_t, uint_t,
 194     hat_callback_t *);
 195 void    xhat_setattr_all(struct as *, caddr_t, size_t, uint_t);
 196 void    xhat_clrattr_all(struct as *, caddr_t, size_t, uint_t);
 197 void    xhat_chgattr_all(struct as *, caddr_t, size_t, uint_t);
 198 void    xhat_chgprot_all(struct as *, caddr_t, size_t, uint_t);
 199 void    xhat_unshare_all(struct as *, caddr_t, size_t);
 200 
 201 
 202 #endif /* _ASM */
 203 
 204 #ifdef  __cplusplus
 205 }
 206 #endif
 207 
 208 #endif  /* _VM_XHAT_H */


  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 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _VM_XHAT_H
  28 #define _VM_XHAT_H
  29 



  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 #ifndef _ASM
  35 
  36 #include <sys/types.h>
  37 #include <vm/page.h>
  38 #include <sys/kmem.h>
  39 
  40 struct xhat;
  41 struct xhat_hme_blk;
  42 
  43 struct xhat_ops {
  44         struct xhat     *(*xhat_alloc)(void *);
  45         void            (*xhat_free)(struct xhat *);
  46         void            (*xhat_free_start)(struct xhat *);
  47         void            (*xhat_free_end)(struct xhat *);
  48         int             (*xhat_dup)(struct xhat *, struct xhat *, caddr_t,
  49             size_t, uint_t);


  50         void            (*xhat_memload)(struct xhat *, caddr_t, struct page *,
  51                             uint_t, uint_t);
  52         void            (*xhat_memload_array)(struct xhat *, caddr_t, size_t,
  53                             struct page **, uint_t, uint_t);
  54         void            (*xhat_devload)(struct xhat *, caddr_t, size_t, pfn_t,
  55             uint_t, int);
  56         void            (*xhat_unload)(struct xhat *, caddr_t, size_t, uint_t);
  57         void            (*xhat_unload_callback)(struct xhat *, caddr_t, size_t,
  58             uint_t, hat_callback_t *);
  59         void            (*xhat_setattr)(struct xhat *, caddr_t, size_t, uint_t);
  60         void            (*xhat_clrattr)(struct xhat *, caddr_t, size_t, uint_t);
  61         void            (*xhat_chgattr)(struct xhat *, caddr_t, size_t, uint_t);
  62         void            (*xhat_unshare)(struct xhat *, caddr_t, size_t);
  63         void            (*xhat_chgprot)(struct xhat *, caddr_t, size_t, uint_t);
  64         int             (*xhat_pageunload)(struct xhat *, struct page *, uint_t,
  65                             void *);
  66 };
  67 
  68 
  69 #define XHAT_POPS(_p)   (_p)->xhat_provider_ops
  70 #define XHAT_PROPS(_h)  XHAT_POPS(((struct xhat *)(_h))->xhat_provider)
  71 #define XHAT_HOPS(hat, func, args) \
  72         { \
  73                 if (XHAT_PROPS(hat)-> /* */ func) \
  74                         XHAT_PROPS(hat)-> /* */ func /* */ args; \
  75         }
  76 
  77 #define XHAT_FREE_START(a) \
  78         XHAT_HOPS(a, xhat_free_start, ((struct xhat *)(a)))
  79 #define XHAT_FREE_END(a) \
  80         XHAT_HOPS(a, xhat_free_end, ((struct xhat *)(a)))
  81 #define XHAT_DUP(a, b, c, d, e) \
  82         ((XHAT_PROPS(a)->xhat_dup == NULL) ? (0) : \
  83         XHAT_PROPS(a)->xhat_dup((struct xhat *)(a), \
  84                                 (struct xhat *)(b), c, d, e))




  85 #define XHAT_MEMLOAD(a, b, c, d, e) \
  86         XHAT_HOPS(a, xhat_memload, ((struct xhat *)(a), b, c, d, e))
  87 #define XHAT_MEMLOAD_ARRAY(a, b, c, d, e, f) \
  88         XHAT_HOPS(a, xhat_memload_array, ((struct xhat *)(a), b, c, d, e, f))
  89 #define XHAT_DEVLOAD(a, b, c, d, e, f) \
  90         XHAT_HOPS(a, xhat_devload, ((struct xhat *)(a), b, c, d, e, f))
  91 #define XHAT_UNLOAD(a, b, c, d) \
  92         XHAT_HOPS(a, xhat_unload, ((struct xhat *)(a), b, c, d))
  93 #define XHAT_UNLOAD_CALLBACK(a, b, c, d, e) \
  94         XHAT_HOPS(a, xhat_unload_callback, ((struct xhat *)(a), b, c, d, e))
  95 #define XHAT_SETATTR(a, b, c, d) \
  96         XHAT_HOPS(a, xhat_setattr, ((struct xhat *)(a), b, c, d))
  97 #define XHAT_CLRATTR(a, b, c, d) \
  98         XHAT_HOPS(a, xhat_clrattr, ((struct xhat *)(a), b, c, d))
  99 #define XHAT_CHGATTR(a, b, c, d) \
 100         XHAT_HOPS(a, xhat_chgattr, ((struct xhat *)(a), b, c, d))
 101 #define XHAT_UNSHARE(a, b, c) \
 102         XHAT_HOPS(a, xhat_unshare, ((struct xhat *)(a), b, c))
 103 #define XHAT_CHGPROT(a, b, c, d) \
 104         XHAT_HOPS(a, xhat_chgprot, ((struct xhat *)(a), b, c, d))


 163 #define XH_ASBUSY       (2)     /* Address space is busy */
 164 #define XH_XHHELD       (3)     /* XHAT is being held */
 165 #define XH_NOTATTCHD    (4)     /* Provider is not attached to as */
 166 
 167 
 168 int     xhat_provider_register(xhat_provider_t *);
 169 int     xhat_provider_unregister(xhat_provider_t *);
 170 void    xhat_init(void);
 171 int     xhat_attach_xhat(xhat_provider_t *, struct as *, struct xhat **,
 172     void *);
 173 int     xhat_detach_xhat(xhat_provider_t *, struct as *);
 174 pfn_t   xhat_insert_xhatblk(page_t *, struct xhat *, void **);
 175 int     xhat_delete_xhatblk(void *, int);
 176 void    xhat_hat_hold(struct xhat *);
 177 void    xhat_hat_rele(struct xhat *);
 178 int     xhat_hat_holders(struct xhat *);
 179 
 180 void    xhat_free_start_all(struct as *);
 181 void    xhat_free_end_all(struct as *);
 182 int     xhat_dup_all(struct as *, struct as *, caddr_t, size_t, uint_t);

 183 void    xhat_unload_callback_all(struct as *, caddr_t, size_t, uint_t,
 184     hat_callback_t *);
 185 void    xhat_setattr_all(struct as *, caddr_t, size_t, uint_t);
 186 void    xhat_clrattr_all(struct as *, caddr_t, size_t, uint_t);
 187 void    xhat_chgattr_all(struct as *, caddr_t, size_t, uint_t);
 188 void    xhat_chgprot_all(struct as *, caddr_t, size_t, uint_t);
 189 void    xhat_unshare_all(struct as *, caddr_t, size_t);
 190 
 191 
 192 #endif /* _ASM */
 193 
 194 #ifdef  __cplusplus
 195 }
 196 #endif
 197 
 198 #endif  /* _VM_XHAT_H */