xref: /titanic_51/usr/src/cmd/sgs/link_audit/common/who.h (revision 8b464eb836173b92f2b7a65623cd06c8c3c59289)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #ifndef WHO_DOT_H
30 #define	WHO_DOT_H
31 
32 #include <link.h>
33 #include <sys/regset.h>
34 #include <sys/frame.h>
35 #include <sys/elf.h>
36 
37 #if defined(__sparcv9)
38 #define	Elf_Ehdr	Elf64_Ehdr
39 #define	Elf_Phdr	Elf64_Phdr
40 #define	Elf_Shdr	Elf64_Shdr
41 #define	Elf_Sym		Elf64_Sym
42 #define	elf_getshdr	elf64_getshdr
43 #else
44 #define	Elf_Ehdr	Elf32_Ehdr
45 #define	Elf_Phdr	Elf32_Phdr
46 #define	Elf_Shdr	Elf32_Shdr
47 #define	Elf_Sym		Elf32_Sym
48 #define	elf_getshdr	elf32_getshdr
49 #endif
50 
51 
52 typedef struct objinfo {
53 	caddr_t			o_lpc;		/* low PC */
54 	caddr_t			o_hpc;		/* high PC */
55 	int			o_fd;		/* file descriptor */
56 	Elf 			*o_elf;		/* Elf pointer */
57 	Elf_Sym 		*o_syms;	/* symbol table */
58 	uint_t			o_symcnt;	/* # of symbols */
59 	const char 		*o_strs;	/* symbol string  table */
60 	Link_map 		*o_lmp;
61 	uint_t			o_flags;
62 	struct objinfo 		*o_next;
63 } Objinfo;
64 
65 #define	FLG_OB_NOSYMS	0x0001		/* no symbols available for obj */
66 #define	FLG_OB_FIXED	0x0002		/* fixed address object */
67 
68 
69 #if defined(__sparc) || defined(__sparcv9)
70 #if defined(__GNUC__)
71 #define	FLUSHWIN() __asm__("ta 3");
72 #else	/* !__GNUC__ */
73 #define	FLUSHWIN() asm("ta 3");
74 #endif
75 #define	FRAME_PTR_INDEX 1
76 #define	SKIP_FRAMES 0
77 #endif
78 
79 #if defined(__i386) || defined(__amd64)		/* XX64 -- fix me? */
80 #define	FLUSHWIN()
81 #define	FRAME_PTR_INDEX 3
82 #define	SKIP_FRAMES 1
83 #endif
84 
85 #ifndef	STACK_BIAS
86 #define	STACK_BIAS	0
87 #endif
88 
89 #endif /* WHO_DOT_H */
90