File Index
Files and directories
Sign in
FILE

elf_aux.c

File preview with syntax highlighting.

linux-6.19.14/arch/um/os-Linux/elf_aux.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 *  arch/um/kernel/elf_aux.c
 4 *
 5 *  Scan the ELF auxiliary vector provided by the host to extract
 6 *  information about vsyscall-page, etc.
 7 *
 8 *  Copyright (C) 2004 Fujitsu Siemens Computers GmbH
 9 *  Author: Bodo Stroesser (bodo.stroesser@fujitsu-siemens.com)
10 */
11#include <elf.h>
12#include <stddef.h>
13#include <init.h>
14#include <elf_user.h>
15#include <mem_user.h>
16#include "internal.h"
17#include <linux/swab.h>
18
19#if __BITS_PER_LONG == 64
20typedef Elf64_auxv_t elf_auxv_t;
21#else
22typedef Elf32_auxv_t elf_auxv_t;
23#endif
24
25/* These are initialized very early in boot and never changed */
26char * elf_aux_platform;
27long elf_aux_hwcap;
28
29__init void scan_elf_aux( char **envp)
30{
31	elf_auxv_t * auxv;
32
33	while ( *envp++ != NULL) ;
34
35	for ( auxv = (elf_auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) {
36		switch ( auxv->a_type ) {
37			case AT_HWCAP:
38				elf_aux_hwcap = auxv->a_un.a_val;
39				break;
40			case AT_PLATFORM:
41                                /* elf.h removed the pointer elements from
42                                 * a_un, so we have to use a_val, which is
43                                 * all that's left.
44                                 */
45				elf_aux_platform =
46					(char *) (long) auxv->a_un.a_val;
47				break;
48		}
49	}
50}
~/ Read-only file preview.