10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3446Smrj * Common Development and Distribution License (the "License"). 6*3446Smrj * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _KDI_H 270Sstevel@tonic-gate #define _KDI_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 31*3446Smrj #include <sys/types.h> 32*3446Smrj 330Sstevel@tonic-gate /* 340Sstevel@tonic-gate * The Kernel/Debugger interface. 350Sstevel@tonic-gate * 360Sstevel@tonic-gate * The Debugger -> Kernel portion of the interface is handled by the kdi_t, 370Sstevel@tonic-gate * which is defined in the archkdi.h files. These functions are intended to 380Sstevel@tonic-gate * be called only when the system is stopped and the debugger is in control. 390Sstevel@tonic-gate * 400Sstevel@tonic-gate * The Kernel -> Debugger portion is handled by the debugvec_t, which is 410Sstevel@tonic-gate * defined here. These functions are used by the kernel to inform the debugger 420Sstevel@tonic-gate * of various state changes. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate 450Sstevel@tonic-gate #ifdef __cplusplus 460Sstevel@tonic-gate extern "C" { 470Sstevel@tonic-gate #endif 480Sstevel@tonic-gate 49*3446Smrj /* 50*3446Smrj * The VA range reserved for the debugger; used by kmdb. 51*3446Smrj */ 52*3446Smrj extern const caddr_t kdi_segdebugbase; 53*3446Smrj extern const size_t kdi_segdebugsize; 540Sstevel@tonic-gate 550Sstevel@tonic-gate struct cpu; 560Sstevel@tonic-gate struct modctl; 570Sstevel@tonic-gate struct gate_desc; 580Sstevel@tonic-gate struct user_desc; 590Sstevel@tonic-gate 600Sstevel@tonic-gate typedef struct kdi_debugvec kdi_debugvec_t; 610Sstevel@tonic-gate typedef struct kdi kdi_t; 620Sstevel@tonic-gate 631226Scth extern kdi_debugvec_t *kdi_dvec; 641226Scth extern struct modctl *kdi_dmods; 650Sstevel@tonic-gate 66*3446Smrj #define KDI_VERSION 7 670Sstevel@tonic-gate 680Sstevel@tonic-gate extern void kdi_dvec_vmready(void); 690Sstevel@tonic-gate extern void kdi_dvec_memavail(void); 700Sstevel@tonic-gate #if defined(__sparc) 71*3446Smrj extern void kdi_dvec_cpu_init(struct cpu *); 720Sstevel@tonic-gate extern void kdi_dvec_cpr_restart(void); 730Sstevel@tonic-gate #endif 740Sstevel@tonic-gate extern void kdi_dvec_modavail(void); 750Sstevel@tonic-gate extern void kdi_dvec_thravail(void); 760Sstevel@tonic-gate extern void kdi_dvec_mod_loaded(struct modctl *); 770Sstevel@tonic-gate extern void kdi_dvec_mod_unloading(struct modctl *); 780Sstevel@tonic-gate 790Sstevel@tonic-gate /* 800Sstevel@tonic-gate * The state machine described below is used to coordinate the efforts of 810Sstevel@tonic-gate * kmdb and dtrace. As both use breakpoints, only one may be currently be 820Sstevel@tonic-gate * active at a given time. Transitions are possible between the idle state 830Sstevel@tonic-gate * and either of the active states, but not directly between the two active 840Sstevel@tonic-gate * states. 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate typedef enum kdi_dtrace_set { 870Sstevel@tonic-gate KDI_DTSET_DTRACE_ACTIVATE, 880Sstevel@tonic-gate KDI_DTSET_DTRACE_DEACTIVATE, 890Sstevel@tonic-gate KDI_DTSET_KMDB_BPT_ACTIVATE, 900Sstevel@tonic-gate KDI_DTSET_KMDB_BPT_DEACTIVATE 910Sstevel@tonic-gate } kdi_dtrace_set_t; 920Sstevel@tonic-gate 930Sstevel@tonic-gate typedef enum { 940Sstevel@tonic-gate KDI_DTSTATE_DTRACE_ACTIVE, 950Sstevel@tonic-gate KDI_DTSTATE_IDLE, 960Sstevel@tonic-gate KDI_DTSTATE_KMDB_BPT_ACTIVE 970Sstevel@tonic-gate } kdi_dtrace_state_t; 980Sstevel@tonic-gate 990Sstevel@tonic-gate extern int kdi_dtrace_set(kdi_dtrace_set_t); 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate #ifdef __cplusplus 1020Sstevel@tonic-gate } 1030Sstevel@tonic-gate #endif 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #endif /* _KDI_H */ 106