xref: /illumos-gate/usr/src/cmd/mdb/common/kmdb/kmdb_kctl.h (revision e86372a01d2d16a5dd4a64e144ed978ba17fe7dd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _KMDB_KCTL_H
27 #define	_KMDB_KCTL_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Interfaces used by the driver and mdb to interact with kmdb, and vice versa
33  */
34 
35 #include <sys/types.h>
36 #include <sys/kdi.h>
37 
38 #include <kmdb/kmdb_auxv.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * Interfaces used by mdb to control kmdb
46  */
47 #define	KMDB_IOC		(0xDB << 16)
48 #define	KMDB_IOC_START		(KMDB_IOC|1)
49 #define	KMDB_IOC_STOP		(KMDB_IOC|2)
50 
51 #define	KMDB_ACT_F_BOOT		0x1		/* activated during boot */
52 
53 extern int kmdb_init(const char *, kmdb_auxv_t *);
54 
55 /*
56  * This function should only be defined for sun4v. However the mdb build
57  * uses a custom tool (hdr2map) to generate mapfile from header files but
58  * this tool does not take care of preprocessor directives and functions
59  * are included into the mapfile whatever the architecture is and even
60  * if there is an #ifdef sun4v. So we always declare this function but it
61  * has a fake definition for all architecture but sun4v.
62  */
63 extern void kmdb_init_promif(char *, kmdb_auxv_t *);
64 
65 extern void kmdb_activate(kdi_debugvec_t **, uint_t);
66 extern void kmdb_deactivate(void);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* _KMDB_KCTL_H */
73