xhat.c 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
int xhat_debug = 0;
void
{
}
int
{
/* strlen("_cache") = 7 */
return (-1);
}
return (-1);
}
/* Allocate kmem_cache which will manage xhat blocks */
return (-1);
}
/* Insert provider in the global list */
if (xhat_provider)
return (0);
}
int
{
return (-1);
if (provider->xhat_provider_refcnt) {
return (-1);
}
else
/* Free all xblks that are sitting on free_blks list */
return (0);
}
/* Attaches an XHAT to the address space */
int
{
return (XH_PRVDR);
}
/* Is address space busy (being freed, dup'd or swapped)? */
return (XH_ASBUSY);
}
xh->xhat_refcnt = 0;
return (0);
}
int
{
/*
* The address space is being freed,
* dup'd or swapped out.
* If we are the thread which doing one
* of those operations, we can go ahead
* and free up the XHAT.
* Otherwise, return.
*/
return (XH_ASBUSY);
} else
}
if (xh->xhat_refcnt > 0) {
/*
* There are still "users" of the XHAT.
* This may be either because the caller
* forgot to free something up (which is a bug)
* or because xhat_op_all() is in progress.
* Since we are not allowing any of
* xhat_op_all's ops to call xhat_detach_xhat(),
* This can only be some other thread. It
* may want to wait a bit and retry.
*/
/* Restore the hold on the XHAT */
return (XH_XHHELD);
}
else
return (0);
}
return (XH_NOTATTCHD);
}
void
{
xhat->xhat_refcnt++;
}
void
{
xhat->xhat_refcnt--;
}
int
{
return (xhat->xhat_refcnt);
}
/*
* Assumes that address space is already locked
* and that AS_FREE is set for as->a_flags.
*/
void
{
/*
* Simply calling xhat_hat_hold() won't work because we will
* not be able to succeed in xhat_detach_xhat(), which may
* get called from here. We need to know _who_ the holder is.
*/
}
}
}
}
/*
* Assumes that address space is already locked.
* Since xhat_free_start_all() must have been called
* earlier, for all XHATs holder is set to curthread.
* Also, since AS_BUSY is set for as->a_flags, no new
* XHATs could have been added.
*/
void
{
}
}
/* Assumes that address space is already locked */
/* ARGSUSED */
int
{
/* This is not supported. Should we return some sort of error? */
return (0);
}
/* Assumes that address space is already locked */
void
{
}
}
/*
* If the xh is still there (i.e. swapout did not
* destroy it), clear the holder field.
* xh_nxt->prev couldn't have been changed in xhat_attach_xhat()
* because AS_BUSY is set. xhat_detach_xhat() also couldn't
* have modified it because (holder != NULL).
* If there is only one XHAT, just see if a_xhat still
* points to us.
*/
}
}
}
/*
* In the following routines, the appropriate xhat_op
* should never attempt to call xhat_detach_xhat(): it will
* never succeed since the XHAT is held.
*/
#define XHAT_UNLOAD_CALLBACK_OP (0)
#define XHAT_SETATTR_OP (1)
#define XHAT_CLRATTR_OP (2)
#define XHAT_CHGATTR_OP (3)
#define XHAT_CHGPROT_OP (4)
#define XHAT_UNSHARE_OP (5)
static void
{
switch (op) {
case XHAT_UNLOAD_CALLBACK_OP:
break;
case XHAT_SETATTR_OP:
break;
case XHAT_CLRATTR_OP:
break;
case XHAT_CHGATTR_OP:
break;
case XHAT_CHGPROT_OP:
break;
case XHAT_UNSHARE_OP:
break;
default:
}
/*
* Both pointers are still valid because both
* XHATs are held.
*/
}
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}