1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _KDI_H 28*0Sstevel@tonic-gate #define _KDI_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * The Kernel/Debugger interface. 34*0Sstevel@tonic-gate * 35*0Sstevel@tonic-gate * The Debugger -> Kernel portion of the interface is handled by the kdi_t, 36*0Sstevel@tonic-gate * which is defined in the archkdi.h files. These functions are intended to 37*0Sstevel@tonic-gate * be called only when the system is stopped and the debugger is in control. 38*0Sstevel@tonic-gate * 39*0Sstevel@tonic-gate * The Kernel -> Debugger portion is handled by the debugvec_t, which is 40*0Sstevel@tonic-gate * defined here. These functions are used by the kernel to inform the debugger 41*0Sstevel@tonic-gate * of various state changes. 42*0Sstevel@tonic-gate */ 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate #ifdef __cplusplus 45*0Sstevel@tonic-gate extern "C" { 46*0Sstevel@tonic-gate #endif 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate /* The VA range reserved for the debugger. */ 49*0Sstevel@tonic-gate #if defined(__sparc) 50*0Sstevel@tonic-gate #define SEGDEBUGBASE 0xedd00000 51*0Sstevel@tonic-gate #define SEGDEBUGSIZE (0xf0000000 - SEGDEBUGBASE) 52*0Sstevel@tonic-gate #elif defined(__amd64) 53*0Sstevel@tonic-gate #define SEGDEBUGBASE 0xffffffffff800000 54*0Sstevel@tonic-gate #define SEGDEBUGSIZE 0x400000 55*0Sstevel@tonic-gate #else 56*0Sstevel@tonic-gate #define SEGDEBUGBASE 0xff800000 57*0Sstevel@tonic-gate #define SEGDEBUGSIZE 0x400000 58*0Sstevel@tonic-gate #endif 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate struct cpu; 61*0Sstevel@tonic-gate struct modctl; 62*0Sstevel@tonic-gate struct gate_desc; 63*0Sstevel@tonic-gate struct user_desc; 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate typedef struct kdi_debugvec kdi_debugvec_t; 66*0Sstevel@tonic-gate typedef struct kdi kdi_t; 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate extern kdi_debugvec_t *kdi_dvec; 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate #define KDI_VERSION 6 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate extern void kdi_dvec_enter(void); 73*0Sstevel@tonic-gate extern void kdi_dvec_cpu_init(struct cpu *); 74*0Sstevel@tonic-gate #if defined(__i386) || defined(__amd64) 75*0Sstevel@tonic-gate extern void kdi_dvec_idt_sync(struct gate_desc *); 76*0Sstevel@tonic-gate #endif /* __i386 || __amd64 */ 77*0Sstevel@tonic-gate extern void kdi_dvec_vmready(void); 78*0Sstevel@tonic-gate extern void kdi_dvec_memavail(void); 79*0Sstevel@tonic-gate #if defined(__sparc) 80*0Sstevel@tonic-gate extern void kdi_dvec_cpr_restart(void); 81*0Sstevel@tonic-gate #endif 82*0Sstevel@tonic-gate extern void kdi_dvec_modavail(void); 83*0Sstevel@tonic-gate extern void kdi_dvec_thravail(void); 84*0Sstevel@tonic-gate extern void kdi_dvec_mod_loaded(struct modctl *); 85*0Sstevel@tonic-gate extern void kdi_dvec_mod_unloading(struct modctl *); 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate /* 88*0Sstevel@tonic-gate * The state machine described below is used to coordinate the efforts of 89*0Sstevel@tonic-gate * kmdb and dtrace. As both use breakpoints, only one may be currently be 90*0Sstevel@tonic-gate * active at a given time. Transitions are possible between the idle state 91*0Sstevel@tonic-gate * and either of the active states, but not directly between the two active 92*0Sstevel@tonic-gate * states. 93*0Sstevel@tonic-gate */ 94*0Sstevel@tonic-gate typedef enum kdi_dtrace_set { 95*0Sstevel@tonic-gate KDI_DTSET_DTRACE_ACTIVATE, 96*0Sstevel@tonic-gate KDI_DTSET_DTRACE_DEACTIVATE, 97*0Sstevel@tonic-gate KDI_DTSET_KMDB_BPT_ACTIVATE, 98*0Sstevel@tonic-gate KDI_DTSET_KMDB_BPT_DEACTIVATE 99*0Sstevel@tonic-gate } kdi_dtrace_set_t; 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate typedef enum { 102*0Sstevel@tonic-gate KDI_DTSTATE_DTRACE_ACTIVE, 103*0Sstevel@tonic-gate KDI_DTSTATE_IDLE, 104*0Sstevel@tonic-gate KDI_DTSTATE_KMDB_BPT_ACTIVE 105*0Sstevel@tonic-gate } kdi_dtrace_state_t; 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate extern int kdi_dtrace_set(kdi_dtrace_set_t); 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate #ifdef __cplusplus 110*0Sstevel@tonic-gate } 111*0Sstevel@tonic-gate #endif 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate #endif /* _KDI_H */ 114