xref: /titanic_51/usr/src/cmd/mdb/common/kmdb/kmdb_kdi.h (revision 6f45ec7b0b964c3be967c4880e8867ac1e7763a5)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _KMDB_KDI_H
27 #define	_KMDB_KDI_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 #include <sys/kdi.h>
33 #include <sys/modctl.h>
34 #include <gelf.h>
35 
36 #include <kmdb/kmdb_auxv.h>
37 #include <mdb/mdb_target.h>
38 #include <kmdb/kmdb_kdi_isadep.h>
39 
40 /*
41  * The following directive tells the mapfile generator that only those
42  * prototypes and declarations ending with a "Driver OK" comment should be
43  * included in the mapfile.
44  *
45  * MAPFILE: export "Driver OK"
46  */
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 struct module;
53 
54 /*
55  * KDI initialization
56  */
57 extern void kmdb_kdi_init(kdi_t *, kmdb_auxv_t *);
58 extern void kmdb_kdi_init_isadep(kdi_t *, kmdb_auxv_t *);
59 extern void kmdb_kdi_end_init(void);
60 
61 /*
62  * Debugger -> Kernel functions for use when the kernel is stopped
63  */
64 extern int kmdb_kdi_mods_changed(void);
65 extern int kmdb_kdi_mod_iter(int (*)(struct modctl *, void *), void *);
66 extern int kmdb_kdi_mod_isloaded(struct modctl *);
67 extern int kmdb_kdi_mod_haschanged(struct modctl *, struct module *,
68     struct modctl *, struct module *);
69 extern ssize_t kmdb_kdi_pread(void *, size_t, physaddr_t);
70 extern ssize_t kmdb_kdi_pwrite(void *, size_t, physaddr_t);
71 extern void kmdb_kdi_stop_slaves(int, int);
72 extern void kmdb_kdi_start_slaves(void);
73 extern void kmdb_kdi_slave_wait(void);
74 extern void kmdb_kdi_kmdb_enter(void);	/* Driver OK */
75 extern void kmdb_kdi_system_claim(void);
76 extern void kmdb_kdi_system_release(void);
77 extern size_t kmdb_kdi_range_is_nontoxic(uintptr_t, size_t, int);
78 extern void kmdb_kdi_flush_caches(void);
79 extern struct cons_polledio *kmdb_kdi_get_polled_io(void);
80 extern int kmdb_kdi_vtop(uintptr_t, physaddr_t *);
81 extern kdi_dtrace_state_t kmdb_kdi_dtrace_get_state(void);
82 extern int kmdb_kdi_dtrace_set(int);
83 
84 /*
85  * Driver -> Debugger notifications
86  */
87 
88 extern int kmdb_kdi_get_unload_request(void);			/* Driver OK */
89 extern void kmdb_kdi_set_unload_request(void);			/* Driver OK */
90 
91 #define	KMDB_KDI_FL_NOMODS		0x1
92 #define	KMDB_KDI_FL_NOCTF		0x2
93 
94 extern int kmdb_kdi_get_flags(void);				/* Driver OK */
95 
96 /*
97  * Debugger -> Kernel functions for use only when the kernel is running
98  */
99 extern uintptr_t kmdb_kdi_lookup_by_name(char *, char *);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* _KMDB_KDI_H */
106