1843e198johnlev/*
2843e198johnlev * CDDL HEADER START
3843e198johnlev *
4843e198johnlev * The contents of this file are subject to the terms of the
5843e198johnlev * Common Development and Distribution License (the "License").
6843e198johnlev * You may not use this file except in compliance with the License.
7843e198johnlev *
8843e198johnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9843e198johnlev * or http://www.opensolaris.org/os/licensing.
10843e198johnlev * See the License for the specific language governing permissions
11843e198johnlev * and limitations under the License.
12843e198johnlev *
13843e198johnlev * When distributing Covered Code, include this CDDL HEADER in each
14843e198johnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15843e198johnlev * If applicable, add the following below this CDDL HEADER, with the
16843e198johnlev * fields enclosed by brackets "[]" replaced with your own identifying
17843e198johnlev * information: Portions Copyright [yyyy] [name of copyright owner]
18843e198johnlev *
19843e198johnlev * CDDL HEADER END
20843e198johnlev */
21843e198johnlev/*
22843e198johnlev * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23843e198johnlev * Use is subject to license terms.
24843e198johnlev */
25843e198johnlev
26843e198johnlev#ifndef	_MDB_KB_H
27843e198johnlev#define	_MDB_KB_H
28843e198johnlev
29843e198johnlev#pragma ident	"%Z%%M%	%I%	%E% SMI"
30843e198johnlev
31843e198johnlev/*
32843e198johnlev * A KVM backend is used by the KVM target to interrogate the address space of
33843e198johnlev * the subject binary.  This is almost always via direct calls into libkvm,
34843e198johnlev * except for hypervisor core dumps, which implement its own backend via the
35843e198johnlev * mdb_kb support module.
36843e198johnlev */
37843e198johnlev
38843e198johnlev#include <sys/types.h>
39843e198johnlev#include <mdb/mdb_io.h>
40843e198johnlev
41843e198johnlev#ifdef	__cplusplus
42843e198johnlevextern "C" {
43843e198johnlev#endif
44843e198johnlev
45843e198johnlev#ifdef _MDB
46843e198johnlev
47843e198johnlevstruct as;
48843e198johnlevstruct privmregs;
49843e198johnlev
50843e198johnlevtypedef struct mdb_kb_ops {
51843e198johnlev	void *(*kb_open)(const char *, const char *, const char *, int,
52843e198johnlev	    const char *);
53843e198johnlev
54843e198johnlev	int (*kb_close)(void *);
55843e198johnlev
56843e198johnlev	mdb_io_t *(*kb_sym_io)(void *, const char *);
57843e198johnlev
58843e198johnlev	ssize_t (*kb_kread)(void *, uintptr_t, void *, size_t);
59843e198johnlev	ssize_t (*kb_kwrite)(void *, uintptr_t, const void *, size_t);
60843e198johnlev	ssize_t (*kb_aread)(void *, uintptr_t, void *, size_t, struct as *);
61843e198johnlev	ssize_t (*kb_awrite)(void *, uintptr_t, const void *,
62843e198johnlev	    size_t, struct as *);
63843e198johnlev	ssize_t (*kb_pread)(void *, uint64_t, void *, size_t);
64843e198johnlev	ssize_t (*kb_pwrite)(void *, uint64_t, const void *, size_t);
65843e198johnlev
66843e198johnlev	uint64_t (*kb_vtop)(void *, struct as *, uintptr_t);
67843e198johnlev
68843e198johnlev	int (*kb_getmregs)(void *, uint_t, struct privmregs *);
69843e198johnlev} mdb_kb_ops_t;
70843e198johnlev
71843e198johnlevextern mdb_kb_ops_t *libkvm_kb_ops(void);
72843e198johnlev
73843e198johnlev#endif	/* _MDB */
74843e198johnlev
75843e198johnlev#ifdef	__cplusplus
76843e198johnlev}
77843e198johnlev#endif
78843e198johnlev
79843e198johnlev#endif	/* _MDB_KB_H */
80