xref: /titanic_52/usr/src/cmd/mdb/common/kmdb/kmdb_auxv.h (revision 1ae0874509b6811fdde1dfd46f0d93fd09867a3f)
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*1ae08745Sheppo  * Common Development and Distribution License (the "License").
6*1ae08745Sheppo  * 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*1ae08745Sheppo  * Copyright 2006 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_AUXV_H
277c478bd9Sstevel@tonic-gate #define	_KMDB_AUXV_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * The kmdb_auxv is the interface between the driver and the debugger portions
337c478bd9Sstevel@tonic-gate  * of kmdb.  It is used for three purposes:
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  *  1) To pass system-specific configuration information to the debugger.  This
367c478bd9Sstevel@tonic-gate  *     information is used by the debugger to tailor itself to the running
377c478bd9Sstevel@tonic-gate  *     system.
387c478bd9Sstevel@tonic-gate  *
397c478bd9Sstevel@tonic-gate  *  2) To pass debugger state information to the driver.
407c478bd9Sstevel@tonic-gate  *
417c478bd9Sstevel@tonic-gate  *  3) To configure the DPI.
427c478bd9Sstevel@tonic-gate  *
437c478bd9Sstevel@tonic-gate  * We use this somewhat torturous method to initialize and configure kmdb due to
447c478bd9Sstevel@tonic-gate  * the somewhat unique requirements of kmdb as a pseudo-standalone debugger.
457c478bd9Sstevel@tonic-gate  * The debugger portion of kmdb is compiled as a standalone, without any
467c478bd9Sstevel@tonic-gate  * external dependencies.  As a result, it cannot communicate directly to the
477c478bd9Sstevel@tonic-gate  * outside world.  Any such communications must be through functions passed to
487c478bd9Sstevel@tonic-gate  * it by the driver.  The auxv provides a means by which these pointers and
497c478bd9Sstevel@tonic-gate  * other parameters may be passed to the debugger.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #include <gelf.h>
537c478bd9Sstevel@tonic-gate #include <sys/machelf.h>
547c478bd9Sstevel@tonic-gate #include <sys/kdi.h>
55*1ae08745Sheppo #ifdef sun4v
56*1ae08745Sheppo #include <sys/obpdefs.h>
57*1ae08745Sheppo #endif
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #ifdef __cplusplus
607c478bd9Sstevel@tonic-gate extern "C" {
617c478bd9Sstevel@tonic-gate #endif
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate typedef struct kmdb_auxv_nv {
647c478bd9Sstevel@tonic-gate 	char kanv_name[25];
657c478bd9Sstevel@tonic-gate 	char kanv_val[50];
667c478bd9Sstevel@tonic-gate } kmdb_auxv_nv_t;
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #define	KMDB_AUXV_FL_NOUNLOAD	0x1	/* don't allow debugger unload */
697c478bd9Sstevel@tonic-gate #define	KMDB_AUXV_FL_NOTRPSWTCH	0x2	/* don't switch to kmdb's TBA/IDT */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate typedef struct kmdb_auxv {
727c478bd9Sstevel@tonic-gate 	caddr_t		kav_dseg;		/* Base of segdebug */
737c478bd9Sstevel@tonic-gate 	size_t		kav_dseg_size;		/* Size of segdebug */
747c478bd9Sstevel@tonic-gate 	size_t		kav_pagesize;		/* Base page size */
757c478bd9Sstevel@tonic-gate 	int		kav_ncpu;		/* Maximum number of CPUs */
767c478bd9Sstevel@tonic-gate 	kdi_t		*kav_kdi;		/* Ops vector for KDI */
777c478bd9Sstevel@tonic-gate 	void		*kav_romp;		/* Opaque PROM handle */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #ifdef __sparc
807c478bd9Sstevel@tonic-gate 	int		*kav_promexitarmp;	/* PROM exit kmdb entry armer */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate 	caddr_t		kav_tba_active;		/* Trap table to be used */
837c478bd9Sstevel@tonic-gate 	caddr_t		kav_tba_obp;		/* OBP's trap table */
847c478bd9Sstevel@tonic-gate #ifdef	sun4v
857c478bd9Sstevel@tonic-gate 	caddr_t		kav_tba_kernel;		/* Kernel's trap table */
867c478bd9Sstevel@tonic-gate #endif
877c478bd9Sstevel@tonic-gate 	caddr_t		kav_tba_native;		/* kmdb's trap table */
887c478bd9Sstevel@tonic-gate 	size_t		kav_tba_native_sz;	/* kmdb's trap table size */
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
927c478bd9Sstevel@tonic-gate 	kmdb_auxv_nv_t	*kav_pcache;		/* Copies of common props */
937c478bd9Sstevel@tonic-gate 	int		kav_nprops;		/* Size of prop cache */
947c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate 	uintptr_t (*kav_lookup_by_name)(char *, char *); /* Live kernel only */
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate 	void (*kav_wrintr_fire)(void);		/* Send softint to driver */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate 	const char	*kav_config;		/* State string from MDB */
1017c478bd9Sstevel@tonic-gate 	const char	**kav_argv;		/* Args from boot line */
1027c478bd9Sstevel@tonic-gate 	uint_t		kav_flags;		/* KMDB_AUXV_FL_* */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate 	const char	*kav_modpath;		/* kernel module_path */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #ifdef __sparc
1077c478bd9Sstevel@tonic-gate 	void (*kav_ktrap_install)(int, void (*)(void)); /* Add to krnl trptbl */
1087c478bd9Sstevel@tonic-gate 	void (*kav_ktrap_restore)(void);	/* Restore krnl trap hdlrs */
109*1ae08745Sheppo #ifdef sun4v
110*1ae08745Sheppo 	uint_t		kav_domaining;		/* Domaining status */
111*1ae08745Sheppo 	caddr_t		kav_promif_root;	/* PROM shadow tree root */
112*1ae08745Sheppo 	ihandle_t	kav_promif_in;		/* PROM input dev instance */
113*1ae08745Sheppo 	ihandle_t	kav_promif_out;		/* PROM output dev instance */
114*1ae08745Sheppo 	phandle_t	kav_promif_pin;		/* PROM input dev package */
115*1ae08745Sheppo 	phandle_t	kav_promif_pout;	/* PROM output dev package */
116*1ae08745Sheppo 	pnode_t		kav_promif_chosennode;	/* PROM "/chosen" node */
117*1ae08745Sheppo 	pnode_t		kav_promif_optionsnode;	/* PROM "/options" node */
118*1ae08745Sheppo #endif
1197c478bd9Sstevel@tonic-gate #endif
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate } kmdb_auxv_t;
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1247c478bd9Sstevel@tonic-gate }
1257c478bd9Sstevel@tonic-gate #endif
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #endif /* _KMDB_AUXV_H */
128