xref: /illumos-gate/usr/src/uts/common/sys/auxv.h (revision fb3fb4f3d76d55b64440afd0af72775dfad3bd1d)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef	_SYS_AUXV_H
32 #define	_SYS_AUXV_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2	*/
35 
36 #include <sys/types.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #if !defined(_ASM)
43 typedef struct
44 {
45 	int	a_type;
46 	union {
47 		long	a_val;
48 #ifdef __STDC__
49 		void	*a_ptr;
50 #else
51 		char	*a_ptr;
52 #endif
53 		void	(*a_fcn)();
54 	} a_un;
55 } auxv_t;
56 
57 #if defined(_SYSCALL32)
58 
59 typedef struct {
60 	int32_t	a_type;
61 	union	{
62 		int32_t	a_val;
63 		caddr32_t a_ptr;
64 		caddr32_t a_fcn;
65 	} a_un;
66 } auxv32_t;
67 
68 #endif	/* _SYSCALL32 */
69 
70 #endif /* _ASM */
71 
72 #define	AT_NULL		0
73 #define	AT_IGNORE	1
74 #define	AT_EXECFD	2
75 #define	AT_PHDR		3	/* &phdr[0] */
76 #define	AT_PHENT	4	/* sizeof(phdr[0]) */
77 #define	AT_PHNUM	5	/* # phdr entries */
78 #define	AT_PAGESZ	6	/* getpagesize(2) */
79 #define	AT_BASE		7	/* ld.so base addr */
80 #define	AT_FLAGS	8	/* processor flags */
81 #define	AT_ENTRY	9	/* a.out entry point */
82 
83 /*
84  * These relate to the original PPC ABI document; Linux reused
85  * the values for other things (see below), so disambiguation of
86  * these values may require additional context in PPC binaries.
87  *
88  * AT_DCACHEBSIZE	10	smallest data cache block size
89  * AT_ICACHEBSIZE	11	smallest instruction cache block size
90  * AT_UCACHEBSIZE	12	smallest unified cache block size
91  *
92  * These are the values from LSB 1.3, the first five are also described
93  * in the draft amd64 ABI.
94  *
95  * At the time of writing, Solaris doesn't place any of these values into
96  * the aux vector; we do similar things via AT_SUN_ values.
97  *
98  * AT_NOTELF		10	program is not ELF?
99  * AT_UID		11	real user id
100  * AT_EUID		12	effective user id
101  * AT_GID		13	real group id
102  * AT_EGID		14	effective group id
103  *
104  * AT_PLATFORM		15
105  * AT_HWCAP		16
106  * AT_CLKTCK		17	c.f. _SC_CLK_TCK
107  * AT_FPUCW		18
108  *
109  * AT_DCACHEBSIZE	19	(moved from 10)
110  * AT_ICACHEBSIZE	20	(moved from 11)
111  * AT_UCACHEBSIZE	21	(moved from 12)
112  *
113  * AT_IGNOREPPC		22
114  */
115 
116 /*
117  * Sun extensions begin here
118  */
119 #define	AT_SUN_UID	2000	/* effective user id */
120 #define	AT_SUN_RUID	2001	/* real user id */
121 #define	AT_SUN_GID	2002	/* effective group id */
122 #define	AT_SUN_RGID	2003	/* real group id */
123 
124 /*
125  * The following attributes are specific to the
126  * kernel implementation of the linker/loader.
127  */
128 #define	AT_SUN_LDELF	2004	/* dynamic linker's ELF header */
129 #define	AT_SUN_LDSHDR	2005	/* dynamic linker's section headers */
130 #define	AT_SUN_LDNAME	2006	/* name of dynamic linker */
131 #define	AT_SUN_LPAGESZ	2007	/* large pagesize */
132 /*
133  * The following aux vector provides a null-terminated platform
134  * identification string. This information is the same as provided
135  * by sysinfo(2) when invoked with the command SI_PLATFORM.
136  */
137 #define	AT_SUN_PLATFORM	2008	/* platform name */
138 
139 /*
140  * These attributes communicate performance -hints- about processor
141  * hardware capabilities that might be useful to library implementations.
142  */
143 #define	AT_SUN_HWCAP    2009
144 
145 #if defined(_KERNEL)
146 /*
147  * User info regarding machine attributes, respectively reported to native and
148  * non-native user apps.
149  */
150 extern uint_t auxv_hwcap;
151 #if defined(_SYSCALL32)
152 extern uint_t auxv_hwcap32;
153 #endif /* _SYSCALL32 */
154 #else
155 extern uint_t getisax(uint32_t *, uint_t);
156 #endif	/* _KERNEL */
157 
158 #define	AT_SUN_IFLUSH	2010	/* flush icache? */
159 #define	AT_SUN_CPU	2011	/* cpu name */
160 
161 /*
162  * The following aux vector provides a pointer to a null-terminated
163  * path name, a copy of the path name passed to the exec() system
164  * call but that has had all symlinks resolved (see resolvepath(2)).
165  */
166 #define	AT_SUN_EXECNAME	2014	/* exec() path name */
167 
168 #define	AT_SUN_MMU	2015	/* mmu module name */
169 #define	AT_SUN_LDDATA	2016	/* dynamic linkers data segment */
170 
171 #define	AT_SUN_AUXFLAGS	2017	/* AF_SUN_ flags passed from the kernel */
172 
173 /*
174  * The kernel is in a better position to determine whether a process needs to
175  * ignore dangerous LD environment variables.  If set, this flags tells
176  * ld.so.1 to run "secure" and ignore the the environment.
177  */
178 #define	AF_SUN_SETUGID		0x00000001
179 
180 /*
181  * If set, this flag indicates that hardware capabilites can be verified
182  * against the AT_SUN_HWCAP value.
183  */
184 #define	AF_SUN_HWCAPVERIFY	0x00000002
185 
186 
187 #ifdef	__cplusplus
188 }
189 #endif
190 
191 #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_SPARC) || defined(__sparc)
192 #include <sys/auxv_SPARC.h>
193 #endif
194 
195 #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_386) || defined(__x86)
196 #include <sys/auxv_386.h>
197 #endif
198 
199 #endif	/* _SYS_AUXV_H */
200