Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386 Rename the fields of 'struct envxmm' (itself b...
details: https://anonhg.NetBSD.org/src/rev/e3fc5bfea8d8
branches: trunk
changeset: 325148:e3fc5bfea8d8
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Dec 08 20:45:30 2013 +0000
description:
Rename the fields of 'struct envxmm' (itself badly named) so that they
are different from those used for the x87 fpu.
Use a union to describe the 64bit 'address' field so that it correctly
spilt for 32bit binaries.
The freebsd emulation defined its own 'struct freebsd_env87' that the
code just assumed matched the netbsd one.
Since this is a hardware structure, just use the netbsd one.
This shouldn't change the binaries except that 'en_fos' used to be
incorrectly a 32bit field.
diffstat:
sys/arch/i386/i386/freebsd_machdep.c | 12 ++---
sys/arch/i386/i386/ibcs2_machdep.c | 6 +-
sys/arch/i386/i386/machdep.c | 8 ++--
sys/arch/i386/i386/process_machdep.c | 58 +++++++++++++++-----------------
sys/arch/i386/i386/svr4_machdep.c | 6 +-
sys/arch/i386/i386/trap.c | 6 +-
sys/arch/i386/include/freebsd_machdep.h | 13 +------
sys/arch/i386/include/npx.h | 50 ++++++++++++++++-----------
sys/arch/i386/isa/npx.c | 16 ++++----
9 files changed, 84 insertions(+), 91 deletions(-)
diffs (truncated from 441 to 300 lines):
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/i386/freebsd_machdep.c
--- a/sys/arch/i386/i386/freebsd_machdep.c Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/i386/freebsd_machdep.c Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: freebsd_machdep.c,v 1.55 2009/12/10 14:13:50 matt Exp $ */
+/* $NetBSD: freebsd_machdep.c,v 1.56 2013/12/08 20:45:30 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.55 2009/12/10 14:13:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.56 2013/12/08 20:45:30 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -65,7 +65,7 @@
setregs(l, epp, stack);
if (i386_use_fxsave)
- pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __FreeBSD_NPXCW__;
+ pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __FreeBSD_NPXCW__;
else
pcb->pcb_savefpu.sv_87.sv_env.en_cw = __FreeBSD_NPXCW__;
}
@@ -285,8 +285,7 @@
fregs->freebsd_ptrace_regs.tf_esp = nregs->r_esp;
fregs->freebsd_ptrace_regs.tf_ss = nregs->r_ss;
- fregs->freebsd_ptrace_fpregs.sv_env =
- *(struct freebsd_env87 *)&nframe->sv_env;
+ fregs->freebsd_ptrace_fpregs.sv_env = nframe->sv_env;
memcpy(fregs->freebsd_ptrace_fpregs.sv_ac, nframe->sv_ac,
sizeof(fregs->freebsd_ptrace_fpregs.sv_ac));
fregs->freebsd_ptrace_fpregs.sv_ex_sw =
@@ -336,8 +335,7 @@
nregs->r_esp = fregs->freebsd_ptrace_regs.tf_esp;
nregs->r_ss = fregs->freebsd_ptrace_regs.tf_ss;
- nframe->sv_env =
- *(struct env87 *)&fregs->freebsd_ptrace_fpregs.sv_env;
+ nframe->sv_env = fregs->freebsd_ptrace_fpregs.sv_env;
memcpy(nframe->sv_ac, fregs->freebsd_ptrace_fpregs.sv_ac,
sizeof(nframe->sv_ac));
nframe->sv_ex_sw =
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/i386/ibcs2_machdep.c
--- a/sys/arch/i386/i386/ibcs2_machdep.c Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/i386/ibcs2_machdep.c Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $ */
+/* $NetBSD: ibcs2_machdep.c,v 1.41 2013/12/08 20:45:30 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.40 2010/02/14 11:09:54 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.41 2013/12/08 20:45:30 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -69,7 +69,7 @@
setregs(l, epp, stack);
if (i386_use_fxsave)
- pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __iBCS2_NPXCW__;
+ pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __iBCS2_NPXCW__;
else
pcb->pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__;
tf = l->l_md.md_regs;
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/i386/machdep.c Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.739 2013/12/01 01:05:16 christos Exp $ */
+/* $NetBSD: machdep.c,v 1.740 2013/12/08 20:45:30 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.739 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.740 2013/12/08 20:45:30 dsl Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -886,8 +886,8 @@
l->l_md.md_flags &= ~MDL_USEDFPU;
if (i386_use_fxsave) {
- pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = control;
- pcb->pcb_savefpu.sv_xmm.sv_env.en_mxcsr = __INITIAL_MXCSR__;
+ pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = control;
+ pcb->pcb_savefpu.sv_xmm.sv_env.fx_mxcsr = __INITIAL_MXCSR__;
} else
pcb->pcb_savefpu.sv_87.sv_env.en_cw = control;
memcpy(&pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd));
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/i386/process_machdep.c
--- a/sys/arch/i386/i386/process_machdep.c Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/i386/process_machdep.c Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.74 2013/12/01 01:05:16 christos Exp $ */
+/* $NetBSD: process_machdep.c,v 1.75 2013/12/08 20:45:30 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.74 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.75 2013/12/08 20:45:30 dsl Exp $");
#include "opt_vm86.h"
#include "opt_ptrace.h"
@@ -132,14 +132,12 @@
int i;
/* FPU control/status */
- s87->sv_env.en_cw = sxmm->sv_env.en_cw;
- s87->sv_env.en_sw = sxmm->sv_env.en_sw;
+ s87->sv_env.en_cw = sxmm->sv_env.fx_cw;
+ s87->sv_env.en_sw = sxmm->sv_env.fx_sw;
/* tag word handled below */
- s87->sv_env.en_fip = sxmm->sv_env.en_fip;
- s87->sv_env.en_fcs = sxmm->sv_env.en_fcs;
- s87->sv_env.en_opcode = sxmm->sv_env.en_opcode;
- s87->sv_env.en_foo = sxmm->sv_env.en_foo;
- s87->sv_env.en_fos = sxmm->sv_env.en_fos;
+ 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;
/* Tag word and registers. */
s87->sv_env.en_tw = 0;
@@ -147,7 +145,7 @@
for (i = 0; i < 8; i++) {
s87->sv_env.en_tw |=
(xmm_to_s87_tag(sxmm->sv_ac[i].fp_bytes, i,
- sxmm->sv_env.en_tw) << (i * 2));
+ sxmm->sv_env.fx_tw) << (i * 2));
s87->sv_ex_tw |=
(xmm_to_s87_tag(sxmm->sv_ac[i].fp_bytes, i,
@@ -166,21 +164,19 @@
int i;
/* FPU control/status */
- sxmm->sv_env.en_cw = s87->sv_env.en_cw;
- sxmm->sv_env.en_sw = s87->sv_env.en_sw;
+ sxmm->sv_env.fx_cw = s87->sv_env.en_cw;
+ sxmm->sv_env.fx_sw = s87->sv_env.en_sw;
/* tag word handled below */
- sxmm->sv_env.en_fip = s87->sv_env.en_fip;
- sxmm->sv_env.en_fcs = s87->sv_env.en_fcs;
- sxmm->sv_env.en_opcode = s87->sv_env.en_opcode;
- sxmm->sv_env.en_foo = s87->sv_env.en_foo;
- sxmm->sv_env.en_fos = s87->sv_env.en_fos;
+ 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;
/* Tag word and registers. */
for (i = 0; i < 8; i++) {
if (((s87->sv_env.en_tw >> (i * 2)) & 3) == 3)
- sxmm->sv_env.en_tw &= ~(1U << i);
+ sxmm->sv_env.fx_tw &= ~(1U << i);
else
- sxmm->sv_env.en_tw |= (1U << i);
+ sxmm->sv_env.fx_tw |= (1U << i);
#if 0
/*
@@ -257,15 +253,15 @@
* save it temporarily.
*/
if (i386_use_fxsave) {
- uint32_t mxcsr = frame->sv_xmm.sv_env.en_mxcsr;
- uint16_t cw = frame->sv_xmm.sv_env.en_cw;
+ uint32_t mxcsr = frame->sv_xmm.sv_env.fx_mxcsr;
+ uint16_t cw = frame->sv_xmm.sv_env.fx_cw;
/* XXX Don't zero XMM regs? */
memset(&frame->sv_xmm, 0, sizeof(frame->sv_xmm));
- frame->sv_xmm.sv_env.en_cw = cw;
- frame->sv_xmm.sv_env.en_mxcsr = mxcsr;
- frame->sv_xmm.sv_env.en_sw = 0x0000;
- frame->sv_xmm.sv_env.en_tw = 0x00;
+ 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;
} else {
uint16_t cw = frame->sv_87.sv_env.en_cw;
@@ -414,15 +410,15 @@
* The initial control word was already set by setregs(),
* so save it temporarily.
*/
- uint32_t mxcsr = frame->sv_xmm.sv_env.en_mxcsr;
- uint16_t cw = frame->sv_xmm.sv_env.en_cw;
+ uint32_t mxcsr = frame->sv_xmm.sv_env.fx_mxcsr;
+ uint16_t cw = frame->sv_xmm.sv_env.fx_cw;
/* XXX Don't zero XMM regs? */
memset(&frame->sv_xmm, 0, sizeof(frame->sv_xmm));
- frame->sv_xmm.sv_env.en_cw = cw;
- frame->sv_xmm.sv_env.en_mxcsr = mxcsr;
- frame->sv_xmm.sv_env.en_sw = 0x0000;
- frame->sv_xmm.sv_env.en_tw = 0x00;
+ 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;
l->l_md.md_flags |= MDL_USEDFPU;
}
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/i386/svr4_machdep.c
--- a/sys/arch/i386/i386/svr4_machdep.c Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/i386/svr4_machdep.c Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_machdep.c,v 1.96 2010/02/14 11:09:54 drochner Exp $ */
+/* $NetBSD: svr4_machdep.c,v 1.97 2013/12/08 20:45:30 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.96 2010/02/14 11:09:54 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.97 2013/12/08 20:45:30 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -116,7 +116,7 @@
setregs(l, epp, stack);
if (i386_use_fxsave)
- pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __SVR4_NPXCW__;
+ pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __SVR4_NPXCW__;
else
pcb->pcb_savefpu.sv_87.sv_env.en_cw = __SVR4_NPXCW__;
tf->tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/i386/trap.c Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.266 2012/12/08 12:36:30 kiyohara Exp $ */
+/* $NetBSD: trap.c,v 1.267 2013/12/08 20:45:30 dsl Exp $ */
/*-
* Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.266 2012/12/08 12:36:30 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.267 2013/12/08 20:45:30 dsl Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -203,7 +203,7 @@
return 0;
}
pcb = lwp_getpcb(l);
- mxcsr = pcb->pcb_savefpu.sv_xmm.sv_env.en_mxcsr;
+ mxcsr = pcb->pcb_savefpu.sv_xmm.sv_env.fx_mxcsr;
/*
* Since we only have a single status and control register,
diff -r ea93b86710ed -r e3fc5bfea8d8 sys/arch/i386/include/freebsd_machdep.h
--- a/sys/arch/i386/include/freebsd_machdep.h Sun Dec 08 18:08:34 2013 +0000
+++ b/sys/arch/i386/include/freebsd_machdep.h Sun Dec 08 20:45:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: freebsd_machdep.h,v 1.9 2005/09/14 15:00:16 he Exp $ */
+/* $NetBSD: freebsd_machdep.h,v 1.10 2013/12/08 20:45:30 dsl Exp $ */
/*
* Copyright (c) 1986, 1989, 1991, 1993
@@ -143,16 +143,7 @@
};
/* Environment information of floating point unit */
-struct freebsd_env87 {
- long en_cw; /* control word (16bits) */
- long en_sw; /* status word (16bits) */
- long en_tw; /* tag word (16bits) */
- long en_fip; /* floating point instruction pointer */
- u_short en_fcs; /* floating code segment selector */
- u_short en_opcode; /* opcode last executed (11 bits ) */
- long en_foo; /* floating operand offset */
- long en_fos; /* floating operand segment selector */
-};
Home |
Main Index |
Thread Index |
Old Index