Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300 Make FPU_EMULATE work on NetBSD/hp300. Comme...
details: https://anonhg.NetBSD.org/src/rev/abc8c1175704
branches: trunk
changeset: 789358:abc8c1175704
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Aug 16 13:39:47 2013 +0000
description:
Make FPU_EMULATE work on NetBSD/hp300. Commented out by default in GENERIC.
Tested on HP9000/362 without optional MC68882 FPU in its socket.
diffstat:
sys/arch/hp300/conf/GENERIC | 5 +++--
sys/arch/hp300/conf/files.hp300 | 7 ++++++-
sys/arch/hp300/hp300/locore.s | 4 +++-
sys/arch/hp300/hp300/machdep.c | 12 ++++++++++--
sys/arch/hp300/hp300/trap.c | 37 +++++++++++++++++++++++++++++++++----
5 files changed, 55 insertions(+), 10 deletions(-)
diffs (194 lines):
diff -r 732abf06ea36 -r abc8c1175704 sys/arch/hp300/conf/GENERIC
--- a/sys/arch/hp300/conf/GENERIC Fri Aug 16 11:57:15 2013 +0000
+++ b/sys/arch/hp300/conf/GENERIC Fri Aug 16 13:39:47 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.179 2013/06/30 21:38:57 rmind Exp $
+# $NetBSD: GENERIC,v 1.180 2013/08/16 13:39:47 tsutsui Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.179 $"
+#ident "GENERIC-$Revision: 1.180 $"
maxusers 32 # estimated number of users
@@ -43,6 +43,7 @@
options HP425
options HP433
options FPSP # floating point interface for 68040
+#options FPU_EMULATE # software fpu emulation for MC68030
# Standard system options
options KTRACE # system call tracing support
diff -r 732abf06ea36 -r abc8c1175704 sys/arch/hp300/conf/files.hp300
--- a/sys/arch/hp300/conf/files.hp300 Fri Aug 16 11:57:15 2013 +0000
+++ b/sys/arch/hp300/conf/files.hp300 Fri Aug 16 13:39:47 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hp300,v 1.85 2011/06/12 03:35:40 rmind Exp $
+# $NetBSD: files.hp300,v 1.86 2013/08/16 13:39:47 tsutsui Exp $
#
# hp300-specific configuration info
@@ -208,6 +208,7 @@
file arch/hp300/hp300/disksubr.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
+file arch/m68k/m68k/fpu.c
file arch/m68k/m68k/kgdb_machdep.c kgdb
file arch/m68k/m68k/pmap_motorola.c
file arch/m68k/m68k/procfs_machdep.c procfs
@@ -216,6 +217,10 @@
file dev/cons.c
+# Emulation modules
+# 6888x emulator (FPU_EMULATE)
+include "arch/m68k/fpe/files.fpe"
+
# NetBSD m68k a.out Binary Compatibility (COMPAT_AOUT_M68K)
include "compat/aoutm68k/files.aoutm68k"
diff -r 732abf06ea36 -r abc8c1175704 sys/arch/hp300/hp300/locore.s
--- a/sys/arch/hp300/hp300/locore.s Fri Aug 16 11:57:15 2013 +0000
+++ b/sys/arch/hp300/hp300/locore.s Fri Aug 16 13:39:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.165 2011/12/22 15:33:29 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.166 2013/08/16 13:39:47 tsutsui Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -576,6 +576,8 @@
movl #USRSTACK-4,%a2
movl %a2,%usp | init user SP
+ jbsr _C_LABEL(fpu_probe)
+ movl %d0,_C_LABEL(fputype)
tstl _C_LABEL(fputype) | Have an FPU?
jeq Lenab2 | No, skip.
clrl %a1@(PCB_FPCTX) | ensure null FP context
diff -r 732abf06ea36 -r abc8c1175704 sys/arch/hp300/hp300/machdep.c
--- a/sys/arch/hp300/hp300/machdep.c Fri Aug 16 11:57:15 2013 +0000
+++ b/sys/arch/hp300/hp300/machdep.c Fri Aug 16 13:39:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.226 2012/08/10 12:29:59 tsutsui Exp $ */
+/* $NetBSD: machdep.c,v 1.227 2013/08/16 13:39:47 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,10 +39,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.226 2012/08/10 12:29:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.227 2013/08/16 13:39:47 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
+#include "opt_fpu_emulate.h"
#include "opt_modular.h"
#include "opt_panicbutton.h"
@@ -447,6 +448,13 @@
len += sprintf(cpu_model + len, ", %sMHz MC68881 FPU",
machineid == HP_350 ? "20" : "16.67");
break;
+ case FPU_NONE:
+#ifdef FPU_EMULATE
+ len += sprintf(cpu_model + len, ", emulated FPU");
+#else
+ len += sprintf(cpu_model + len, ", no FPU");
+#endif
+ break;
default:
len += sprintf(cpu_model + len, ", unknown FPU");
}
diff -r 732abf06ea36 -r abc8c1175704 sys/arch/hp300/hp300/trap.c
--- a/sys/arch/hp300/hp300/trap.c Fri Aug 16 11:57:15 2013 +0000
+++ b/sys/arch/hp300/hp300/trap.c Fri Aug 16 13:39:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.149 2012/02/19 21:06:07 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.150 2013/08/16 13:39:47 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,12 +39,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.149 2012/02/19 21:06:07 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.150 2013/08/16 13:39:47 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
#include "opt_kgdb.h"
#include "opt_compat_sunos.h"
+#include "opt_fpu_emulate.h"
#include "opt_m68k_arch.h"
#include <machine/hp300spu.h> /* XXX param.h includes cpu.h */
@@ -74,6 +75,10 @@
#include <dev/cons.h>
+#ifdef FPU_EMULATE
+#include <m68k/fpe/fpu_emulate.h>
+#endif
+
#ifdef COMPAT_SUNOS
#include <compat/sunos/sunos_exec.h>
#include <compat/sunos/sunos_syscall.h>
@@ -378,9 +383,30 @@
ksi.ksi_code = fpsr2siginfocode(code);
break;
-#ifdef M68040
+ /*
+ * FPU faults in supervisor mode.
+ */
+ case T_ILLINST: /* fnop generates this, apparently. */
+ case T_FPEMULI:
+ case T_FPEMULD: {
+ extern label_t *nofault;
+
+ if (nofault) /* If we're probing. */
+ longjmp(nofault);
+ if (type == T_ILLINST)
+ printf("Kernel Illegal Instruction trap.\n");
+ else
+ printf("Kernel FPU trap.\n");
+ goto dopanic;
+ }
+
case T_FPEMULI|T_USER: /* unimplemented FP instruction */
case T_FPEMULD|T_USER: /* unimplemented FP data type */
+#ifdef FPU_EMULATE
+ if (fpu_emulate(fp, &pcb->pcb_fpregs, &ksi) == 0)
+ ; /* XXX - Deal with tracing? (fp->f_sr & PSL_T) */
+ break;
+#elif defined(M68040)
/* XXX need to FSAVE */
printf("pid %d(%s): unimplemented FP %s at %x (EA %x)\n",
p->p_pid, p->p_comm,
@@ -390,6 +416,8 @@
ksi.ksi_signo = SIGFPE;
ksi.ksi_code = FPE_FLTINV;
break;
+#else
+ /* FALLTHROUGH */
#endif
case T_ILLINST|T_USER: /* illegal instruction fault */
@@ -616,7 +644,8 @@
break;
}
}
- trapsignal(l, &ksi);
+ if (ksi.ksi_signo)
+ trapsignal(l, &ksi);
if ((type & T_USER) == 0)
return;
out:
Home |
Main Index |
Thread Index |
Old Index