xref: /illumos-gate/usr/src/cmd/mdb/common/kmdb/kmdb_kdi.h (revision 2a8bcb4e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*ae115bc7Smrj  * Common Development and Distribution License (the "License").
6*ae115bc7Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _KMDB_KDI_H
277c478bd9Sstevel@tonic-gate #define	_KMDB_KDI_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/types.h>
307c478bd9Sstevel@tonic-gate #include <sys/kdi.h>
317c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
327c478bd9Sstevel@tonic-gate #include <gelf.h>
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <kmdb/kmdb_auxv.h>
357c478bd9Sstevel@tonic-gate #include <mdb/mdb_target.h>
367c478bd9Sstevel@tonic-gate #include <kmdb/kmdb_kdi_isadep.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate /*
397c478bd9Sstevel@tonic-gate  * The following directive tells the mapfile generator that only those
407c478bd9Sstevel@tonic-gate  * prototypes and declarations ending with a "Driver OK" comment should be
417c478bd9Sstevel@tonic-gate  * included in the mapfile.
427c478bd9Sstevel@tonic-gate  *
437c478bd9Sstevel@tonic-gate  * MAPFILE: export "Driver OK"
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifdef __cplusplus
477c478bd9Sstevel@tonic-gate extern "C" {
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate struct module;
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * KDI initialization
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate extern void kmdb_kdi_init(kdi_t *, kmdb_auxv_t *);
567c478bd9Sstevel@tonic-gate extern void kmdb_kdi_init_isadep(kdi_t *, kmdb_auxv_t *);
577c478bd9Sstevel@tonic-gate extern void kmdb_kdi_end_init(void);
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * Debugger -> Kernel functions for use when the kernel is stopped
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mods_changed(void);
637c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mod_iter(int (*)(struct modctl *, void *), void *);
647c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mod_isloaded(struct modctl *);
657c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mod_haschanged(struct modctl *, struct module *,
667c478bd9Sstevel@tonic-gate     struct modctl *, struct module *);
677c478bd9Sstevel@tonic-gate extern ssize_t kmdb_kdi_pread(void *, size_t, physaddr_t);
687c478bd9Sstevel@tonic-gate extern ssize_t kmdb_kdi_pwrite(void *, size_t, physaddr_t);
69*ae115bc7Smrj extern void kmdb_kdi_stop_slaves(int, int);
70*ae115bc7Smrj extern void kmdb_kdi_start_slaves(void);
71*ae115bc7Smrj extern void kmdb_kdi_slave_wait(void);
72*ae115bc7Smrj extern void kmdb_kdi_kmdb_enter(void);	/* Driver OK */
737c478bd9Sstevel@tonic-gate extern void kmdb_kdi_system_claim(void);
747c478bd9Sstevel@tonic-gate extern void kmdb_kdi_system_release(void);
757c478bd9Sstevel@tonic-gate extern size_t kmdb_kdi_range_is_nontoxic(uintptr_t, size_t, int);
767c478bd9Sstevel@tonic-gate extern void kmdb_kdi_flush_caches(void);
777c478bd9Sstevel@tonic-gate extern struct cons_polledio *kmdb_kdi_get_polled_io(void);
787c478bd9Sstevel@tonic-gate extern int kmdb_kdi_vtop(uintptr_t, physaddr_t *);
797c478bd9Sstevel@tonic-gate extern kdi_dtrace_state_t kmdb_kdi_dtrace_get_state(void);
807c478bd9Sstevel@tonic-gate extern int kmdb_kdi_dtrace_set(int);
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * Driver -> Debugger notifications
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate extern int kmdb_kdi_get_unload_request(void);			/* Driver OK */
877c478bd9Sstevel@tonic-gate extern void kmdb_kdi_set_unload_request(void);			/* Driver OK */
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #define	KMDB_KDI_FL_NOMODS		0x1
907c478bd9Sstevel@tonic-gate #define	KMDB_KDI_FL_NOCTF		0x2
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate extern int kmdb_kdi_get_flags(void);				/* Driver OK */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate  * Debugger -> Kernel functions for use only when the kernel is running
967c478bd9Sstevel@tonic-gate  */
977c478bd9Sstevel@tonic-gate extern uintptr_t kmdb_kdi_lookup_by_name(char *, char *);
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1007c478bd9Sstevel@tonic-gate }
1017c478bd9Sstevel@tonic-gate #endif
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #endif /* _KMDB_KDI_H */
104