Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/gen/auxv.c
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
static pthread_once_t aux_once = PTHREAD_ONCE_INIT; | static pthread_once_t aux_once = PTHREAD_ONCE_INIT; | ||||
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags; | static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags; | ||||
static int hwcap_present, hwcap2_present; | static int hwcap_present, hwcap2_present; | ||||
static char *canary, *pagesizes, *execpath; | static char *canary, *pagesizes, *execpath; | ||||
static void *ps_strings, *timekeep; | static void *ps_strings, *timekeep; | ||||
static u_long hwcap, hwcap2; | static u_long hwcap, hwcap2; | ||||
static void *fxrng_seed_version; | static void *fxrng_seed_version; | ||||
static u_long usrstackbase, usrstacklim; | |||||
#ifdef __powerpc__ | #ifdef __powerpc__ | ||||
static int powerpc_new_auxv_format = 0; | static int powerpc_new_auxv_format = 0; | ||||
static void _init_aux_powerpc_fixup(void); | static void _init_aux_powerpc_fixup(void); | ||||
int _powerpc_elf_aux_info(int, void *, int); | int _powerpc_elf_aux_info(int, void *, int); | ||||
#endif | #endif | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { | ||||
case AT_PS_STRINGS: | case AT_PS_STRINGS: | ||||
ps_strings = aux->a_un.a_ptr; | ps_strings = aux->a_un.a_ptr; | ||||
break; | break; | ||||
case AT_FXRNG: | case AT_FXRNG: | ||||
fxrng_seed_version = aux->a_un.a_ptr; | fxrng_seed_version = aux->a_un.a_ptr; | ||||
break; | break; | ||||
case AT_USRSTACKBASE: | |||||
usrstackbase = aux->a_un.a_val; | |||||
break; | |||||
case AT_USRSTACKLIM: | |||||
usrstacklim = aux->a_un.a_val; | |||||
break; | |||||
#ifdef __powerpc__ | #ifdef __powerpc__ | ||||
/* | /* | ||||
* Since AT_STACKPROT is always set, and the common | * Since AT_STACKPROT is always set, and the common | ||||
* value 23 is mutually exclusive with the legacy powerpc | * value 23 is mutually exclusive with the legacy powerpc | ||||
* value 21, the existence of AT_STACKPROT proves we are | * value 21, the existence of AT_STACKPROT proves we are | ||||
* on the common format. | * on the common format. | ||||
*/ | */ | ||||
case AT_STACKPROT: /* 23 */ | case AT_STACKPROT: /* 23 */ | ||||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | case AT_PS_STRINGS: | ||||
break; | break; | ||||
case AT_FXRNG: | case AT_FXRNG: | ||||
if (buflen == sizeof(void *)) { | if (buflen == sizeof(void *)) { | ||||
if (fxrng_seed_version != NULL) { | if (fxrng_seed_version != NULL) { | ||||
*(void **)buf = fxrng_seed_version; | *(void **)buf = fxrng_seed_version; | ||||
res = 0; | res = 0; | ||||
} else | } else | ||||
res = ENOENT; | res = ENOENT; | ||||
} else | |||||
res = EINVAL; | |||||
break; | |||||
case AT_USRSTACKBASE: | |||||
if (buflen == sizeof(u_long)) { | |||||
*(u_long *)buf = usrstackbase; | |||||
res = 0; | |||||
} else | |||||
res = EINVAL; | |||||
break; | |||||
case AT_USRSTACKLIM: | |||||
if (buflen == sizeof(u_long)) { | |||||
*(u_long *)buf = usrstacklim; | |||||
res = 0; | |||||
} else | } else | ||||
res = EINVAL; | res = EINVAL; | ||||
break; | break; | ||||
default: | default: | ||||
res = ENOENT; | res = ENOENT; | ||||
break; | break; | ||||
} | } | ||||
return (res); | return (res); | ||||
} | } |