xref: /titanic_41/usr/src/cmd/mdb/common/mdb/mdb_kb.h (revision 843e19887f64dde75055cf8842fc4db2171eff45)
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	_MDB_KB_H
27 #define	_MDB_KB_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * A KVM backend is used by the KVM target to interrogate the address space of
33  * the subject binary.  This is almost always via direct calls into libkvm,
34  * except for hypervisor core dumps, which implement its own backend via the
35  * mdb_kb support module.
36  */
37 
38 #include <sys/types.h>
39 #include <mdb/mdb_io.h>
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 #ifdef _MDB
46 
47 struct as;
48 struct privmregs;
49 
50 typedef struct mdb_kb_ops {
51 	void *(*kb_open)(const char *, const char *, const char *, int,
52 	    const char *);
53 
54 	int (*kb_close)(void *);
55 
56 	mdb_io_t *(*kb_sym_io)(void *, const char *);
57 
58 	ssize_t (*kb_kread)(void *, uintptr_t, void *, size_t);
59 	ssize_t (*kb_kwrite)(void *, uintptr_t, const void *, size_t);
60 	ssize_t (*kb_aread)(void *, uintptr_t, void *, size_t, struct as *);
61 	ssize_t (*kb_awrite)(void *, uintptr_t, const void *,
62 	    size_t, struct as *);
63 	ssize_t (*kb_pread)(void *, uint64_t, void *, size_t);
64 	ssize_t (*kb_pwrite)(void *, uint64_t, const void *, size_t);
65 
66 	uint64_t (*kb_vtop)(void *, struct as *, uintptr_t);
67 
68 	int (*kb_getmregs)(void *, uint_t, struct privmregs *);
69 } mdb_kb_ops_t;
70 
71 extern mdb_kb_ops_t *libkvm_kb_ops(void);
72 
73 #endif	/* _MDB */
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _MDB_KB_H */
80