xhat.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _VM_XHAT_H
#define _VM_XHAT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
struct xhat;
struct xhat_hme_blk;
struct xhat_ops {
struct xhat *(*xhat_alloc)(void *);
void (*xhat_free_start)(struct xhat *);
void (*xhat_free_end)(struct xhat *);
void (*xhat_swapin)(struct xhat *);
void (*xhat_swapout)(struct xhat *);
uint_t, int);
uint_t, hat_callback_t *);
void *);
};
{ \
}
#define XHAT_FREE_START(a) \
#define XHAT_FREE_END(a) \
#define XHAT_DUP(a, b, c, d, e) \
(struct xhat *)(b), c, d, e))
#define XHAT_SWAPIN(a) \
#define XHAT_SWAPOUT(a) \
#define XHAT_MEMLOAD(a, b, c, d, e) \
#define XHAT_MEMLOAD_ARRAY(a, b, c, d, e, f) \
#define XHAT_DEVLOAD(a, b, c, d, e, f) \
#define XHAT_UNLOAD(a, b, c, d) \
#define XHAT_UNLOAD_CALLBACK(a, b, c, d, e) \
#define XHAT_SETATTR(a, b, c, d) \
#define XHAT_CLRATTR(a, b, c, d) \
#define XHAT_CHGATTR(a, b, c, d) \
#define XHAT_UNSHARE(a, b, c) \
#define XHAT_CHGPROT(a, b, c, d) \
#define XHAT_PAGEUNLOAD(a, b, c, d) \
#define XHAT_PROVIDER_VERSION 1
/*
* Provider name will be appended with "_cache"
* when initializing kmem cache.
* The resulting sring must be less than
* KMEM_CACHE_NAMELEN
*/
#define XHAT_CACHE_NAMELEN 24
typedef struct xblk_cache {
void *free_blks;
void (*reclaim)(void *);
} xblk_cache_t;
typedef struct xhat_provider {
int xhat_provider_refcnt;
struct xhat_provider *next;
struct xhat_provider *prev;
struct xhat_ops *xhat_provider_ops;
/*
* The xhat structure is protected by xhat_lock.
* A particular xhat implementation is a extension of the
* xhat structure and may contain its own lock(s) to
* protect those additional fields.
* The xhat structure is never allocated directly.
* Instead its allocation is provided by the hat implementation.
* The xhat provider ops xhat_alloc/xhat_free are used to
*/
struct xhat {
void *arg;
int xhat_refcnt;
};
/* Error codes */
void xhat_init(void);
void *);
int xhat_delete_xhatblk(void *, int);
void xhat_hat_hold(struct xhat *);
void xhat_hat_rele(struct xhat *);
int xhat_hat_holders(struct xhat *);
void xhat_free_start_all(struct as *);
void xhat_free_end_all(struct as *);
void xhat_swapout_all(struct as *);
hat_callback_t *);
#endif /* _ASM */
#ifdef __cplusplus
}
#endif
#endif /* _VM_XHAT_H */