Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips Add duplicate code to read the FPU ID.



details:   https://anonhg.NetBSD.org/src/rev/e0cfb1844778
branches:  trunk
changeset: 321240:e0cfb1844778
user:      maya <maya%NetBSD.org@localhost>
date:      Wed Mar 07 15:56:33 2018 +0000

description:
Add duplicate code to read the FPU ID.
enable & disable the FPU around it.

diffstat:

 sys/arch/mips/mips/locore.S |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 703fe75d0d61 -r e0cfb1844778 sys/arch/mips/mips/locore.S
--- a/sys/arch/mips/mips/locore.S       Wed Mar 07 15:52:43 2018 +0000
+++ b/sys/arch/mips/mips/locore.S       Wed Mar 07 15:56:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.213 2018/03/07 15:52:43 maya Exp $        */
+/*     $NetBSD: locore.S,v 1.214 2018/03/07 15:56:33 maya Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,7 +63,7 @@
 #include <mips/trap.h>
 #include <mips/locore.h>
 
-RCSID("$NetBSD: locore.S,v 1.213 2018/03/07 15:52:43 maya Exp $")
+RCSID("$NetBSD: locore.S,v 1.214 2018/03/07 15:56:33 maya Exp $")
 
 #include "assym.h"
 
@@ -167,6 +167,24 @@
        mfc0    t0, MIPS_COP_0_PRID             # read product revision ID
        COP0_SYNC
        nop
+
+#ifdef NOFPU
+       li      t1, 0                           # Dummy FPU_ID
+#else
+       /* Enable the FPU to read FPUID */
+       mfc0    k0, MIPS_COP_0_STATUS
+       MFC0_HAZARD
+       or      k0, MIPS_SR_COP_1_BIT
+       mtc0    k0, MIPS_COP_0_STATUS
+       COP0_HAZARD_FPUENABLE
+
+       cfc1    t1, MIPS_FPU_ID
+
+       /* Disable again, we don't want it on in the kernel */
+       and     k0, ~MIPS_SR_COP_1_BIT
+       mtc0    k0, MIPS_COP_0_STATUS
+#endif
+
 #ifdef NOFPU /* No FPU; avoid touching FPU registers */
        add     t1, zero, zero
 #else



Home | Main Index | Thread Index | Old Index