Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] auxiliary vector cleanups

The size of auxiliary vector is fixed at 42 in linux/sched.h. But it isn't
very obvious when looking at linux/elf.h. This patch adds AT_VECTOR_SIZE
so that we can change it if necessary when a new vector is added.

Because of include file ordering problems, doing this necessitated the
extraction of the AT_* symbols into a standalone header file.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

H. J. Lu and committed by
Linus Torvalds
36d57ac4 32605a18

+196 -83
+24
include/asm-alpha/auxvec.h
··· 1 + #ifndef __ASM_ALPHA_AUXVEC_H 2 + #define __ASM_ALPHA_AUXVEC_H 3 + 4 + /* Reserve these numbers for any future use of a VDSO. */ 5 + #if 0 6 + #define AT_SYSINFO 32 7 + #define AT_SYSINFO_EHDR 33 8 + #endif 9 + 10 + /* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the 11 + value is -1, then the cache doesn't exist. Otherwise: 12 + 13 + bit 0-3: Cache set-associativity; 0 means fully associative. 14 + bit 4-7: Log2 of cacheline size. 15 + bit 8-31: Size of the entire cache >> 8. 16 + bit 32-63: Reserved. 17 + */ 18 + 19 + #define AT_L1I_CACHESHAPE 34 20 + #define AT_L1D_CACHESHAPE 35 21 + #define AT_L2_CACHESHAPE 36 22 + #define AT_L3_CACHESHAPE 37 23 + 24 + #endif /* __ASM_ALPHA_AUXVEC_H */
+2 -20
include/asm-alpha/elf.h
··· 1 1 #ifndef __ASM_ALPHA_ELF_H 2 2 #define __ASM_ALPHA_ELF_H 3 3 4 + #include <asm/auxvec.h> 5 + 4 6 /* Special values for the st_other field in the symbol table. */ 5 7 6 8 #define STO_ALPHA_NOPV 0x80 ··· 143 141 ? (amask(AMASK_BWX) ? "ev5" : "ev56") \ 144 142 : amask (AMASK_CIX) ? "ev6" : "ev67"); \ 145 143 }) 146 - 147 - /* Reserve these numbers for any future use of a VDSO. */ 148 - #if 0 149 - #define AT_SYSINFO 32 150 - #define AT_SYSINFO_EHDR 33 151 - #endif 152 - 153 - /* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the 154 - value is -1, then the cache doesn't exist. Otherwise: 155 - 156 - bit 0-3: Cache set-associativity; 0 means fully associative. 157 - bit 4-7: Log2 of cacheline size. 158 - bit 8-31: Size of the entire cache >> 8. 159 - bit 32-63: Reserved. 160 - */ 161 - 162 - #define AT_L1I_CACHESHAPE 34 163 - #define AT_L1D_CACHESHAPE 35 164 - #define AT_L2_CACHESHAPE 36 165 - #define AT_L3_CACHESHAPE 37 166 144 167 145 #ifdef __KERNEL__ 168 146
+4
include/asm-arm/auxvec.h
··· 1 + #ifndef __ASMARM_AUXVEC_H 2 + #define __ASMARM_AUXVEC_H 3 + 4 + #endif
+4
include/asm-arm26/auxvec.h
··· 1 + #ifndef __ASMARM_AUXVEC_H 2 + #define __ASMARM_AUXVEC_H 3 + 4 + #endif
+4
include/asm-cris/auxvec.h
··· 1 + #ifndef __ASMCRIS_AUXVEC_H 2 + #define __ASMCRIS_AUXVEC_H 3 + 4 + #endif
+4
include/asm-frv/auxvec.h
··· 1 + #ifndef __FRV_AUXVEC_H 2 + #define __FRV_AUXVEC_H 3 + 4 + #endif
+4
include/asm-h8300/auxvec.h
··· 1 + #ifndef __ASMH8300_AUXVEC_H 2 + #define __ASMH8300_AUXVEC_H 3 + 4 + #endif
+11
include/asm-i386/auxvec.h
··· 1 + #ifndef __ASMi386_AUXVEC_H 2 + #define __ASMi386_AUXVEC_H 3 + 4 + /* 5 + * Architecture-neutral AT_ values in 0-17, leave some room 6 + * for more of them, start the x86-specific ones at 32. 7 + */ 8 + #define AT_SYSINFO 32 9 + #define AT_SYSINFO_EHDR 33 10 + 11 + #endif
+1 -7
include/asm-i386/elf.h
··· 9 9 #include <asm/user.h> 10 10 #include <asm/processor.h> 11 11 #include <asm/system.h> /* for savesegment */ 12 + #include <asm/auxvec.h> 12 13 13 14 #include <linux/utsname.h> 14 15 ··· 109 108 but that could change... */ 110 109 111 110 #define ELF_PLATFORM (system_utsname.machine) 112 - 113 - /* 114 - * Architecture-neutral AT_ values in 0-17, leave some room 115 - * for more of them, start the x86-specific ones at 32. 116 - */ 117 - #define AT_SYSINFO 32 118 - #define AT_SYSINFO_EHDR 33 119 111 120 112 #ifdef __KERNEL__ 121 113 #define SET_PERSONALITY(ex, ibcs2) do { } while (0)
+11
include/asm-ia64/auxvec.h
··· 1 + #ifndef _ASM_IA64_AUXVEC_H 2 + #define _ASM_IA64_AUXVEC_H 3 + 4 + /* 5 + * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of 6 + * them, start the architecture-specific ones at 32. 7 + */ 8 + #define AT_SYSINFO 32 9 + #define AT_SYSINFO_EHDR 33 10 + 11 + #endif /* _ASM_IA64_AUXVEC_H */
+1 -7
include/asm-ia64/elf.h
··· 12 12 13 13 #include <asm/fpu.h> 14 14 #include <asm/page.h> 15 + #include <asm/auxvec.h> 15 16 16 17 /* 17 18 * This is used to ensure we don't load something for the wrong architecture. ··· 177 176 implementation specific libraries for optimization. Not terribly 178 177 relevant until we have real hardware to play with... */ 179 178 #define ELF_PLATFORM NULL 180 - 181 - /* 182 - * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of 183 - * them, start the architecture-specific ones at 32. 184 - */ 185 - #define AT_SYSINFO 32 186 - #define AT_SYSINFO_EHDR 33 187 179 188 180 #ifdef __KERNEL__ 189 181 #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
+4
include/asm-m32r/auxvec.h
··· 1 + #ifndef _ASM_M32R__AUXVEC_H 2 + #define _ASM_M32R__AUXVEC_H 3 + 4 + #endif /* _ASM_M32R__AUXVEC_H */
+4
include/asm-m68k/auxvec.h
··· 1 + #ifndef __ASMm68k_AUXVEC_H 2 + #define __ASMm68k_AUXVEC_H 3 + 4 + #endif
+4
include/asm-m68knommu/auxvec.h
··· 1 + #ifndef __ASMm68k_AUXVEC_H 2 + #define __ASMm68k_AUXVEC_H 3 + 4 + #endif
+4
include/asm-mips/auxvec.h
··· 1 + #ifndef _ASM_AUXVEC_H 2 + #define _ASM_AUXVEC_H 3 + 4 + #endif /* _ASM_AUXVEC_H */
+4
include/asm-parisc/auxvec.h
··· 1 + #ifndef __ASMPARISC_AUXVEC_H 2 + #define __ASMPARISC_AUXVEC_H 3 + 4 + #endif
+14
include/asm-ppc/auxvec.h
··· 1 + #ifndef __PPC_AUXVEC_H 2 + #define __PPC_AUXVEC_H 3 + 4 + /* 5 + * We need to put in some extra aux table entries to tell glibc what 6 + * the cache block size is, so it can use the dcbz instruction safely. 7 + */ 8 + #define AT_DCACHEBSIZE 19 9 + #define AT_ICACHEBSIZE 20 10 + #define AT_UCACHEBSIZE 21 11 + /* A special ignored type value for PPC, for glibc compatibility. */ 12 + #define AT_IGNOREPPC 22 13 + 14 + #endif
+1 -10
include/asm-ppc/elf.h
··· 7 7 #include <asm/types.h> 8 8 #include <asm/ptrace.h> 9 9 #include <asm/cputable.h> 10 + #include <asm/auxvec.h> 10 11 11 12 /* PowerPC relocations defined by the ABIs */ 12 13 #define R_PPC_NONE 0 ··· 122 121 #define ELF_PLATFORM (NULL) 123 122 124 123 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 125 - 126 - /* 127 - * We need to put in some extra aux table entries to tell glibc what 128 - * the cache block size is, so it can use the dcbz instruction safely. 129 - */ 130 - #define AT_DCACHEBSIZE 19 131 - #define AT_ICACHEBSIZE 20 132 - #define AT_UCACHEBSIZE 21 133 - /* A special ignored type value for PPC, for glibc compatibility. */ 134 - #define AT_IGNOREPPC 22 135 124 136 125 extern int dcache_bsize; 137 126 extern int icache_bsize;
+19
include/asm-ppc64/auxvec.h
··· 1 + #ifndef __PPC64_AUXVEC_H 2 + #define __PPC64_AUXVEC_H 3 + 4 + /* 5 + * We need to put in some extra aux table entries to tell glibc what 6 + * the cache block size is, so it can use the dcbz instruction safely. 7 + */ 8 + #define AT_DCACHEBSIZE 19 9 + #define AT_ICACHEBSIZE 20 10 + #define AT_UCACHEBSIZE 21 11 + /* A special ignored type value for PPC, for glibc compatibility. */ 12 + #define AT_IGNOREPPC 22 13 + 14 + /* The vDSO location. We have to use the same value as x86 for glibc's 15 + * sake :-) 16 + */ 17 + #define AT_SYSINFO_EHDR 33 18 + 19 + #endif /* __PPC64_AUXVEC_H */
+1 -15
include/asm-ppc64/elf.h
··· 4 4 #include <asm/types.h> 5 5 #include <asm/ptrace.h> 6 6 #include <asm/cputable.h> 7 + #include <asm/auxvec.h> 7 8 8 9 /* PowerPC relocations defined by the ABIs */ 9 10 #define R_PPC_NONE 0 ··· 237 236 (exec_stk != EXSTACK_DISABLE_X) : 0) 238 237 239 238 #endif 240 - 241 - /* 242 - * We need to put in some extra aux table entries to tell glibc what 243 - * the cache block size is, so it can use the dcbz instruction safely. 244 - */ 245 - #define AT_DCACHEBSIZE 19 246 - #define AT_ICACHEBSIZE 20 247 - #define AT_UCACHEBSIZE 21 248 - /* A special ignored type value for PPC, for glibc compatibility. */ 249 - #define AT_IGNOREPPC 22 250 - 251 - /* The vDSO location. We have to use the same value as x86 for glibc's 252 - * sake :-) 253 - */ 254 - #define AT_SYSINFO_EHDR 33 255 239 256 240 extern int dcache_bsize; 257 241 extern int icache_bsize;
+4
include/asm-s390/auxvec.h
··· 1 + #ifndef __ASMS390_AUXVEC_H 2 + #define __ASMS390_AUXVEC_H 3 + 4 + #endif
+4
include/asm-sh/auxvec.h
··· 1 + #ifndef __ASM_SH_AUXVEC_H 2 + #define __ASM_SH_AUXVEC_H 3 + 4 + #endif /* __ASM_SH_AUXVEC_H */
+4
include/asm-sh64/auxvec.h
··· 1 + #ifndef __ASM_SH64_AUXVEC_H 2 + #define __ASM_SH64_AUXVEC_H 3 + 4 + #endif /* __ASM_SH64_AUXVEC_H */
+4
include/asm-sparc/auxvec.h
··· 1 + #ifndef __ASMSPARC_AUXVEC_H 2 + #define __ASMSPARC_AUXVEC_H 3 + 4 + #endif /* !(__ASMSPARC_AUXVEC_H) */
+4
include/asm-sparc64/auxvec.h
··· 1 + #ifndef __ASM_SPARC64_AUXVEC_H 2 + #define __ASM_SPARC64_AUXVEC_H 3 + 4 + #endif /* !(__ASM_SPARC64_AUXVEC_H) */
+4
include/asm-um/auxvec.h
··· 1 + #ifndef __UM_AUXVEC_H 2 + #define __UM_AUXVEC_H 3 + 4 + #endif
+4
include/asm-v850/auxvec.h
··· 1 + #ifndef __V850_AUXVEC_H__ 2 + #define __V850_AUXVEC_H__ 3 + 4 + #endif /* __V850_AUXVEC_H__ */
+4
include/asm-x86_64/auxvec.h
··· 1 + #ifndef __ASM_X86_64_AUXVEC_H 2 + #define __ASM_X86_64_AUXVEC_H 3 + 4 + #endif
+4
include/asm-xtensa/auxvec.h
··· 1 + #ifndef __XTENSA_AUXVEC_H 2 + #define __XTENSA_AUXVEC_H 3 + 4 + #endif
+31
include/linux/auxvec.h
··· 1 + #ifndef _LINUX_AUXVEC_H 2 + #define _LINUX_AUXVEC_H 3 + 4 + #include <asm/auxvec.h> 5 + 6 + /* Symbolic values for the entries in the auxiliary table 7 + put on the initial stack */ 8 + #define AT_NULL 0 /* end of vector */ 9 + #define AT_IGNORE 1 /* entry should be ignored */ 10 + #define AT_EXECFD 2 /* file descriptor of program */ 11 + #define AT_PHDR 3 /* program headers for program */ 12 + #define AT_PHENT 4 /* size of program header entry */ 13 + #define AT_PHNUM 5 /* number of program headers */ 14 + #define AT_PAGESZ 6 /* system page size */ 15 + #define AT_BASE 7 /* base address of interpreter */ 16 + #define AT_FLAGS 8 /* flags */ 17 + #define AT_ENTRY 9 /* entry point of program */ 18 + #define AT_NOTELF 10 /* program is not ELF */ 19 + #define AT_UID 11 /* real uid */ 20 + #define AT_EUID 12 /* effective uid */ 21 + #define AT_GID 13 /* real gid */ 22 + #define AT_EGID 14 /* effective gid */ 23 + #define AT_PLATFORM 15 /* string identifying CPU for optimizations */ 24 + #define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ 25 + #define AT_CLKTCK 17 /* frequency at which times() increments */ 26 + 27 + #define AT_SECURE 23 /* secure mode boolean */ 28 + 29 + #define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */ 30 + 31 + #endif /* _LINUX_AUXVEC_H */
+1 -23
include/linux/elf.h
··· 2 2 #define _LINUX_ELF_H 3 3 4 4 #include <linux/types.h> 5 + #include <linux/auxvec.h> 5 6 #include <asm/elf.h> 6 7 7 8 #ifndef elf_read_implies_exec ··· 158 157 #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) 159 158 #define ELF64_ST_BIND(x) ELF_ST_BIND(x) 160 159 #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) 161 - 162 - /* Symbolic values for the entries in the auxiliary table 163 - put on the initial stack */ 164 - #define AT_NULL 0 /* end of vector */ 165 - #define AT_IGNORE 1 /* entry should be ignored */ 166 - #define AT_EXECFD 2 /* file descriptor of program */ 167 - #define AT_PHDR 3 /* program headers for program */ 168 - #define AT_PHENT 4 /* size of program header entry */ 169 - #define AT_PHNUM 5 /* number of program headers */ 170 - #define AT_PAGESZ 6 /* system page size */ 171 - #define AT_BASE 7 /* base address of interpreter */ 172 - #define AT_FLAGS 8 /* flags */ 173 - #define AT_ENTRY 9 /* entry point of program */ 174 - #define AT_NOTELF 10 /* program is not ELF */ 175 - #define AT_UID 11 /* real uid */ 176 - #define AT_EUID 12 /* effective uid */ 177 - #define AT_GID 13 /* real gid */ 178 - #define AT_EGID 14 /* effective gid */ 179 - #define AT_PLATFORM 15 /* string identifying CPU for optimizations */ 180 - #define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ 181 - #define AT_CLKTCK 17 /* frequency at which times() increments */ 182 - 183 - #define AT_SECURE 23 /* secure mode boolean */ 184 160 185 161 typedef struct dynamic{ 186 162 Elf32_Sword d_tag;
+3 -1
include/linux/sched.h
··· 35 35 #include <linux/topology.h> 36 36 #include <linux/seccomp.h> 37 37 38 + #include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 39 + 38 40 struct exec_domain; 39 41 40 42 /* ··· 263 261 mm_counter_t _rss; 264 262 mm_counter_t _anon_rss; 265 263 266 - unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ 264 + unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 267 265 268 266 unsigned dumpable:2; 269 267 cpumask_t cpu_vm_mask;