summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/auxv.h
blob: 44407efb0ab5b91be82b2ee25a785128a065c004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved  	*/


/*
 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
 *
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */
/*
 * Copyright 2016 Joyent, Inc.
 */

#ifndef	_SYS_AUXV_H
#define	_SYS_AUXV_H

#include <sys/types.h>

#ifdef	__cplusplus
extern "C" {
#endif

#if !defined(_ASM)
typedef struct
{
	int	a_type;
	union {
		long	a_val;
		void	*a_ptr;
		void	(*a_fcn)();
	} a_un;
} auxv_t;

#if defined(_SYSCALL32)

typedef struct {
	int32_t	a_type;
	union	{
		int32_t	a_val;
		caddr32_t a_ptr;
		caddr32_t a_fcn;
	} a_un;
} auxv32_t;

#endif	/* _SYSCALL32 */

#endif /* _ASM */

#define	AT_NULL		0
#define	AT_IGNORE	1
#define	AT_EXECFD	2
#define	AT_PHDR		3	/* &phdr[0] */
#define	AT_PHENT	4	/* sizeof(phdr[0]) */
#define	AT_PHNUM	5	/* # phdr entries */
#define	AT_PAGESZ	6	/* getpagesize(2) */
#define	AT_BASE		7	/* ld.so base addr */
#define	AT_FLAGS	8	/* processor flags */
#define	AT_ENTRY	9	/* a.out entry point */

/*
 * These relate to the original PPC ABI document; Linux reused
 * the values for other things (see below), so disambiguation of
 * these values may require additional context in PPC binaries.
 *
 * AT_DCACHEBSIZE	10	smallest data cache block size
 * AT_ICACHEBSIZE	11	smallest instruction cache block size
 * AT_UCACHEBSIZE	12	smallest unified cache block size
 *
 * These are the values from LSB 1.3, the first five are also described
 * in the draft amd64 ABI.
 *
 * At the time of writing, Solaris doesn't place any of these values into
 * the aux vector, except AT_CLKTCK which is placed on the aux vector for
 * lx branded processes; also, we do similar things via AT_SUN_ values.
 *
 * AT_NOTELF		10	program is not ELF?
 * AT_UID		11	real user id
 * AT_EUID		12	effective user id
 * AT_GID		13	real group id
 * AT_EGID		14	effective group id
 *
 * AT_PLATFORM		15
 * AT_HWCAP		16
 * AT_CLKTCK		17	c.f. _SC_CLK_TCK
 * AT_FPUCW		18
 *
 * AT_DCACHEBSIZE	19	(moved from 10)
 * AT_ICACHEBSIZE	20	(moved from 11)
 * AT_UCACHEBSIZE	21	(moved from 12)
 *
 * AT_IGNOREPPC		22
 */

/*
 * Sun extensions begin here
 */
#define	AT_SUN_UID	2000	/* effective user id */
#define	AT_SUN_RUID	2001	/* real user id */
#define	AT_SUN_GID	2002	/* effective group id */
#define	AT_SUN_RGID	2003	/* real group id */

/*
 * The following attributes are specific to the
 * kernel implementation of the linker/loader.
 */
#define	AT_SUN_LDELF	2004	/* dynamic linker's ELF header */
#define	AT_SUN_LDSHDR	2005	/* dynamic linker's section headers */
#define	AT_SUN_LDNAME	2006	/* name of dynamic linker */
#define	AT_SUN_LPAGESZ	2007	/* large pagesize */
/*
 * The following aux vector provides a null-terminated platform
 * identification string. This information is the same as provided
 * by sysinfo(2) when invoked with the command SI_PLATFORM.
 */
#define	AT_SUN_PLATFORM	2008	/* platform name */

/*
 * These attributes communicate performance -hints- about processor
 * hardware capabilities that might be useful to library implementations.
 */
#define	AT_SUN_HWCAP	2009
#define	AT_SUN_HWCAP2	2023

#if defined(_KERNEL)
/*
 * User info regarding machine attributes, respectively reported to native and
 * non-native user apps.
 */
extern uint_t auxv_hwcap;
extern uint_t auxv_hwcap_2;
#if defined(_SYSCALL32)
extern uint_t auxv_hwcap32;
extern uint_t auxv_hwcap32_2;
#endif /* _SYSCALL32 */
#else
extern uint_t getisax(uint32_t *, uint_t);
#endif	/* _KERNEL */

#define	AT_SUN_IFLUSH	2010	/* flush icache? */
#define	AT_SUN_CPU	2011	/* cpu name */

/*
 * The following aux vector provides a pointer to a null-terminated
 * path name, a copy of the path name passed to the exec() system
 * call but that has had all symlinks resolved (see resolvepath(2)).
 */
#define	AT_SUN_EXECNAME	2014	/* exec() path name */

#define	AT_SUN_MMU	2015	/* mmu module name */
#define	AT_SUN_LDDATA	2016	/* dynamic linkers data segment */

#define	AT_SUN_AUXFLAGS	2017	/* AF_SUN_ flags passed from the kernel */

/*
 * Used to indicate to the runtime linker the name of the emulation binary,
 * if one is being used. For brands, this is the name of the brand library.
 */
#define	AT_SUN_EMULATOR		2018

#define	AT_SUN_BRANDNAME	2019

/*
 * Aux vectors available for brand modules.
 */
#define	AT_SUN_BRAND_AUX1	2020
#define	AT_SUN_BRAND_AUX2	2021
#define	AT_SUN_BRAND_AUX3	2022

/*
 * Aux vector for comm page
 */
#define	AT_SUN_COMMPAGE		2026

/*
 * Note that 2023 is reserved for the AT_SUN_HWCAP2 word defined above.
 */

/*
 * The kernel is in a better position to determine whether a process needs to
 * ignore dangerous LD environment variables.  If set, this flags tells
 * ld.so.1 to run "secure" and ignore the the environment.
 */
#define	AF_SUN_SETUGID		0x00000001

/*
 * If set, this flag indicates that hardware capabilites can be verified
 * against the AT_SUN_HWCAP value.
 */
#define	AF_SUN_HWCAPVERIFY	0x00000002

/*
 * If set, this flag indicates that the the linker should not initialize
 * any of its link maps as primary link wrt the unified libc threading
 * interfaces.
 */
#define	AF_SUN_NOPLM		0x00000004

#ifdef	__cplusplus
}
#endif

#if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_SPARC) || defined(__sparc)
#include <sys/auxv_SPARC.h>
#endif

#if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_386) || defined(__x86)
#include <sys/auxv_386.h>
#endif

#endif	/* _SYS_AUXV_H */