Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and
authorkib <kib@FreeBSD.org>
Tue, 15 Nov 2016 09:43:26 +0000 (09:43 +0000)
committerkib <kib@FreeBSD.org>
Tue, 15 Nov 2016 09:43:26 +0000 (09:43 +0000)
commitbe68c0b10af8836a7c1a7e469f21e4c78f80ad27
treed35094849a8fee41800910a18a9354ecec54674d
parent6dea64ba7416790771586536f5ac3c0517ae7a11
Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and
CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the
ifunc resolvers on x86.

It is much more clean to use CPUID instruction in usermode to retrieve
this information than to pass AT_HWCAP aux vector from kernel, on
x86.  Still, the change does allow for use of AT_HWCAP on arches where it is
needed, by passing aux array to ifunc_init() initializer which should
prepare arguments for ifunc resolvers.

Current signature for resolvers on x86 is
func_t iresolve(uint32_t cpu_feature, uint32_t cpu_feature2,
    uint32_t cpu_stdext_feature, uint32_t cpu_stdext_feature2);
where arguments have identical meaning as the kernel variables of the
same name.  The ABIs allow to use resolvers with the void or shortened
list of arguments.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D8448
20 files changed:
libexec/rtld-elf/aarch64/reloc.c
libexec/rtld-elf/aarch64/rtld_machdep.h
libexec/rtld-elf/amd64/reloc.c
libexec/rtld-elf/amd64/rtld_machdep.h
libexec/rtld-elf/arm/reloc.c
libexec/rtld-elf/arm/rtld_machdep.h
libexec/rtld-elf/i386/reloc.c
libexec/rtld-elf/i386/rtld_machdep.h
libexec/rtld-elf/mips/reloc.c
libexec/rtld-elf/mips/rtld_machdep.h
libexec/rtld-elf/powerpc/reloc.c
libexec/rtld-elf/powerpc/rtld_machdep.h
libexec/rtld-elf/powerpc64/reloc.c
libexec/rtld-elf/powerpc64/rtld_machdep.h
libexec/rtld-elf/riscv/reloc.c
libexec/rtld-elf/riscv/rtld_machdep.h
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
libexec/rtld-elf/sparc64/reloc.c
libexec/rtld-elf/sparc64/rtld_machdep.h