Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86 Check the argument types for the fpu asm functi...



details:   https://anonhg.NetBSD.org/src/rev/0106186291ef
branches:  trunk
changeset: 326694:0106186291ef
user:      dsl <dsl%NetBSD.org@localhost>
date:      Thu Feb 13 19:37:08 2014 +0000

description:
Check the argument types for the fpu asm functions.

diffstat:

 sys/arch/x86/include/cpu_extended_state.h |  13 ++++++-------
 sys/arch/x86/include/cpufunc.h            |  23 ++++++++++++++---------
 sys/arch/x86/x86/fpu.c                    |   8 ++++----
 3 files changed, 24 insertions(+), 20 deletions(-)

diffs (130 lines):

diff -r 44b91dc9a39b -r 0106186291ef sys/arch/x86/include/cpu_extended_state.h
--- a/sys/arch/x86/include/cpu_extended_state.h Thu Feb 13 17:42:24 2014 +0000
+++ b/sys/arch/x86/include/cpu_extended_state.h Thu Feb 13 19:37:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_extended_state.h,v 1.5 2014/02/12 23:24:09 dsl Exp $       */
+/*     $NetBSD: cpu_extended_state.h,v 1.6 2014/02/13 19:37:08 dsl Exp $       */
 
 #ifndef _X86_CPU_EXTENDED_STATE_H_
 #define _X86_CPU_EXTENDED_STATE_H_
@@ -55,13 +55,13 @@
                uint16_t fa_seg;        /* code/data (etc) segment */
                uint16_t fa_opcode;     /* last opcode (sometimes) */
        } fa_32;
-} __packed;
+} __packed __aligned(4);
 
 /* The x87 registers are 80 bits */
 struct fpacc87 {
        uint64_t        f87_mantissa;   /* mantissa */
        uint16_t        f87_exp_sign;   /* exponent and sign */
-} __packed;
+} __packed __aligned(2);
 
 /* The x87 registers padded out to 16 bytes for fxsave */
 struct fpaccfx {
@@ -88,9 +88,9 @@
  * The fxsave 'Abridged tag word' in inverted.
  */
 struct save87 {
-       uint32_t        s87_cw;         /* control word (16bits) */
-       uint32_t        s87_sw;         /* status word (16bits) */
-       uint32_t        s87_tw;         /* tag word (16bits) */
+       uint16_t        s87_cw __aligned(4);    /* control word (16bits) */
+       uint16_t        s87_sw __aligned(4);    /* status word (16bits) */
+       uint16_t        s87_tw __aligned(4);    /* tag word (16bits) */
        union fp_addr   s87_ip;         /* floating point instruction pointer */
 #define s87_opcode s87_ip.fa_32.fa_opcode      /* opcode last executed (11bits) */
        union fp_addr   s87_dp;         /* floating operand offset */
@@ -103,7 +103,6 @@
 /*0*/  uint16_t        fx_cw;          /* FPU Control Word */
        uint16_t        fx_sw;          /* FPU Status Word */
        uint8_t         fx_tw;          /* FPU Tag Word (abridged) */
-       uint8_t         fx_reserved1;
        uint16_t        fx_opcode;      /* FPU Opcode */
        union fp_addr   fx_ip;          /* FPU Instruction Pointer */
 /*16*/ union fp_addr   fx_dp;          /* FPU Data pointer */
diff -r 44b91dc9a39b -r 0106186291ef sys/arch/x86/include/cpufunc.h
--- a/sys/arch/x86/include/cpufunc.h    Thu Feb 13 17:42:24 2014 +0000
+++ b/sys/arch/x86/include/cpufunc.h    Thu Feb 13 19:37:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.h,v 1.16 2014/02/12 23:24:09 dsl Exp $ */
+/*     $NetBSD: cpufunc.h,v 1.17 2014/02/13 19:37:08 dsl Exp $ */
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -76,25 +76,30 @@
 void   x86_hlt(void);
 void   x86_stihlt(void);
 u_int  x86_getss(void);
-void   fldcw(void *);
+
+struct save87;
+struct fxsave;
+void   fldcw(const uint16_t *);
 void   fnclex(void);
 void   fninit(void);
-void   fnsave(void *);
+void   fnsave(struct save87 *);
 void   fnstcw(uint16_t *);
 uint16_t fngetsw(void);
 void   fnstsw(uint16_t *);
-void   fp_divide_by_0(void);
-void   frstor(void *);
+void   frstor(const struct save87 *);
 void   fwait(void);
 void   clts(void);
 void   stts(void);
+void   fxsave(struct fxsave *);
+void   fxrstor(const struct fxsave *);
+void   x86_ldmxcsr(const uint32_t *);
+void   x86_stmxcsr(uint32_t *);
+
 void   fldummy(void);
-void   fxsave(void *);
-void   fxrstor(void *);
+void   fp_divide_by_0(void);
+
 void   x86_monitor(const void *, uint32_t, uint32_t);
 void   x86_mwait(uint32_t, uint32_t);
-void   x86_ldmxcsr(const uint32_t *);
-void   x86_stmxcsr(uint32_t *);
 /* x86_cpuid2() writes four 32bit values, %eax, %ebx, %ecx and %edx */
 #define        x86_cpuid(a,b)  x86_cpuid2((a),0,(b))
 void   x86_cpuid2(uint32_t, uint32_t, uint32_t *);
diff -r 44b91dc9a39b -r 0106186291ef sys/arch/x86/x86/fpu.c
--- a/sys/arch/x86/x86/fpu.c    Thu Feb 13 17:42:24 2014 +0000
+++ b/sys/arch/x86/x86/fpu.c    Thu Feb 13 19:37:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.3 2014/02/12 23:24:09 dsl Exp $      */
+/*     $NetBSD: fpu.c,v 1.4 2014/02/13 19:37:08 dsl Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.3 2014/02/12 23:24:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.4 2014/02/13 19:37:08 dsl Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -458,7 +458,7 @@
                 * but we don't care since we're about to call fxrstor() anyway.
                 */
                fldummy();
-               fxrstor(&pcb->pcb_savefpu);
+               fxrstor(&pcb->pcb_savefpu.sv_xmm);
        } else {
                frstor(&pcb->pcb_savefpu.sv_87);
        }
@@ -489,7 +489,7 @@
        if (save) {
                clts();
                if (i386_use_fxsave) {
-                       fxsave(&pcb->pcb_savefpu);
+                       fxsave(&pcb->pcb_savefpu.sv_xmm);
                } else {
                        fnsave(&pcb->pcb_savefpu.sv_87);
                }



Home | Main Index | Thread Index | Old Index