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