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 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 22 /* All Rights Reserved */ 23 24 25 /* 26 * Copyright 2014 Garrett D'Amore <garrett@damore.org> 27 * 28 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 29 * Use is subject to license terms. 30 */ 31 /* 32 * Copyright (c) 2018, Joyent, Inc. 33 * Copyright 2022 Oxide Computer Company 34 */ 35 36 #ifndef _SYS_AUXV_H 37 #define _SYS_AUXV_H 38 39 #include <sys/types.h> 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #if !defined(_ASM) 46 typedef struct 47 { 48 int a_type; 49 union { 50 long a_val; 51 void *a_ptr; 52 void (*a_fcn)(); 53 } a_un; 54 } auxv_t; 55 56 #if defined(_SYSCALL32) 57 58 typedef struct { 59 int32_t a_type; 60 union { 61 int32_t a_val; 62 caddr32_t a_ptr; 63 caddr32_t a_fcn; 64 } a_un; 65 } auxv32_t; 66 67 #endif /* _SYSCALL32 */ 68 69 #endif /* _ASM */ 70 71 #define AT_NULL 0 72 #define AT_IGNORE 1 73 #define AT_EXECFD 2 74 #define AT_PHDR 3 /* &phdr[0] */ 75 #define AT_PHENT 4 /* sizeof(phdr[0]) */ 76 #define AT_PHNUM 5 /* # phdr entries */ 77 #define AT_PAGESZ 6 /* getpagesize(2) */ 78 #define AT_BASE 7 /* ld.so base addr */ 79 #define AT_FLAGS 8 /* processor flags */ 80 #define AT_ENTRY 9 /* a.out entry point */ 81 82 /* 83 * These relate to the original PPC ABI document; Linux reused 84 * the values for other things (see below), so disambiguation of 85 * these values may require additional context in PPC binaries. 86 * 87 * AT_DCACHEBSIZE 10 smallest data cache block size 88 * AT_ICACHEBSIZE 11 smallest instruction cache block size 89 * AT_UCACHEBSIZE 12 smallest unified cache block size 90 * 91 * These are the values from LSB 1.3, the first five are also described 92 * in the draft amd64 ABI. 93 * 94 * At the time of writing, Solaris doesn't place any of these values into 95 * the aux vector, except AT_CLKTCK which is placed on the aux vector for 96 * lx branded processes; also, 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 #define AT_SUN_HWCAP2 2023 145 #define AT_SUN_HWCAP3 2029 146 147 #if defined(_KERNEL) 148 /* 149 * User info regarding machine attributes, respectively reported to native and 150 * non-native user apps. 151 */ 152 extern uint_t auxv_hwcap; 153 extern uint_t auxv_hwcap_2; 154 extern uint_t auxv_hwcap_3; 155 #if defined(_SYSCALL32) 156 extern uint_t auxv_hwcap32; 157 extern uint_t auxv_hwcap32_2; 158 extern uint_t auxv_hwcap32_3; 159 #endif /* _SYSCALL32 */ 160 #else 161 extern uint_t getisax(uint32_t *, uint_t); 162 #endif /* _KERNEL */ 163 164 #define AT_SUN_IFLUSH 2010 /* flush icache? */ 165 #define AT_SUN_CPU 2011 /* cpu name */ 166 167 /* 168 * The following aux vector provides a pointer to a null-terminated 169 * path name, a copy of the path name passed to the exec() system 170 * call but that has had all symlinks resolved (see resolvepath(2)). 171 */ 172 #define AT_SUN_EXECNAME 2014 /* exec() path name */ 173 174 #define AT_SUN_MMU 2015 /* mmu module name */ 175 #define AT_SUN_LDDATA 2016 /* dynamic linkers data segment */ 176 177 #define AT_SUN_AUXFLAGS 2017 /* AF_SUN_ flags passed from the kernel */ 178 179 /* 180 * Used to indicate to the runtime linker the name of the emulation binary, 181 * if one is being used. For brands, this is the name of the brand library. 182 */ 183 #define AT_SUN_EMULATOR 2018 184 185 #define AT_SUN_BRANDNAME 2019 186 187 /* 188 * Aux vectors available for brand modules. 189 */ 190 #define AT_SUN_BRAND_AUX1 2020 191 #define AT_SUN_BRAND_AUX2 2021 192 #define AT_SUN_BRAND_AUX3 2022 193 194 /* 195 * Aux vector for comm page 196 */ 197 #define AT_SUN_COMMPAGE 2026 198 199 /* 200 * These two AUX vectors are generally used to define information about the FPU. 201 * These values are currently only used on the x86 platform. 202 */ 203 #define AT_SUN_FPTYPE 2027 204 #define AT_SUN_FPSIZE 2028 205 206 /* 207 * The kernel is in a better position to determine whether a process needs to 208 * ignore dangerous LD environment variables. If set, this flags tells 209 * ld.so.1 to run "secure" and ignore the the environment. 210 */ 211 #define AF_SUN_SETUGID 0x00000001 212 213 /* 214 * If set, this flag indicates that hardware capabilites can be verified 215 * against the AT_SUN_HWCAP value. 216 */ 217 #define AF_SUN_HWCAPVERIFY 0x00000002 218 219 /* 220 * If set, this flag indicates that the the linker should not initialize 221 * any of its link maps as primary link wrt the unified libc threading 222 * interfaces. 223 */ 224 #define AF_SUN_NOPLM 0x00000004 225 226 #ifdef __cplusplus 227 } 228 #endif 229 230 #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_SPARC) || defined(__sparc) 231 #include <sys/auxv_SPARC.h> 232 #endif 233 234 #if defined(_AUXV_TARGET_ALL) || defined(_AUXV_TARGET_386) || defined(__x86) 235 #include <sys/auxv_386.h> 236 #endif 237 238 #endif /* _SYS_AUXV_H */ 239