Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Flatten the floating point register structures bu moving...
details: https://anonhg.NetBSD.org/src/rev/bae1c03e335b
branches: trunk
changeset: 326125:bae1c03e335b
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Jan 19 14:30:37 2014 +0000
description:
Flatten the floating point register structures bu moving the
'environment' registers into the main strcuture.
There are x87 instructions that only affect the environment, but that
is no real excuse for all the sub-structures.
Rename fields so that there are far fewer collisions between the two
sets of field names.
diffstat:
sys/arch/i386/i386/freebsd_machdep.c | 8 +-
sys/arch/i386/i386/ibcs2_machdep.c | 8 +-
sys/arch/i386/i386/machdep.c | 12 +-
sys/arch/i386/i386/process_machdep.c | 92 +++++++++++++++--------------
sys/arch/i386/i386/svr4_machdep.c | 8 +-
sys/arch/i386/i386/trap.c | 6 +-
sys/arch/i386/include/npx.h | 86 +++++++++++++--------------
sys/arch/i386/isa/npx.c | 44 ++++++--------
sys/compat/linux/arch/i386/linux_machdep.c | 10 +-
9 files changed, 135 insertions(+), 139 deletions(-)
diffs (truncated from 614 to 300 lines):
diff -r 3dd7b54672c1 -r bae1c03e335b sys/arch/i386/i386/freebsd_machdep.c
--- a/sys/arch/i386/i386/freebsd_machdep.c Sun Jan 19 13:40:59 2014 +0000
+++ b/sys/arch/i386/i386/freebsd_machdep.c Sun Jan 19 14:30:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: freebsd_machdep.c,v 1.57 2014/01/19 13:35:58 dsl Exp $ */
+/* $NetBSD: freebsd_machdep.c,v 1.58 2014/01/19 14:30:37 dsl Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.57 2014/01/19 13:35:58 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.58 2014/01/19 14:30:37 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -64,9 +64,9 @@
setregs(l, epp, stack);
if (i386_use_fxsave)
- pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __FreeBSD_NPXCW__;
+ pcb->pcb_savefpu.sv_xmm.fx_cw = __FreeBSD_NPXCW__;
else
- pcb->pcb_savefpu.sv_87.sv_env.en_cw = __FreeBSD_NPXCW__;
+ pcb->pcb_savefpu.sv_87.s87_cw = __FreeBSD_NPXCW__;
}
/*
diff -r 3dd7b54672c1 -r bae1c03e335b sys/arch/i386/i386/ibcs2_machdep.c
--- a/sys/arch/i386/i386/ibcs2_machdep.c Sun Jan 19 13:40:59 2014 +0000
+++ b/sys/arch/i386/i386/ibcs2_machdep.c Sun Jan 19 14:30:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_machdep.c,v 1.41 2013/12/08 20:45:30 dsl Exp $ */
+/* $NetBSD: ibcs2_machdep.c,v 1.42 2014/01/19 14:30:37 dsl Exp $ */
/*-
* Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.41 2013/12/08 20:45:30 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.42 2014/01/19 14:30:37 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -69,9 +69,9 @@
setregs(l, epp, stack);
if (i386_use_fxsave)
- pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __iBCS2_NPXCW__;
+ pcb->pcb_savefpu.sv_xmm.fx_cw = __iBCS2_NPXCW__;
else
- pcb->pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__;
+ pcb->pcb_savefpu.sv_87.s87_cw = __iBCS2_NPXCW__;
tf = l->l_md.md_regs;
tf->tf_eax = 0x2000000; /* XXX base of heap */
tf->tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
diff -r 3dd7b54672c1 -r bae1c03e335b sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Sun Jan 19 13:40:59 2014 +0000
+++ b/sys/arch/i386/i386/machdep.c Sun Jan 19 14:30:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.741 2014/01/09 00:57:25 dholland Exp $ */
+/* $NetBSD: machdep.c,v 1.742 2014/01/19 14:30:37 dsl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.741 2014/01/09 00:57:25 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.742 2014/01/19 14:30:37 dsl Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -887,10 +887,10 @@
l->l_md.md_flags &= ~MDL_USEDFPU;
if (i386_use_fxsave) {
- pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = control;
- pcb->pcb_savefpu.sv_xmm.sv_env.fx_mxcsr = __INITIAL_MXCSR__;
+ pcb->pcb_savefpu.sv_xmm.fx_cw = control;
+ pcb->pcb_savefpu.sv_xmm.fx_mxcsr = __INITIAL_MXCSR__;
} else
- pcb->pcb_savefpu.sv_87.sv_env.en_cw = control;
+ pcb->pcb_savefpu.sv_87.s87_cw = control;
memcpy(&pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd));
memcpy(&pcb->pcb_gsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_gsd));
@@ -1761,7 +1761,7 @@
sizeof (pcb->pcb_savefpu.sv_xmm));
} else {
/* This is a weird corner case */
- process_xmm_to_s87((struct savexmm *)
+ process_xmm_to_s87((struct fxsave *)
&mcp->__fpregs.__fp_reg_set.__fp_xmm_state.__fp_xmm,
&pcb->pcb_savefpu.sv_87);
}
diff -r 3dd7b54672c1 -r bae1c03e335b sys/arch/i386/i386/process_machdep.c
--- a/sys/arch/i386/i386/process_machdep.c Sun Jan 19 13:40:59 2014 +0000
+++ b/sys/arch/i386/i386/process_machdep.c Sun Jan 19 14:30:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.76 2014/01/04 00:10:02 dsl Exp $ */
+/* $NetBSD: process_machdep.c,v 1.77 2014/01/19 14:30:37 dsl Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.76 2014/01/04 00:10:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.77 2014/01/19 14:30:37 dsl Exp $");
#include "opt_vm86.h"
#include "opt_ptrace.h"
@@ -127,69 +127,73 @@
}
void
-process_xmm_to_s87(const struct savexmm *sxmm, struct save87 *s87)
+process_xmm_to_s87(const struct fxsave *sxmm, struct save87 *s87)
{
int i;
+ /* Convert context sent by userspace */
+
/* FPU control/status */
- s87->sv_env.en_cw = sxmm->sv_env.fx_cw;
- s87->sv_env.en_sw = sxmm->sv_env.fx_sw;
+ s87->s87_cw = sxmm->fx_cw;
+ s87->s87_sw = sxmm->fx_sw;
/* tag word handled below */
- s87->sv_env.en_ip = sxmm->sv_env.fx_ip;
- s87->sv_env.en_opcode = sxmm->sv_env.fx_opcode;
- s87->sv_env.en_dp = sxmm->sv_env.fx_dp;
+ s87->s87_ip = sxmm->fx_ip;
+ s87->s87_opcode = sxmm->fx_opcode;
+ s87->s87_dp = sxmm->fx_dp;
/* Tag word and registers. */
- s87->sv_env.en_tw = 0;
- s87->sv_ex_tw = 0;
+ s87->s87_tw = 0;
+ s87->s87_ex_tw = 0;
for (i = 0; i < 8; i++) {
- s87->sv_env.en_tw |=
+ s87->s87_tw |=
(xmm_to_s87_tag(sxmm->sv_ac[i].fp_bytes, i,
- sxmm->sv_env.fx_tw) << (i * 2));
+ sxmm->fx_tw) << (i * 2));
- s87->sv_ex_tw |=
+ s87->s87_ex_tw |=
(xmm_to_s87_tag(sxmm->sv_ac[i].fp_bytes, i,
sxmm->sv_ex_tw) << (i * 2));
- memcpy(&s87->sv_ac[i].fp_bytes, &sxmm->sv_ac[i].fp_bytes,
- sizeof(s87->sv_ac[i].fp_bytes));
+ memcpy(&s87->s87_ac[i].fp_bytes, &sxmm->sv_ac[i].fp_bytes,
+ sizeof(s87->s87_ac[i].fp_bytes));
}
- s87->sv_ex_sw = sxmm->sv_ex_sw;
+ s87->s87_ex_sw = sxmm->sv_ex_sw;
}
void
-process_s87_to_xmm(const struct save87 *s87, struct savexmm *sxmm)
+process_s87_to_xmm(const struct save87 *s87, struct fxsave *sxmm)
{
int i;
+ /* Convert context sent by userspace */
+
/* FPU control/status */
- sxmm->sv_env.fx_cw = s87->sv_env.en_cw;
- sxmm->sv_env.fx_sw = s87->sv_env.en_sw;
+ sxmm->fx_cw = s87->s87_cw;
+ sxmm->fx_sw = s87->s87_sw;
/* tag word handled below */
- sxmm->sv_env.fx_ip = s87->sv_env.en_ip;
- sxmm->sv_env.fx_opcode = s87->sv_env.en_opcode;
- sxmm->sv_env.fx_dp = s87->sv_env.en_dp;
+ sxmm->fx_ip = s87->s87_ip;
+ sxmm->fx_opcode = s87->s87_opcode;
+ sxmm->fx_dp = s87->s87_dp;
/* Tag word and registers. */
for (i = 0; i < 8; i++) {
- if (((s87->sv_env.en_tw >> (i * 2)) & 3) == 3)
- sxmm->sv_env.fx_tw &= ~(1U << i);
+ if (((s87->s87_tw >> (i * 2)) & 3) == 3)
+ sxmm->fx_tw &= ~(1U << i);
else
- sxmm->sv_env.fx_tw |= (1U << i);
+ sxmm->fx_tw |= (1U << i);
#if 0
/*
* Software-only word not provided by the userland fpreg
* structure.
*/
- if (((s87->sv_ex_tw >> (i * 2)) & 3) == 3)
+ if (((s87->s87_ex_tw >> (i * 2)) & 3) == 3)
sxmm->sv_ex_tw &= ~(1U << i);
else
sxmm->sv_ex_tw |= (1U << i);
#endif
- memcpy(&sxmm->sv_ac[i].fp_bytes, &s87->sv_ac[i].fp_bytes,
+ memcpy(&sxmm->sv_ac[i].fp_bytes, &s87->s87_ac[i].fp_bytes,
sizeof(sxmm->sv_ac[i].fp_bytes));
}
#if 0
@@ -197,7 +201,7 @@
* Software-only word not provided by the userland fpreg
* structure.
*/
- sxmm->sv_ex_sw = s87->sv_ex_sw;
+ sxmm->sv_ex_sw = s87->s87_ex_sw;
#endif
}
@@ -253,22 +257,22 @@
* save it temporarily.
*/
if (i386_use_fxsave) {
- uint32_t mxcsr = frame->sv_xmm.sv_env.fx_mxcsr;
- uint16_t cw = frame->sv_xmm.sv_env.fx_cw;
+ uint32_t mxcsr = frame->sv_xmm.fx_mxcsr;
+ uint16_t cw = frame->sv_xmm.fx_cw;
/* XXX Don't zero XMM regs? */
memset(&frame->sv_xmm, 0, sizeof(frame->sv_xmm));
- frame->sv_xmm.sv_env.fx_cw = cw;
- frame->sv_xmm.sv_env.fx_mxcsr = mxcsr;
- frame->sv_xmm.sv_env.fx_sw = 0x0000;
- frame->sv_xmm.sv_env.fx_tw = 0x00;
+ frame->sv_xmm.fx_cw = cw;
+ frame->sv_xmm.fx_mxcsr = mxcsr;
+ frame->sv_xmm.fx_sw = 0x0000;
+ frame->sv_xmm.fx_tw = 0x00;
} else {
- uint16_t cw = frame->sv_87.sv_env.en_cw;
+ uint16_t cw = frame->sv_87.s87_cw;
memset(&frame->sv_87, 0, sizeof(frame->sv_87));
- frame->sv_87.sv_env.en_cw = cw;
- frame->sv_87.sv_env.en_sw = 0x0000;
- frame->sv_87.sv_env.en_tw = 0xffff;
+ frame->sv_87.s87_cw = cw;
+ frame->sv_87.s87_sw = 0x0000;
+ frame->sv_87.s87_tw = 0xffff;
}
l->l_md.md_flags |= MDL_USEDFPU;
}
@@ -410,15 +414,15 @@
* The initial control word was already set by setregs(),
* so save it temporarily.
*/
- uint32_t mxcsr = frame->sv_xmm.sv_env.fx_mxcsr;
- uint16_t cw = frame->sv_xmm.sv_env.fx_cw;
+ uint32_t mxcsr = frame->sv_xmm.fx_mxcsr;
+ uint16_t cw = frame->sv_xmm.fx_cw;
/* XXX Don't zero XMM regs? */
memset(&frame->sv_xmm, 0, sizeof(frame->sv_xmm));
- frame->sv_xmm.sv_env.fx_cw = cw;
- frame->sv_xmm.sv_env.fx_mxcsr = mxcsr;
- frame->sv_xmm.sv_env.fx_sw = 0x0000;
- frame->sv_xmm.sv_env.fx_tw = 0x00;
+ frame->sv_xmm.fx_cw = cw;
+ frame->sv_xmm.fx_mxcsr = mxcsr;
+ frame->sv_xmm.fx_sw = 0x0000;
+ frame->sv_xmm.fx_tw = 0x00;
l->l_md.md_flags |= MDL_USEDFPU;
}
diff -r 3dd7b54672c1 -r bae1c03e335b sys/arch/i386/i386/svr4_machdep.c
--- a/sys/arch/i386/i386/svr4_machdep.c Sun Jan 19 13:40:59 2014 +0000
+++ b/sys/arch/i386/i386/svr4_machdep.c Sun Jan 19 14:30:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_machdep.c,v 1.97 2013/12/08 20:45:30 dsl Exp $ */
+/* $NetBSD: svr4_machdep.c,v 1.98 2014/01/19 14:30:37 dsl Exp $ */
/*-
* Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.97 2013/12/08 20:45:30 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.98 2014/01/19 14:30:37 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
Home |
Main Index |
Thread Index |
Old Index