xref: /illumos-gate/usr/src/uts/common/sys/auxv.h (revision 56726c7e)
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
59acbbeafSnn35248  * Common Development and Distribution License (the "License").
69acbbeafSnn35248  * 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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
227c478bd9Sstevel@tonic-gate /*	  All Rights Reserved	*/
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
26ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
27ba3594baSGarrett D'Amore  *
28b71d513aSedp  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
297c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
307c478bd9Sstevel@tonic-gate  */
31ebb8ac07SRobert Mustacchi /*
32d0158222SRobert Mustacchi  * Copyright (c) 2018, Joyent, Inc.
33*56726c7eSRobert Mustacchi  * Copyright 2022 Oxide Computer Company
34ebb8ac07SRobert Mustacchi  */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifndef	_SYS_AUXV_H
377c478bd9Sstevel@tonic-gate #define	_SYS_AUXV_H
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #include <sys/types.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #if !defined(_ASM)
467c478bd9Sstevel@tonic-gate typedef struct
477c478bd9Sstevel@tonic-gate {
487c478bd9Sstevel@tonic-gate 	int	a_type;
497c478bd9Sstevel@tonic-gate 	union {
507c478bd9Sstevel@tonic-gate 		long	a_val;
517c478bd9Sstevel@tonic-gate 		void	*a_ptr;
527c478bd9Sstevel@tonic-gate 		void	(*a_fcn)();
537c478bd9Sstevel@tonic-gate 	} a_un;
547c478bd9Sstevel@tonic-gate } auxv_t;
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate typedef struct {
597c478bd9Sstevel@tonic-gate 	int32_t	a_type;
607c478bd9Sstevel@tonic-gate 	union	{
617c478bd9Sstevel@tonic-gate 		int32_t	a_val;
627c478bd9Sstevel@tonic-gate 		caddr32_t a_ptr;
637c478bd9Sstevel@tonic-gate 		caddr32_t a_fcn;
647c478bd9Sstevel@tonic-gate 	} a_un;
657c478bd9Sstevel@tonic-gate } auxv32_t;
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #endif /* _ASM */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define	AT_NULL		0
727c478bd9Sstevel@tonic-gate #define	AT_IGNORE	1
737c478bd9Sstevel@tonic-gate #define	AT_EXECFD	2
747c478bd9Sstevel@tonic-gate #define	AT_PHDR		3	/* &phdr[0] */
757c478bd9Sstevel@tonic-gate #define	AT_PHENT	4	/* sizeof(phdr[0]) */
767c478bd9Sstevel@tonic-gate #define	AT_PHNUM	5	/* # phdr entries */
777c478bd9Sstevel@tonic-gate #define	AT_PAGESZ	6	/* getpagesize(2) */
787c478bd9Sstevel@tonic-gate #define	AT_BASE		7	/* ld.so base addr */
797c478bd9Sstevel@tonic-gate #define	AT_FLAGS	8	/* processor flags */
807c478bd9Sstevel@tonic-gate #define	AT_ENTRY	9	/* a.out entry point */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * These relate to the original PPC ABI document; Linux reused
847c478bd9Sstevel@tonic-gate  * the values for other things (see below), so disambiguation of
857c478bd9Sstevel@tonic-gate  * these values may require additional context in PPC binaries.
867c478bd9Sstevel@tonic-gate  *
877c478bd9Sstevel@tonic-gate  * AT_DCACHEBSIZE	10	smallest data cache block size
887c478bd9Sstevel@tonic-gate  * AT_ICACHEBSIZE	11	smallest instruction cache block size
897c478bd9Sstevel@tonic-gate  * AT_UCACHEBSIZE	12	smallest unified cache block size
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  * These are the values from LSB 1.3, the first five are also described
927c478bd9Sstevel@tonic-gate  * in the draft amd64 ABI.
937c478bd9Sstevel@tonic-gate  *
947c478bd9Sstevel@tonic-gate  * At the time of writing, Solaris doesn't place any of these values into
9582e77048Seh208807  * the aux vector, except AT_CLKTCK which is placed on the aux vector for
9682e77048Seh208807  * lx branded processes; also, we do similar things via AT_SUN_ values.
977c478bd9Sstevel@tonic-gate  *
987c478bd9Sstevel@tonic-gate  * AT_NOTELF		10	program is not ELF?
997c478bd9Sstevel@tonic-gate  * AT_UID		11	real user id
1007c478bd9Sstevel@tonic-gate  * AT_EUID		12	effective user id
1017c478bd9Sstevel@tonic-gate  * AT_GID		13	real group id
1027c478bd9Sstevel@tonic-gate  * AT_EGID		14	effective group id
1037c478bd9Sstevel@tonic-gate  *
1047c478bd9Sstevel@tonic-gate  * AT_PLATFORM		15
1057c478bd9Sstevel@tonic-gate  * AT_HWCAP		16
1067c478bd9Sstevel@tonic-gate  * AT_CLKTCK		17	c.f. _SC_CLK_TCK
1077c478bd9Sstevel@tonic-gate  * AT_FPUCW		18
1087c478bd9Sstevel@tonic-gate  *
1097c478bd9Sstevel@tonic-gate  * AT_DCACHEBSIZE	19	(moved from 10)
1107c478bd9Sstevel@tonic-gate  * AT_ICACHEBSIZE	20	(moved from 11)
1117c478bd9Sstevel@tonic-gate  * AT_UCACHEBSIZE	21	(moved from 12)
1127c478bd9Sstevel@tonic-gate  *
1137c478bd9Sstevel@tonic-gate  * AT_IGNOREPPC		22
1147c478bd9Sstevel@tonic-gate  */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * Sun extensions begin here
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate #define	AT_SUN_UID	2000	/* effective user id */
1207c478bd9Sstevel@tonic-gate #define	AT_SUN_RUID	2001	/* real user id */
1217c478bd9Sstevel@tonic-gate #define	AT_SUN_GID	2002	/* effective group id */
1227c478bd9Sstevel@tonic-gate #define	AT_SUN_RGID	2003	/* real group id */
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate /*
1257c478bd9Sstevel@tonic-gate  * The following attributes are specific to the
1267c478bd9Sstevel@tonic-gate  * kernel implementation of the linker/loader.
1277c478bd9Sstevel@tonic-gate  */
1287c478bd9Sstevel@tonic-gate #define	AT_SUN_LDELF	2004	/* dynamic linker's ELF header */
1297c478bd9Sstevel@tonic-gate #define	AT_SUN_LDSHDR	2005	/* dynamic linker's section headers */
1307c478bd9Sstevel@tonic-gate #define	AT_SUN_LDNAME	2006	/* name of dynamic linker */
1317c478bd9Sstevel@tonic-gate #define	AT_SUN_LPAGESZ	2007	/* large pagesize */
1327c478bd9Sstevel@tonic-gate /*
1337c478bd9Sstevel@tonic-gate  * The following aux vector provides a null-terminated platform
1347c478bd9Sstevel@tonic-gate  * identification string. This information is the same as provided
1357c478bd9Sstevel@tonic-gate  * by sysinfo(2) when invoked with the command SI_PLATFORM.
1367c478bd9Sstevel@tonic-gate  */
1377c478bd9Sstevel@tonic-gate #define	AT_SUN_PLATFORM	2008	/* platform name */
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * These attributes communicate performance -hints- about processor
1417c478bd9Sstevel@tonic-gate  * hardware capabilities that might be useful to library implementations.
1427c478bd9Sstevel@tonic-gate  */
1437c478bd9Sstevel@tonic-gate #define	AT_SUN_HWCAP	2009
144ebb8ac07SRobert Mustacchi #define	AT_SUN_HWCAP2	2023
145*56726c7eSRobert Mustacchi #define	AT_SUN_HWCAP3	2029
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
1487c478bd9Sstevel@tonic-gate /*
1497c478bd9Sstevel@tonic-gate  * User info regarding machine attributes, respectively reported to native and
1507c478bd9Sstevel@tonic-gate  * non-native user apps.
1517c478bd9Sstevel@tonic-gate  */
1527c478bd9Sstevel@tonic-gate extern uint_t auxv_hwcap;
153ebb8ac07SRobert Mustacchi extern uint_t auxv_hwcap_2;
154*56726c7eSRobert Mustacchi extern uint_t auxv_hwcap_3;
1557c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1567c478bd9Sstevel@tonic-gate extern uint_t auxv_hwcap32;
157ebb8ac07SRobert Mustacchi extern uint_t auxv_hwcap32_2;
158*56726c7eSRobert Mustacchi extern uint_t auxv_hwcap32_3;
1597c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1607c478bd9Sstevel@tonic-gate #else
1617c478bd9Sstevel@tonic-gate extern uint_t getisax(uint32_t *, uint_t);
1627c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #define	AT_SUN_IFLUSH	2010	/* flush icache? */
1657c478bd9Sstevel@tonic-gate #define	AT_SUN_CPU	2011	/* cpu name */
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate /*
1687c478bd9Sstevel@tonic-gate  * The following aux vector provides a pointer to a null-terminated
1697c478bd9Sstevel@tonic-gate  * path name, a copy of the path name passed to the exec() system
1707c478bd9Sstevel@tonic-gate  * call but that has had all symlinks resolved (see resolvepath(2)).
1717c478bd9Sstevel@tonic-gate  */
1727c478bd9Sstevel@tonic-gate #define	AT_SUN_EXECNAME	2014	/* exec() path name */
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate #define	AT_SUN_MMU	2015	/* mmu module name */
1757c478bd9Sstevel@tonic-gate #define	AT_SUN_LDDATA	2016	/* dynamic linkers data segment */
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate #define	AT_SUN_AUXFLAGS	2017	/* AF_SUN_ flags passed from the kernel */
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /*
1809acbbeafSnn35248  * Used to indicate to the runtime linker the name of the emulation binary,
1819acbbeafSnn35248  * if one is being used. For brands, this is the name of the brand library.
1829acbbeafSnn35248  */
1839acbbeafSnn35248 #define	AT_SUN_EMULATOR		2018
1849acbbeafSnn35248 
1859acbbeafSnn35248 #define	AT_SUN_BRANDNAME	2019
18607678296Ssl108498 
18707678296Ssl108498 /*
18807678296Ssl108498  * Aux vectors available for brand modules.
18907678296Ssl108498  */
19007678296Ssl108498 #define	AT_SUN_BRAND_AUX1	2020
19107678296Ssl108498 #define	AT_SUN_BRAND_AUX2	2021
19207678296Ssl108498 #define	AT_SUN_BRAND_AUX3	2022
1939acbbeafSnn35248 
1949acbbeafSnn35248 /*
1952428aad8SPatrick Mooney  * Aux vector for comm page
1962428aad8SPatrick Mooney  */
1972428aad8SPatrick Mooney #define	AT_SUN_COMMPAGE		2026
1982428aad8SPatrick Mooney 
1992428aad8SPatrick Mooney /*
200d0158222SRobert Mustacchi  * These two AUX vectors are generally used to define information about the FPU.
201d0158222SRobert Mustacchi  * These values are currently only used on the x86 platform.
202ebb8ac07SRobert Mustacchi  */
203d0158222SRobert Mustacchi #define	AT_SUN_FPTYPE		2027
204d0158222SRobert Mustacchi #define	AT_SUN_FPSIZE		2028
205ebb8ac07SRobert Mustacchi 
206ebb8ac07SRobert Mustacchi /*
2077c478bd9Sstevel@tonic-gate  * The kernel is in a better position to determine whether a process needs to
2087c478bd9Sstevel@tonic-gate  * ignore dangerous LD environment variables.  If set, this flags tells
2097c478bd9Sstevel@tonic-gate  * ld.so.1 to run "secure" and ignore the the environment.
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate #define	AF_SUN_SETUGID		0x00000001
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate /*
2147c478bd9Sstevel@tonic-gate  * If set, this flag indicates that hardware capabilites can be verified
2157c478bd9Sstevel@tonic-gate  * against the AT_SUN_HWCAP value.
2167c478bd9Sstevel@tonic-gate  */
2177c478bd9Sstevel@tonic-gate #define	AF_SUN_HWCAPVERIFY	0x00000002
2187c478bd9Sstevel@tonic-gate 
219b71d513aSedp /*
220b71d513aSedp  * If set, this flag indicates that the the linker should not initialize
221b71d513aSedp  * any of its link maps as primary link wrt the unified libc threading
222b71d513aSedp  * interfaces.
223b71d513aSedp  */
224b71d513aSedp #define	AF_SUN_NOPLM		0x00000004
225b71d513aSedp 
2267c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2277c478bd9Sstevel@tonic-gate }
2287c478bd9Sstevel@tonic-gate #endif
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_SPARC) || defined(__sparc)
2317c478bd9Sstevel@tonic-gate #include <sys/auxv_SPARC.h>
2327c478bd9Sstevel@tonic-gate #endif
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_386) || defined(__x86)
2357c478bd9Sstevel@tonic-gate #include <sys/auxv_386.h>
2367c478bd9Sstevel@tonic-gate #endif
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate #endif	/* _SYS_AUXV_H */
239