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