Remove the fields from 'struct save87' and 'struct fxsave' that were used

to save the control word and tag word on fp faults.
Nothing I could find looked at them before I removed the code that wrote them.
It might appear that these fields got exported to userspace (via mcontext),
  but that code carefully avoided those fields.
I've also deleted some very historic fields from the union inside __fpregset_t
  this doesn't affect its size.
The __fpregset_t fields are now the same size as the ones in the pcb.
Which is good because they get cast to each other in a few places.
This commit is contained in:
dsl 2014-02-04 22:21:35 +00:00
parent b2f9af25a4
commit f0aa8ebfcc
2 changed files with 8 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.10 2011/02/25 14:07:13 joerg Exp $ */
/* $NetBSD: mcontext.h,v 1.11 2014/02/04 22:21:35 dsl Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -80,19 +80,15 @@ typedef struct {
union {
struct {
int __fp_state[27]; /* Environment and registers */
int __fp_status; /* Software status word */
} __fpchip_state;
struct {
char __fp_emul[246];
char __fp_epad[2];
} __fp_emul_space;
} __fpchip_state; /* x87 regs in fsave format */
struct {
char __fp_xmm[512];
} __fp_xmm_state;
} __fp_xmm_state; /* x87 and xmm regs in fxsave format */
int __fp_fpregs[128];
} __fp_reg_set;
long __fp_wregs[33]; /* Weitek? */
long __fp_pad[33]; /* Historic padding */
} __fpregset_t;
__CTASSERT(sizeof (__fpregset_t) == 512 + 33 * 4);
typedef struct {
__gregset_t __gregs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: npx.h,v 1.32 2014/01/26 19:16:17 dsl Exp $ */
/* $NetBSD: npx.h,v 1.33 2014/02/04 22:21:35 dsl Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -82,17 +82,10 @@ struct save87 {
#define s87_opcode s87_ip.fa_32.fa_opcode /* opcode last executed (11bits) */
union fp_addr s87_dp; /* floating operand offset */
struct fpacc87 s87_ac[8]; /* accumulator contents, 0-7 */
/* Additional fields that are not part of the hardware definition */
#ifndef dontdef
uint32_t s87_ex_sw; /* status word for last exception */
uint32_t s87_ex_tw; /* tag word for last exception */
uint8_t s87_pad[8 * 2 - 2 * 4]; /* bogus historical padding */
#endif
};
#ifndef __lint__
// Has different packing semantics, adding packed to save87 works
__CTASSERT(sizeof (struct save87) == 108 + 16);
__CTASSERT(sizeof (struct save87) == 108);
#endif
/* SSE/SSE2 registers. */
@ -114,13 +107,10 @@ struct fxsave {
struct fpaccfx fx_87_ac[8]; /* 8 x87 registers */
struct xmmreg sv_xmmregs[8]; /* XMM regs */
uint8_t sv_rsvd[16 * 14];
/* 512-bytes --- end of hardware portion of save area */
uint32_t sv_ex_sw; /* saved SW from last exception */
uint32_t sv_ex_tw; /* saved TW from last exception */
} __aligned(16);
#ifndef __lint__
// lint does not know aligned
__CTASSERT(sizeof (struct fxsave) == 512 + 16);
__CTASSERT(sizeof (struct fxsave) == 512);
#endif