From owner-svn-src-head@freebsd.org Thu Sep 14 14:30:45 2017 Return-Path: Delivered-To: svn-src-head@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 73552E1BC44; Thu, 14 Sep 2017 14:30:45 +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 4C39D7620E; Thu, 14 Sep 2017 14:30:45 +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 v8EEUiPx045695; Thu, 14 Sep 2017 14:30:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EEUieQ045691; Thu, 14 Sep 2017 14:30:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141430.v8EEUieQ045691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 14:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323580 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 323580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 14:30:45 -0000 Author: jhb Date: Thu Sep 14 14:30:43 2017 New Revision: 323580 URL: https://svnweb.freebsd.org/changeset/base/323580 Log: Add AT_HWCAP flags for VFP settings for FreeBSD/arm. These flags match the meaning and value of flags in Linux, though Linux has many more flags. Reviewed by: stevek, Michal Meloun (earlier version) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12291 Modified: head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/vfp.c head/sys/arm/include/elf.h head/sys/arm/include/md_var.h Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/arm/elf_machdep.c Thu Sep 14 14:30:43 2017 (r323580) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); static boolean_t elf32_arm_abi_supported(struct image_params *); +u_long elf_hwcap; + struct sysentvec elf32_freebsd_sysvec = { .sv_size = SYS_MAXSYSCALL, .sv_table = sysent, @@ -86,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_hwcap = &elf_hwcap, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: head/sys/arm/arm/vfp.c ============================================================================== --- head/sys/arm/arm/vfp.c Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/arm/vfp.c Thu Sep 14 14:30:43 2017 (r323580) @@ -33,9 +33,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -115,6 +117,7 @@ vfp_init(void) vfp_exists = 1; is_d32 = 0; PCPU_SET(vfpsid, fpsid); /* save the fpsid */ + elf_hwcap |= HWCAP_VFP; vfp_arch = (fpsid & VFPSID_SUBVERSION2_MASK) >> VFPSID_SUBVERSION_OFF; @@ -122,9 +125,13 @@ vfp_init(void) if (vfp_arch >= VFP_ARCH3) { tmp = fmrx(mvfr0); PCPU_SET(vfpmvfr0, tmp); + elf_hwcap |= HWCAP_VFPv3; - if ((tmp & VMVFR0_RB_MASK) == 2) + if ((tmp & VMVFR0_RB_MASK) == 2) { + elf_hwcap |= HWCAP_VFPD32; is_d32 = 1; + } else + elf_hwcap |= HWCAP_VFPv3D16; tmp = fmrx(mvfr1); PCPU_SET(vfpmvfr1, tmp); Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/include/elf.h Thu Sep 14 14:30:43 2017 (r323580) @@ -115,4 +115,10 @@ __ElfType(Auxinfo); #define ET_DYN_LOAD_ADDR 0x12000 +/* Flags passed in AT_HWCAP. */ +#define HWCAP_VFP 0x00000040 +#define HWCAP_VFPv3 0x00000200 +#define HWCAP_VFPv3D16 0x00000400 +#define HWCAP_VFPD32 0x00080000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/arm/include/md_var.h ============================================================================== --- head/sys/arm/include/md_var.h Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/include/md_var.h Thu Sep 14 14:30:43 2017 (r323580) @@ -38,6 +38,7 @@ extern char sigcode[]; extern int szsigcode; extern uint32_t *vm_page_dump; extern int vm_page_dump_size; +extern u_long elf_hwcap; extern int (*_arm_memcpy)(void *, void *, int, int); extern int (*_arm_bzero)(void *, int, int);