Add AT_HWCAP and AT_EHDRFLAGS on all platforms.

A new 'u_long *sv_hwcap' field is added to 'struct sysentvec'.  A
process ABI can set this field to point to a value holding a mask of
architecture-specific CPU feature flags.  If an ABI does not wish to
supply AT_HWCAP to processes the field can be left as NULL.

The support code for AT_EHDRFLAGS was already present on all systems,
just the #define was not present.  This is a step towards unifying the
AT_* constants across platforms.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D12290
This commit is contained in:
John Baldwin 2017-09-14 14:26:55 +00:00
parent cbc785c293
commit c2f37b9245
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323579
9 changed files with 23 additions and 9 deletions

View File

@ -85,8 +85,9 @@ __ElfType(Auxinfo);
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 25 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
#define R_ARM_COUNT 33 /* Count of defined relocation types. */

View File

@ -90,8 +90,10 @@ __ElfType(Auxinfo);
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 24 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
/* Define "machine" characteristics */
#define ELF_TARG_CLASS ELFCLASS64

View File

@ -1110,9 +1110,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp)
AUXARGS_ENTRY(pos, AT_FLAGS, args->flags);
AUXARGS_ENTRY(pos, AT_ENTRY, args->entry);
AUXARGS_ENTRY(pos, AT_BASE, args->base);
#ifdef AT_EHDRFLAGS
AUXARGS_ENTRY(pos, AT_EHDRFLAGS, args->hdr_eflags);
#endif
if (imgp->execpathp != 0)
AUXARGS_ENTRY(pos, AT_EXECPATH, imgp->execpathp);
AUXARGS_ENTRY(pos, AT_OSRELDATE,
@ -1133,6 +1131,8 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp)
AUXARGS_ENTRY(pos, AT_STACKPROT, imgp->sysent->sv_shared_page_obj
!= NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
imgp->sysent->sv_stackprot);
if (imgp->sysent->sv_hwcap != NULL)
AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
AUXARGS_ENTRY(pos, AT_NULL, 0);
free(imgp->auxargs, M_TEMP);

View File

@ -144,8 +144,10 @@ __ElfType(Auxinfo);
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 24 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
#define ET_DYN_LOAD_ADDR 0x0120000

View File

@ -107,8 +107,10 @@ __ElfType(Auxinfo);
#define AT_PAGESIZESLEN 19 /* Number of pagesizes. */
#define AT_STACKPROT 21 /* Initial stack protection. */
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 23 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
/*
* Relocation types.

View File

@ -90,8 +90,10 @@ __ElfType(Auxinfo);
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 24 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
/* Define "machine" characteristics */
#define ELF_TARG_CLASS ELFCLASS64

View File

@ -92,8 +92,10 @@ __ElfType(Auxinfo);
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 24 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
/* Define "machine" characteristics */
#if __ELF_WORD_SIZE == 32

View File

@ -129,6 +129,7 @@ struct sysentvec {
void (*sv_schedtail)(struct thread *);
void (*sv_thread_detach)(struct thread *);
int (*sv_trap)(struct thread *);
u_long *sv_hwcap; /* Value passed in AT_HWCAP. */
};
#define SV_ILP32 0x000100 /* 32-bit executable. */

View File

@ -100,8 +100,10 @@ __ElfType(Auxinfo);
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_COUNT 24 /* Count of defined aux entry types. */
#define AT_COUNT 26 /* Count of defined aux entry types. */
/*
* Relocation types.