mdb_ks.h revision d3d50737e566cade9a08d73d2af95105ac7cd960
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MDB_KS_H
#define _MDB_KS_H
#include <sys/int_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* MDB Kernel Support Interfaces:
*
* Debugger modules for kernel crash dumps can make use of these utility
* functions. This module also provides support for <mdb/mdb_param.h>.
*/
extern int mdb_name_to_major(const char *, major_t *);
extern const char *mdb_major_to_name(major_t);
extern int mdb_cpu2cpuid(uintptr_t);
extern int mdb_cpuset_find(uintptr_t);
extern hrtime_t mdb_gethrtime(void);
extern int64_t mdb_get_lbolt(void);
/*
* Returns a pointer to the top of the soft state struct for the instance
* specified, given the address of the global soft state pointer and size
* of the struct. Also fills in the buffer pointed to by state_buf_p (if
* non-NULL) with the contents of the state struct.
*/
size_t);
/*
* Returns a pointer to the top of the soft state struct for the instance
* specified, given the name of the global soft state pointer and size
* of the struct. Also fills in the buffer pointed to by state_buf_p (if
* non-NULL) with the contents of the state struct.
*/
size_t);
/*
* Returns the pathname from the root devinfo node to the dip supplied.
* Just like ddi_pathname in sunddi.c.
*/
/*
* MDB Kernel STREAMS Subsystem:
*
* Debugger modules such as ip can provide facilities for decoding private
* q_ptr data for STREAMS queues using this mechanism. The module first
* registers a set of functions which may be invoked when q->q_qinfo matches
* a given qinit address (such as ip`winit). The q_info function provides
* a way for the module to return an information string about the particular
* queue. The q_rnext and q_wnext functions provide a way for the generic
* queue walker to ask how to proceed deeper in the STREAM when q_next is
* NULL. This allows ip, for example, to provide access to the link-layer
* queues beneath the ip-client queue.
*/
typedef struct mdb_qops {
} mdb_qops_t;
/*
* These functions, provided by mdb_ks, may be used to fill in the q_rnext
* and q_wnext members of mdb_qops_t, in the case where the client wishes
* to simply return q->q_next:
*/
extern int mdb_mblk_count(const mblk_t *);
/* DLPI primitive to string; returns NULL for unknown primitives */
extern const char *mdb_dlpi_prim(int);
/* Generic function for working with MAC (network layer 2) addresses. */
/*
* Target-specific interfaces
*
* The existence and accessibility of the functions listed below is relied upon
* by the indicated targets. The targets look up and invoke these functions in
* mdb_ks so that dependencies on the current kernel implementation are
* isolated in mdb_ks.
*/
/*
* MDB KPROC Target Interface:
* (user processes from kernel crash dump)
*/
struct mdb_map; /* Private between kproc and ks */
extern int mdb_kproc_asiter(uintptr_t,
void (*)(const struct mdb_map *, void *), void *);
/*
* MDB KVM Target Interface:
* (kernel dump)
*/
extern int mdb_dump_find_curproc(void);
/*
* KMDB Target Interface:
*/
#ifdef _KMDB
extern const mdb_modinfo_t *mdb_ks_init(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MDB_KS_H */