From owner-svn-src-head@freebsd.org Wed Oct 18 17:23:17 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 D01A9E3F769; Wed, 18 Oct 2017 17:23:17 +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 97C7E3124; Wed, 18 Oct 2017 17:23:17 +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 v9IHNGZL055003; Wed, 18 Oct 2017 17:23:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9IHNGQj055000; Wed, 18 Oct 2017 17:23:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201710181723.v9IHNGQj055000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 18 Oct 2017 17:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324724 - in head/sys: conf mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: conf mips/mips X-SVN-Commit-Revision: 324724 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: Wed, 18 Oct 2017 17:23:17 -0000 Author: jhb Date: Wed Oct 18 17:23:16 2017 New Revision: 324724 URL: https://svnweb.freebsd.org/changeset/base/324724 Log: Remove CPU_HAVEFPU. Instead, use a runtime decision to handle COP1 traps. If floating point support is present in the current CPU, enable saving of the floating point state. If support is not present, fail with SIGILL. Reviewed by: imp, br Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D12707 Modified: head/sys/conf/kern.mk head/sys/conf/options.mips head/sys/mips/mips/trap.c Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Wed Oct 18 15:48:26 2017 (r324723) +++ head/sys/conf/kern.mk Wed Oct 18 17:23:16 2017 (r324724) @@ -184,9 +184,6 @@ CFLAGS.gcc+= -mcall-aixdesc .if ${MACHINE_CPUARCH} == "mips" CFLAGS+= -msoft-float INLINE_LIMIT?= 8000 -.if ${MACHINE_ARCH:Mmips*hf} != "" -CFLAGS+= -DCPU_HAVEFPU -.endif .endif # Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Wed Oct 18 15:48:26 2017 (r324723) +++ head/sys/conf/options.mips Wed Oct 18 17:23:16 2017 (r324724) @@ -39,7 +39,6 @@ CPU_PROAPTIV opt_global.h CPU_MIPS32 opt_global.h CPU_MIPS64 opt_global.h CPU_SENTRY5 opt_global.h -CPU_HAVEFPU opt_global.h CPU_SB1 opt_global.h CPU_CNMIPS opt_global.h CPU_RMI opt_global.h Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Wed Oct 18 15:48:26 2017 (r324723) +++ head/sys/mips/mips/trap.c Wed Oct 18 17:23:16 2017 (r324724) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -970,12 +971,13 @@ dofault: case T_COP_UNUSABLE + T_USER: cop = (trapframe->cause & MIPS_CR_COP_ERR) >> MIPS_CR_COP_ERR_SHIFT; if (cop == 1) { -#if !defined(CPU_HAVEFPU) - /* FP (COP1) instruction */ - log_illegal_instruction("COP1_UNUSABLE", trapframe); - i = SIGILL; - break; -#else + /* FP (COP1) instruction */ + if (cpuinfo.fpu_id == 0) { + log_illegal_instruction("COP1_UNUSABLE", + trapframe); + i = SIGILL; + break; + } addr = trapframe->pc; MipsSwitchFPState(PCPU_GET(fpcurthread), td->td_frame); PCPU_SET(fpcurthread, td); @@ -986,7 +988,6 @@ dofault: #endif td->td_md.md_flags |= MDTD_FPUSED; goto out; -#endif } #ifdef CPU_CNMIPS else if (cop == 2) {