hat.c revision 4ab75253616c6d68e967c10221bb663c0bfa99df
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
/*
* PSARC 2004/405 made hat_getkpfnum(9F) obsolete. As part of the
* obsolecense, the original documented behavior will begin to be
* enforced in the future; namely, hat_getkpfnum(9F) may _only_
* be called with device-mapped memory virtual addresses. Since
* changing hat_getkpfnum(9F) to return PFN_INVALID on kernel memory
* would break a lot of modules without any warning, we've implemented
* the following mechanism as a stop-gap. In a future release, this
* can all be ripped out and hat_getkpfnum(9F) changed to return
* PFN_INVALID if it isn't called with a device-mapped memory address.
*
* We keep track of each module that has used hat_getkpfnum(9F)
* with too many warnings about a bad module that has already been
* flagged.
*
* On amd64 hat_getkpfnum() is never supported.
*/
#if !defined(__amd64)
#define HAT_STACK_MAXDEPTH 15
struct badcall_node {
char *bc_modname;
int bc_stackdepth;
struct badcall_node *bc_linkage;
};
static struct badcall_node *bad_getkpfnum_callers;
/*
* Common VM HAT routines.
*/
static void
{
int sf;
char *ksym;
bc->bc_modname);
}
}
void
hat_getkpfnum_badcall(void *caller)
{
struct badcall_node bcs;
struct badcall_node *bc;
#ifdef __sparc
/*
* This is a hack until the ifb and jfb framebuffer drivers
* are fixed. Right now they use hat_getkpfnum() in a way that
* is really safe but will be incorrectly flagged as being
* buggy.
*/
return;
/*
* This is a hack until these ethernet drivers can be fixed
* or EOL'd. hat_getkpfnum() will continue to work correctly
* until this list can be removed.
*/
return;
#endif /* __sparc / __i386 */
return;
/*
* We haven't seen this caller before, so create a log of
* the callstack and module name, and emit a warning to the
* user.
*/
} else {
}
}
#endif /* __amd64 */