diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-27 10:46:56 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-27 10:46:56 +0000 |
commit | 889b6c4c11911ab87d3470d9ffc9b559183a51dc (patch) | |
tree | a0b782bd0d9d1f1f65e79e0ecc9bf21bb0aa924c /sys/arch | |
parent | d8270b44b1f22944ea7aaaf8e11b8ddc7fbf94aa (diff) |
Add:
* GPL_MATH_EMULATE: fpemul
* ALWAYS_MATH_EMULATE: causes npx probe to always fail.
* better fp context in struct pcb.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/conf/THREADWAY | 5 | ||||
-rw-r--r-- | sys/arch/i386/conf/files.i386 | 5 | ||||
-rw-r--r-- | sys/arch/i386/i386/freebsd_machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/process_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/trap.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 2 | ||||
-rw-r--r-- | sys/arch/i386/include/npx.h | 28 | ||||
-rw-r--r-- | sys/arch/i386/include/pcb.h | 2 | ||||
-rw-r--r-- | sys/arch/i386/isa/npx.c | 4 |
9 files changed, 45 insertions, 19 deletions
diff --git a/sys/arch/i386/conf/THREADWAY b/sys/arch/i386/conf/THREADWAY index 4d2eca82900..26320ef8a30 100644 --- a/sys/arch/i386/conf/THREADWAY +++ b/sys/arch/i386/conf/THREADWAY @@ -1,7 +1,7 @@ # # THREADWAY: threadway.teeny.org # -# $OpenBSD: THREADWAY,v 1.10 1996/08/09 04:15:27 downsj Exp $ +# $OpenBSD: THREADWAY,v 1.11 1996/08/27 10:46:50 downsj Exp $ # machine i386 @@ -15,6 +15,9 @@ maxusers 32 option TIMEZONE=480 option DST=0 +option GPL_MATH_EMULATE +option ALWAYS_MATH_EMULATE + option SWAPPAGER option VNODEPAGER option DEVPAGER diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index d7350735095..c1ab632856c 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.23 1996/08/08 18:47:13 dm Exp $ +# $OpenBSD: files.i386,v 1.24 1996/08/27 10:46:51 downsj Exp $ # $NetBSD: files.i386,v 1.73 1996/05/07 00:58:36 thorpej Exp $ # # new style config file for i386 architecture @@ -104,6 +104,9 @@ device npx attach npx at isa file arch/i386/isa/npx.c npx needs-flag +# Linux/GNU i387 floating point emulator +include "../../../gnu/arch/i386/fpemul/files.fpemul" + # attribute used to represent the "keyboard controller" # XXX should be a real device define pckbd { [irq = -1], [port = -1] } diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index c226e0f5f90..40439f62b9e 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_machdep.c,v 1.6 1996/05/07 07:21:37 deraadt Exp $ */ +/* $OpenBSD: freebsd_machdep.c,v 1.7 1996/08/27 10:46:51 downsj Exp $ */ /* $NetBSD: freebsd_machdep.c,v 1.10 1996/05/03 19:42:05 christos Exp $ */ /*- @@ -284,6 +284,7 @@ netbsd_to_freebsd_ptrace_regs(nregs, nfpregs, fregs) sizeof(fregs->freebsd_ptrace_fpregs.sv_ac)); fregs->freebsd_ptrace_fpregs.sv_ex_sw = nframe->sv_ex_sw; +#if 0 /* * fortunately, sizeof(freebsd_save87) >= sizeof(save87) */ @@ -294,8 +295,10 @@ netbsd_to_freebsd_ptrace_regs(nregs, nfpregs, fregs) "sizeof(freebsd_save87) >= sizeof(save87)"); } #endif +#endif bcopy(&nframe->sv_ex_tw, fregs->freebsd_ptrace_fpregs.sv_pad, sizeof(nframe->sv_ex_tw)); +#if 0 bcopy(nframe->sv_pad, (caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad + sizeof(nframe->sv_ex_tw), @@ -304,6 +307,7 @@ netbsd_to_freebsd_ptrace_regs(nregs, nfpregs, fregs) sizeof(nframe->sv_ex_tw) + sizeof(nframe->sv_pad), sizeof(fregs->freebsd_ptrace_fpregs.sv_pad) - sizeof(nframe->sv_ex_tw) - sizeof(nframe->sv_pad)); +#endif } void @@ -342,9 +346,11 @@ freebsd_to_netbsd_ptrace_regs(fregs, nregs, nfpregs) */ bcopy(fregs->freebsd_ptrace_fpregs.sv_pad, &nframe->sv_ex_tw, sizeof(nframe->sv_ex_tw)); +#if 0 bcopy((caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad + sizeof(nframe->sv_ex_tw), nframe->sv_pad, sizeof(nframe->sv_pad)); +#endif } /* random value, except FREEBSD_U_AR0_OFFSET..., FREEBSD_U_SAVEFP_OFFSET... */ diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c index 033f5974761..c6b67109aa6 100644 --- a/sys/arch/i386/i386/process_machdep.c +++ b/sys/arch/i386/i386/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.6 1996/05/30 09:30:07 deraadt Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.7 1996/08/27 10:46:52 downsj Exp $ */ /* $NetBSD: process_machdep.c,v 1.22 1996/05/03 19:42:25 christos Exp $ */ /* @@ -97,7 +97,7 @@ process_fpframe(p) struct proc *p; { - return (&p->p_addr->u_pcb.pcb_savefpu); + return (&p->p_addr->u_pcb.pcb_savefpu.npx); } int diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index b5d99f09309..bc6d0badaf3 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.10 1996/05/10 12:44:49 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.11 1996/08/27 10:46:52 downsj Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ #undef DEBUG @@ -298,7 +298,7 @@ trap(frame) goto out; case T_DNA|T_USER: { -#ifdef MATH_EMULATE +#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) int rv; if ((rv = math_emulate(&frame)) == 0) { if (frame.tf_eflags & PSL_T) @@ -434,7 +434,7 @@ trap(frame) case T_BPTFLT|T_USER: /* bpt instruction fault */ case T_TRCTRAP|T_USER: /* trace trap */ -#ifdef MATH_EMULATE +#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) trace: #endif trapsignal(p, SIGTRAP, type &~ T_USER); diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 3abe70557f5..8cf15de524c 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -165,7 +165,7 @@ void startrtclock __P((void)); void npxdrop __P((void)); void npxsave __P((void)); -#ifdef MATH_EMULATE +#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) /* math_emulate.c */ int math_emulate __P((struct trapframe *)); #endif diff --git a/sys/arch/i386/include/npx.h b/sys/arch/i386/include/npx.h index 58feae9ea33..5d23bcf7d0d 100644 --- a/sys/arch/i386/include/npx.h +++ b/sys/arch/i386/include/npx.h @@ -70,14 +70,25 @@ struct fpacc87 { #endif }; -/* Floating point context */ +#ifdef GPL_MATH_EMULATE +#include <gnu/arch/i386/fpemul/math_emu.h> +#endif + +/* Floating point and emulator context */ struct save87 { struct env87 sv_env; /* floating point control/status */ - struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */ -#ifndef dontdef - u_long sv_ex_sw; /* status word for last exception (was pad) */ - u_long sv_ex_tw; /* tag word for last exception (was pad) */ - u_char sv_pad[8 * 2 - 2 * 4]; /* bogus historical padding */ + struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */ + u_long sv_ex_sw; /* status word for last exception */ + u_long sv_ex_tw; /* tag word for last exception */ +}; + +/* For the pcb. */ +union fsave87 { + struct save87 npx; +#ifdef GPL_MATH_EMULATE + union i387_union gplemu; +#else + u_char emupad[176]; /* sizeof(i387_union) */ #endif }; @@ -90,7 +101,8 @@ struct emcsts { /* Intel prefers long real (53 bit) precision */ #define __iBCS_NPXCW__ 0x262 -#define __NetBSD_NPXCW__ 0x127f +#define __BDE_NPXCW__ 0x1272 /* FreeBSD */ +#define __OpenBSD_NPXCW__ 0x127f /* * The standard control word from finit is 0x37F, giving: @@ -115,6 +127,6 @@ struct emcsts { * trapping denormals. */ -#define __INITIAL_NPXCW__ __NetBSD_NPXCW__ +#define __INITIAL_NPXCW__ __OpenBSD_NPXCW__ #endif /* !_I386_NPX_H_ */ diff --git a/sys/arch/i386/include/pcb.h b/sys/arch/i386/include/pcb.h index 3cff2b28c2d..33ea0e21661 100644 --- a/sys/arch/i386/include/pcb.h +++ b/sys/arch/i386/include/pcb.h @@ -67,7 +67,7 @@ struct pcb { union descriptor *pcb_ldt; /* per process (user) LDT */ int pcb_ldt_len; /* number of LDT entries */ int pcb_cr0; /* saved image of CR0 */ - struct save87 pcb_savefpu; /* floating point state for 287/387 */ + union fsave87 pcb_savefpu; /* floating point state for 287/387 */ struct emcsts pcb_saveemc; /* Cyrix EMC state */ /* * Software pcb (extension) diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index 0e2d5b84a0b..309ee672032 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -172,6 +172,7 @@ static inline int npxprobe1(ia) struct isa_attach_args *ia; { +#ifndef ALWAYS_MATH_EMULATE int control; int status; @@ -228,6 +229,7 @@ npxprobe1(ia) return 1; } } +#endif /* * Probe failed. There is no usable FPU. */ @@ -397,7 +399,7 @@ npxintr(arg) * Find the address of npxproc's savefpu. This is not necessarily * the one in curpcb. */ - addr = &p->p_addr->u_pcb.pcb_savefpu; + addr = &p->p_addr->u_pcb.pcb_savefpu.npx; /* * Save state. This does an implied fninit. It had better not halt * the cpu or we'll hang. |