From owner-svn-src-stable@freebsd.org Tue Oct 17 12:45:53 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE2ACE39853; Tue, 17 Oct 2017 12:45:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 882706B680; Tue, 17 Oct 2017 12:45:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9HCjqon031673; Tue, 17 Oct 2017 12:45:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9HCjp7p031663; Tue, 17 Oct 2017 12:45:51 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201710171245.v9HCjp7p031663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 17 Oct 2017 12:45:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r324687 - in stable/11/sys: arm/include arm64/include kern mips/include powerpc/include riscv/include sparc64/include sys x86/include X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys: arm/include arm64/include kern mips/include powerpc/include riscv/include sparc64/include sys x86/include X-SVN-Commit-Revision: 324687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2017 12:45:53 -0000 Author: jhb Date: Tue Oct 17 12:45:51 2017 New Revision: 324687 URL: https://svnweb.freebsd.org/changeset/base/324687 Log: MFC 323579,323585: Add AT_HWCAP and AT_EHDRFLAGS on all platforms. To preserve KBI on stable/11, a new SV_HWCAP flag is added which indicates if the sv_hwcap field is present and valid to avoid examining the field in old modules. Only sysentvec's which wish to use sv_hwcap need to set the flag in stable/11. 323579: 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. 323585: Add AT_EHDRFLAGS and AT_HWCAP on amd64. x86 has two separate (but identical) list of AT_* constants and the earlier commit to add AT_HWCAP only updated the i386 list. Modified: stable/11/sys/arm/include/elf.h stable/11/sys/arm64/include/elf.h stable/11/sys/kern/imgact_elf.c stable/11/sys/mips/include/elf.h stable/11/sys/powerpc/include/elf.h stable/11/sys/riscv/include/elf.h stable/11/sys/sparc64/include/elf.h stable/11/sys/sys/sysent.h stable/11/sys/x86/include/elf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/elf.h ============================================================================== --- stable/11/sys/arm/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/arm/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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. */ Modified: stable/11/sys/arm64/include/elf.h ============================================================================== --- stable/11/sys/arm64/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/arm64/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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 Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/kern/imgact_elf.c Tue Oct 17 12:45:51 2017 (r324687) @@ -1110,9 +1110,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct 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,9 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct 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_flags & SV_HWCAP) != 0 && + 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); Modified: stable/11/sys/mips/include/elf.h ============================================================================== --- stable/11/sys/mips/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/mips/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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 Modified: stable/11/sys/powerpc/include/elf.h ============================================================================== --- stable/11/sys/powerpc/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/powerpc/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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. Modified: stable/11/sys/riscv/include/elf.h ============================================================================== --- stable/11/sys/riscv/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/riscv/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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 Modified: stable/11/sys/sparc64/include/elf.h ============================================================================== --- stable/11/sys/sparc64/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/sparc64/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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 Modified: stable/11/sys/sys/sysent.h ============================================================================== --- stable/11/sys/sys/sysent.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/sys/sysent.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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. */ @@ -138,6 +139,7 @@ struct sysentvec { #define SV_SHP 0x010000 /* Shared page. */ #define SV_CAPSICUM 0x020000 /* Force cap_enter() on startup. */ #define SV_TIMEKEEP 0x040000 /* Shared page timehands. */ +#define SV_HWCAP 0x080000 /* sv_hwcap field is valid. */ #define SV_ABI_MASK 0xff #define SV_ABI_ERRNO(p, e) ((p)->p_sysent->sv_errsize <= 0 ? e : \ Modified: stable/11/sys/x86/include/elf.h ============================================================================== --- stable/11/sys/x86/include/elf.h Tue Oct 17 12:42:17 2017 (r324686) +++ stable/11/sys/x86/include/elf.h Tue Oct 17 12:45:51 2017 (r324687) @@ -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. @@ -185,8 +187,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.