xref: /titanic_50/usr/src/uts/common/sys/kdi.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
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 _KDI_H
277c478bd9Sstevel@tonic-gate #define	_KDI_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
31*ae115bc7Smrj #include <sys/types.h>
32*ae115bc7Smrj 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * The Kernel/Debugger interface.
357c478bd9Sstevel@tonic-gate  *
367c478bd9Sstevel@tonic-gate  * The Debugger -> Kernel portion of the interface is handled by the kdi_t,
377c478bd9Sstevel@tonic-gate  * which is defined in the archkdi.h files.  These functions are intended to
387c478bd9Sstevel@tonic-gate  * be called only when the system is stopped and the debugger is in control.
397c478bd9Sstevel@tonic-gate  *
407c478bd9Sstevel@tonic-gate  * The Kernel -> Debugger portion is handled by the debugvec_t, which is
417c478bd9Sstevel@tonic-gate  * defined here.  These functions are used by the kernel to inform the debugger
427c478bd9Sstevel@tonic-gate  * of various state changes.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #ifdef __cplusplus
467c478bd9Sstevel@tonic-gate extern "C" {
477c478bd9Sstevel@tonic-gate #endif
487c478bd9Sstevel@tonic-gate 
49*ae115bc7Smrj /*
50*ae115bc7Smrj  * The VA range reserved for the debugger; used by kmdb.
51*ae115bc7Smrj  */
52*ae115bc7Smrj extern const caddr_t kdi_segdebugbase;
53*ae115bc7Smrj extern const size_t kdi_segdebugsize;
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate struct cpu;
567c478bd9Sstevel@tonic-gate struct modctl;
577c478bd9Sstevel@tonic-gate struct gate_desc;
587c478bd9Sstevel@tonic-gate struct user_desc;
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate typedef struct kdi_debugvec kdi_debugvec_t;
617c478bd9Sstevel@tonic-gate typedef struct kdi kdi_t;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate extern kdi_debugvec_t	*kdi_dvec;
6401f19855Scth extern struct modctl	*kdi_dmods;
657c478bd9Sstevel@tonic-gate 
66*ae115bc7Smrj #define	KDI_VERSION		7
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate extern void kdi_dvec_vmready(void);
697c478bd9Sstevel@tonic-gate extern void kdi_dvec_memavail(void);
707c478bd9Sstevel@tonic-gate #if defined(__sparc)
71*ae115bc7Smrj extern void kdi_dvec_cpu_init(struct cpu *);
727c478bd9Sstevel@tonic-gate extern void kdi_dvec_cpr_restart(void);
737c478bd9Sstevel@tonic-gate #endif
747c478bd9Sstevel@tonic-gate extern void kdi_dvec_modavail(void);
757c478bd9Sstevel@tonic-gate extern void kdi_dvec_thravail(void);
767c478bd9Sstevel@tonic-gate extern void kdi_dvec_mod_loaded(struct modctl *);
777c478bd9Sstevel@tonic-gate extern void kdi_dvec_mod_unloading(struct modctl *);
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * The state machine described below is used to coordinate the efforts of
817c478bd9Sstevel@tonic-gate  * kmdb and dtrace.  As both use breakpoints, only one may be currently be
827c478bd9Sstevel@tonic-gate  * active at a given time.  Transitions are possible between the idle state
837c478bd9Sstevel@tonic-gate  * and either of the active states, but not directly between the two active
847c478bd9Sstevel@tonic-gate  * states.
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate typedef enum kdi_dtrace_set {
877c478bd9Sstevel@tonic-gate 	KDI_DTSET_DTRACE_ACTIVATE,
887c478bd9Sstevel@tonic-gate 	KDI_DTSET_DTRACE_DEACTIVATE,
897c478bd9Sstevel@tonic-gate 	KDI_DTSET_KMDB_BPT_ACTIVATE,
907c478bd9Sstevel@tonic-gate 	KDI_DTSET_KMDB_BPT_DEACTIVATE
917c478bd9Sstevel@tonic-gate } kdi_dtrace_set_t;
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate typedef enum {
947c478bd9Sstevel@tonic-gate 	KDI_DTSTATE_DTRACE_ACTIVE,
957c478bd9Sstevel@tonic-gate 	KDI_DTSTATE_IDLE,
967c478bd9Sstevel@tonic-gate 	KDI_DTSTATE_KMDB_BPT_ACTIVE
977c478bd9Sstevel@tonic-gate } kdi_dtrace_state_t;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate extern int kdi_dtrace_set(kdi_dtrace_set_t);
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1027c478bd9Sstevel@tonic-gate }
1037c478bd9Sstevel@tonic-gate #endif
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #endif /* _KDI_H */
106