xref: /illumos-gate/usr/src/cmd/mdb/common/kmdb/kmdb_kctl.h (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
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 /*
30  * Interfaces used by the driver and mdb to interact with kmdb, and vice versa
31  */
32 
33 #include <sys/types.h>
34 #include <sys/kdi.h>
35 
36 #include <kmdb/kmdb_auxv.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Interfaces used by mdb to control kmdb
44  */
45 #define	KMDB_IOC		(0xDB << 16)
46 #define	KMDB_IOC_START		(KMDB_IOC|1)
47 #define	KMDB_IOC_STOP		(KMDB_IOC|2)
48 
49 #define	KMDB_ACT_F_BOOT		0x1		/* activated during boot */
50 
51 extern int kmdb_init(const char *, kmdb_auxv_t *);
52 
53 /*
54  * This function should only be defined for sun4v. However the mdb build
55  * uses a custom tool (hdr2map) to generate mapfile from header files but
56  * this tool does not take care of preprocessor directives and functions
57  * are included into the mapfile whatever the architecture is and even
58  * if there is an #ifdef sun4v. So we always declare this function but it
59  * has a fake definition for all architecture but sun4v.
60  */
61 extern void kmdb_init_promif(char *, kmdb_auxv_t *);
62 
63 extern void kmdb_activate(kdi_debugvec_t **, uint_t);
64 extern void kmdb_deactivate(void);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* _KMDB_KCTL_H */
71