xref: /titanic_52/usr/src/cmd/mdb/common/kmdb/kmdb_kdi.h (revision 0eb822a1c0c2bea495647510b75f77f0e57633eb)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _KMDB_KDI_H
28 #define	_KMDB_KDI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/kdi.h>
34 #include <sys/modctl.h>
35 #include <gelf.h>
36 
37 #include <kmdb/kmdb_auxv.h>
38 #include <mdb/mdb_target.h>
39 #include <kmdb/kmdb_kdi_isadep.h>
40 
41 /*
42  * The following directive tells the mapfile generator that only those
43  * prototypes and declarations ending with a "Driver OK" comment should be
44  * included in the mapfile.
45  *
46  * MAPFILE: export "Driver OK"
47  */
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 struct module;
54 
55 /*
56  * KDI initialization
57  */
58 extern void kmdb_kdi_init(kdi_t *, kmdb_auxv_t *);
59 extern void kmdb_kdi_init_isadep(kdi_t *, kmdb_auxv_t *);
60 extern void kmdb_kdi_end_init(void);
61 
62 /*
63  * Debugger -> Kernel functions for use when the kernel is stopped
64  */
65 extern int kmdb_kdi_mods_changed(void);
66 extern int kmdb_kdi_mod_iter(int (*)(struct modctl *, void *), void *);
67 extern int kmdb_kdi_mod_isloaded(struct modctl *);
68 extern int kmdb_kdi_mod_haschanged(struct modctl *, struct module *,
69     struct modctl *, struct module *);
70 extern ssize_t kmdb_kdi_pread(void *, size_t, physaddr_t);
71 extern ssize_t kmdb_kdi_pwrite(void *, size_t, physaddr_t);
72 extern void kmdb_kdi_stop_other_cpus(int, void (*)(void));	/* Driver OK */
73 extern void kmdb_kdi_system_claim(void);
74 extern void kmdb_kdi_system_release(void);
75 extern size_t kmdb_kdi_range_is_nontoxic(uintptr_t, size_t, int);
76 extern void kmdb_kdi_flush_caches(void);
77 extern struct cons_polledio *kmdb_kdi_get_polled_io(void);
78 extern int kmdb_kdi_vtop(uintptr_t, physaddr_t *);
79 extern kdi_dtrace_state_t kmdb_kdi_dtrace_get_state(void);
80 extern int kmdb_kdi_dtrace_set(int);
81 
82 /*
83  * Driver -> Debugger notifications
84  */
85 
86 extern int kmdb_kdi_get_unload_request(void);			/* Driver OK */
87 extern void kmdb_kdi_set_unload_request(void);			/* Driver OK */
88 
89 #define	KMDB_KDI_FL_NOMODS		0x1
90 #define	KMDB_KDI_FL_NOCTF		0x2
91 
92 extern int kmdb_kdi_get_flags(void);				/* Driver OK */
93 
94 /*
95  * Debugger -> Kernel functions for use only when the kernel is running
96  */
97 extern uintptr_t kmdb_kdi_lookup_by_name(char *, char *);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _KMDB_KDI_H */
104