xref: /titanic_52/usr/src/uts/common/sys/auxv.h (revision 263f549e5da8b32c4922f586afb365b8ae388a6c)
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 /*
32*263f549eSPatrick Mooney  * Copyright 2016 Joyent, Inc.
33ebb8ac07SRobert Mustacchi  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifndef	_SYS_AUXV_H
367c478bd9Sstevel@tonic-gate #define	_SYS_AUXV_H
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #if !defined(_ASM)
457c478bd9Sstevel@tonic-gate typedef struct
467c478bd9Sstevel@tonic-gate {
477c478bd9Sstevel@tonic-gate 	int	a_type;
487c478bd9Sstevel@tonic-gate 	union {
497c478bd9Sstevel@tonic-gate 		long	a_val;
507c478bd9Sstevel@tonic-gate 		void	*a_ptr;
517c478bd9Sstevel@tonic-gate 		void	(*a_fcn)();
527c478bd9Sstevel@tonic-gate 	} a_un;
537c478bd9Sstevel@tonic-gate } auxv_t;
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate typedef struct {
587c478bd9Sstevel@tonic-gate 	int32_t	a_type;
597c478bd9Sstevel@tonic-gate 	union	{
607c478bd9Sstevel@tonic-gate 		int32_t	a_val;
617c478bd9Sstevel@tonic-gate 		caddr32_t a_ptr;
627c478bd9Sstevel@tonic-gate 		caddr32_t a_fcn;
637c478bd9Sstevel@tonic-gate 	} a_un;
647c478bd9Sstevel@tonic-gate } auxv32_t;
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #endif /* _ASM */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #define	AT_NULL		0
717c478bd9Sstevel@tonic-gate #define	AT_IGNORE	1
727c478bd9Sstevel@tonic-gate #define	AT_EXECFD	2
737c478bd9Sstevel@tonic-gate #define	AT_PHDR		3	/* &phdr[0] */
747c478bd9Sstevel@tonic-gate #define	AT_PHENT	4	/* sizeof(phdr[0]) */
757c478bd9Sstevel@tonic-gate #define	AT_PHNUM	5	/* # phdr entries */
767c478bd9Sstevel@tonic-gate #define	AT_PAGESZ	6	/* getpagesize(2) */
777c478bd9Sstevel@tonic-gate #define	AT_BASE		7	/* ld.so base addr */
787c478bd9Sstevel@tonic-gate #define	AT_FLAGS	8	/* processor flags */
797c478bd9Sstevel@tonic-gate #define	AT_ENTRY	9	/* a.out entry point */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /*
827c478bd9Sstevel@tonic-gate  * These relate to the original PPC ABI document; Linux reused
837c478bd9Sstevel@tonic-gate  * the values for other things (see below), so disambiguation of
847c478bd9Sstevel@tonic-gate  * these values may require additional context in PPC binaries.
857c478bd9Sstevel@tonic-gate  *
867c478bd9Sstevel@tonic-gate  * AT_DCACHEBSIZE	10	smallest data cache block size
877c478bd9Sstevel@tonic-gate  * AT_ICACHEBSIZE	11	smallest instruction cache block size
887c478bd9Sstevel@tonic-gate  * AT_UCACHEBSIZE	12	smallest unified cache block size
897c478bd9Sstevel@tonic-gate  *
907c478bd9Sstevel@tonic-gate  * These are the values from LSB 1.3, the first five are also described
917c478bd9Sstevel@tonic-gate  * in the draft amd64 ABI.
927c478bd9Sstevel@tonic-gate  *
937c478bd9Sstevel@tonic-gate  * At the time of writing, Solaris doesn't place any of these values into
9482e77048Seh208807  * the aux vector, except AT_CLKTCK which is placed on the aux vector for
9582e77048Seh208807  * lx branded processes; also, we do similar things via AT_SUN_ values.
967c478bd9Sstevel@tonic-gate  *
977c478bd9Sstevel@tonic-gate  * AT_NOTELF		10	program is not ELF?
987c478bd9Sstevel@tonic-gate  * AT_UID		11	real user id
997c478bd9Sstevel@tonic-gate  * AT_EUID		12	effective user id
1007c478bd9Sstevel@tonic-gate  * AT_GID		13	real group id
1017c478bd9Sstevel@tonic-gate  * AT_EGID		14	effective group id
1027c478bd9Sstevel@tonic-gate  *
1037c478bd9Sstevel@tonic-gate  * AT_PLATFORM		15
1047c478bd9Sstevel@tonic-gate  * AT_HWCAP		16
1057c478bd9Sstevel@tonic-gate  * AT_CLKTCK		17	c.f. _SC_CLK_TCK
1067c478bd9Sstevel@tonic-gate  * AT_FPUCW		18
1077c478bd9Sstevel@tonic-gate  *
1087c478bd9Sstevel@tonic-gate  * AT_DCACHEBSIZE	19	(moved from 10)
1097c478bd9Sstevel@tonic-gate  * AT_ICACHEBSIZE	20	(moved from 11)
1107c478bd9Sstevel@tonic-gate  * AT_UCACHEBSIZE	21	(moved from 12)
1117c478bd9Sstevel@tonic-gate  *
1127c478bd9Sstevel@tonic-gate  * AT_IGNOREPPC		22
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate /*
1167c478bd9Sstevel@tonic-gate  * Sun extensions begin here
1177c478bd9Sstevel@tonic-gate  */
1187c478bd9Sstevel@tonic-gate #define	AT_SUN_UID	2000	/* effective user id */
1197c478bd9Sstevel@tonic-gate #define	AT_SUN_RUID	2001	/* real user id */
1207c478bd9Sstevel@tonic-gate #define	AT_SUN_GID	2002	/* effective group id */
1217c478bd9Sstevel@tonic-gate #define	AT_SUN_RGID	2003	/* real group id */
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * The following attributes are specific to the
1257c478bd9Sstevel@tonic-gate  * kernel implementation of the linker/loader.
1267c478bd9Sstevel@tonic-gate  */
1277c478bd9Sstevel@tonic-gate #define	AT_SUN_LDELF	2004	/* dynamic linker's ELF header */
1287c478bd9Sstevel@tonic-gate #define	AT_SUN_LDSHDR	2005	/* dynamic linker's section headers */
1297c478bd9Sstevel@tonic-gate #define	AT_SUN_LDNAME	2006	/* name of dynamic linker */
1307c478bd9Sstevel@tonic-gate #define	AT_SUN_LPAGESZ	2007	/* large pagesize */
1317c478bd9Sstevel@tonic-gate /*
1327c478bd9Sstevel@tonic-gate  * The following aux vector provides a null-terminated platform
1337c478bd9Sstevel@tonic-gate  * identification string. This information is the same as provided
1347c478bd9Sstevel@tonic-gate  * by sysinfo(2) when invoked with the command SI_PLATFORM.
1357c478bd9Sstevel@tonic-gate  */
1367c478bd9Sstevel@tonic-gate #define	AT_SUN_PLATFORM	2008	/* platform name */
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate  * These attributes communicate performance -hints- about processor
1407c478bd9Sstevel@tonic-gate  * hardware capabilities that might be useful to library implementations.
1417c478bd9Sstevel@tonic-gate  */
1427c478bd9Sstevel@tonic-gate #define	AT_SUN_HWCAP	2009
143ebb8ac07SRobert Mustacchi #define	AT_SUN_HWCAP2	2023
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * User info regarding machine attributes, respectively reported to native and
1487c478bd9Sstevel@tonic-gate  * non-native user apps.
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate extern uint_t auxv_hwcap;
151ebb8ac07SRobert Mustacchi extern uint_t auxv_hwcap_2;
1527c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1537c478bd9Sstevel@tonic-gate extern uint_t auxv_hwcap32;
154ebb8ac07SRobert Mustacchi extern uint_t auxv_hwcap32_2;
1557c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1567c478bd9Sstevel@tonic-gate #else
1577c478bd9Sstevel@tonic-gate extern uint_t getisax(uint32_t *, uint_t);
1587c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #define	AT_SUN_IFLUSH	2010	/* flush icache? */
1617c478bd9Sstevel@tonic-gate #define	AT_SUN_CPU	2011	/* cpu name */
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate  * The following aux vector provides a pointer to a null-terminated
1657c478bd9Sstevel@tonic-gate  * path name, a copy of the path name passed to the exec() system
1667c478bd9Sstevel@tonic-gate  * call but that has had all symlinks resolved (see resolvepath(2)).
1677c478bd9Sstevel@tonic-gate  */
1687c478bd9Sstevel@tonic-gate #define	AT_SUN_EXECNAME	2014	/* exec() path name */
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate #define	AT_SUN_MMU	2015	/* mmu module name */
1717c478bd9Sstevel@tonic-gate #define	AT_SUN_LDDATA	2016	/* dynamic linkers data segment */
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #define	AT_SUN_AUXFLAGS	2017	/* AF_SUN_ flags passed from the kernel */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate /*
1769acbbeafSnn35248  * Used to indicate to the runtime linker the name of the emulation binary,
1779acbbeafSnn35248  * if one is being used. For brands, this is the name of the brand library.
1789acbbeafSnn35248  */
1799acbbeafSnn35248 #define	AT_SUN_EMULATOR		2018
1809acbbeafSnn35248 
1819acbbeafSnn35248 #define	AT_SUN_BRANDNAME	2019
18207678296Ssl108498 
18307678296Ssl108498 /*
18407678296Ssl108498  * Aux vectors available for brand modules.
18507678296Ssl108498  */
18607678296Ssl108498 #define	AT_SUN_BRAND_AUX1	2020
18707678296Ssl108498 #define	AT_SUN_BRAND_AUX2	2021
18807678296Ssl108498 #define	AT_SUN_BRAND_AUX3	2022
1899acbbeafSnn35248 
1909acbbeafSnn35248 /*
191*263f549eSPatrick Mooney  * Aux vector for comm page
192*263f549eSPatrick Mooney  */
193*263f549eSPatrick Mooney #define	AT_SUN_COMMPAGE		2026
194*263f549eSPatrick Mooney 
195*263f549eSPatrick Mooney /*
196ebb8ac07SRobert Mustacchi  * Note that 2023 is reserved for the AT_SUN_HWCAP2 word defined above.
197ebb8ac07SRobert Mustacchi  */
198ebb8ac07SRobert Mustacchi 
199ebb8ac07SRobert Mustacchi /*
2007c478bd9Sstevel@tonic-gate  * The kernel is in a better position to determine whether a process needs to
2017c478bd9Sstevel@tonic-gate  * ignore dangerous LD environment variables.  If set, this flags tells
2027c478bd9Sstevel@tonic-gate  * ld.so.1 to run "secure" and ignore the the environment.
2037c478bd9Sstevel@tonic-gate  */
2047c478bd9Sstevel@tonic-gate #define	AF_SUN_SETUGID		0x00000001
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate /*
2077c478bd9Sstevel@tonic-gate  * If set, this flag indicates that hardware capabilites can be verified
2087c478bd9Sstevel@tonic-gate  * against the AT_SUN_HWCAP value.
2097c478bd9Sstevel@tonic-gate  */
2107c478bd9Sstevel@tonic-gate #define	AF_SUN_HWCAPVERIFY	0x00000002
2117c478bd9Sstevel@tonic-gate 
212b71d513aSedp /*
213b71d513aSedp  * If set, this flag indicates that the the linker should not initialize
214b71d513aSedp  * any of its link maps as primary link wrt the unified libc threading
215b71d513aSedp  * interfaces.
216b71d513aSedp  */
217b71d513aSedp #define	AF_SUN_NOPLM		0x00000004
218b71d513aSedp 
2197c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2207c478bd9Sstevel@tonic-gate }
2217c478bd9Sstevel@tonic-gate #endif
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_SPARC) || defined(__sparc)
2247c478bd9Sstevel@tonic-gate #include <sys/auxv_SPARC.h>
2257c478bd9Sstevel@tonic-gate #endif
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_386) || defined(__x86)
2287c478bd9Sstevel@tonic-gate #include <sys/auxv_386.h>
2297c478bd9Sstevel@tonic-gate #endif
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate #endif	/* _SYS_AUXV_H */
232