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.
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.
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]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/kdi_machimpl.h>
33 #include <sys/privregs.h>
43 * The debugvec is used by the kernel to interact with the debugger.
46 void (*dv_kctl_vmready
)(void);
47 void (*dv_kctl_memavail
)(void);
48 void (*dv_kctl_modavail
)(void);
49 void (*dv_kctl_thravail
)(void);
51 void (*dv_vmready
)(void);
52 void (*dv_memavail
)(caddr_t
, size_t);
53 void (*dv_mod_loaded
)(struct modctl
*);
54 void (*dv_mod_unloading
)(struct modctl
*);
56 #if defined(__i386) || defined(__amd64)
57 void (*dv_handle_fault
)(greg_t
, greg_t
, greg_t
, int);
60 void (*dv_kctl_cpu_init
)(void);
61 void (*dv_cpu_init
)(struct cpu
*);
62 void (*dv_cpr_restart
)(void);
66 typedef struct kdi_plat
{
67 void (*pkdi_system_claim
)(void);
68 void (*pkdi_system_release
)(void);
69 void (*pkdi_console_claim
)(void);
70 void (*pkdi_console_release
)(void);
73 #define pkdi_system_claim kdi_plat.pkdi_system_claim
74 #define pkdi_system_release kdi_plat.pkdi_system_release
75 #define pkdi_console_claim kdi_plat.pkdi_console_claim
76 #define pkdi_console_release kdi_plat.pkdi_console_release
79 * The KDI, or Kernel/Debugger Interface, consists of an ops vector describing
80 * kernel services that may be directly invoked by the debugger. Unless
81 * otherwise specified, the functions implementing this ops vector are designed
82 * to function when the debugger has control of the system - when all other CPUs
83 * have been stopped. In such an environment, blocking services such as memory
84 * allocation or synchronization primitives are not available.
91 * Determines whether significant changes (loads or unloads) have
92 * been made to the modules since the last time this op was invoked.
94 int (*kdi_mods_changed
)(void);
97 * Iterates through the current set of modctls, and invokes the
98 * caller-provided callback on each one.
100 int (*kdi_mod_iter
)(int (*)(struct modctl
*, void *), void *);
103 * Determines whether or not a given module is loaded.
105 int (*kdi_mod_isloaded
)(struct modctl
*);
108 * Has anything changed between two versions of the same modctl?
110 int (*kdi_mod_haschanged
)(struct modctl
*, struct module
*,
111 struct modctl
*, struct module
*);
114 * Invoked by the debugger when it assumes control of the machine.
116 void (*kdi_system_claim
)(void);
119 * Invoked by the debugger when it relinquishes control of the machine.
121 void (*kdi_system_release
)(void);
123 int (*kdi_pread
)(caddr_t
, size_t, uint64_t, size_t *);
124 int (*kdi_pwrite
)(caddr_t
, size_t, uint64_t, size_t *);
125 void (*kdi_flush_caches
)(void);
127 size_t (*kdi_range_is_nontoxic
)(uintptr_t, size_t, int);
129 struct cons_polledio
*(*kdi_get_polled_io
)(void);
131 int (*kdi_vtop
)(uintptr_t, uint64_t *);
133 kdi_dtrace_state_t (*kdi_dtrace_get_state
)(void);
134 int (*kdi_dtrace_set
)(kdi_dtrace_set_t
);
136 void (*kdi_plat_call
)(void (*)(void));
138 void (*kdi_kmdb_enter
)(void);
144 extern void kdi_softcall(void (*)(void));
145 extern void kdi_setsoftint(uint64_t);
146 extern int kdi_pread(caddr_t
, size_t, uint64_t, size_t *);
147 extern int kdi_pwrite(caddr_t
, size_t, uint64_t, size_t *);
148 extern size_t kdi_range_is_nontoxic(uintptr_t, size_t, int);
149 extern void kdi_flush_caches(void);
150 extern kdi_dtrace_state_t
kdi_dtrace_get_state(void);
151 extern int kdi_vtop(uintptr_t, uint64_t *);
153 extern void cpu_kdi_init(kdi_t
*);
154 extern void mach_kdi_init(kdi_t
*);
155 extern void plat_kdi_init(kdi_t
*);
157 extern void *boot_kdi_tmpinit(void);
158 extern void boot_kdi_tmpfini(void *);
164 #endif /* _KDI_IMPL_H */