Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/amd64 Ensure FP state is reset, if FP is used...



details:   https://anonhg.NetBSD.org/src/rev/7cb6cb681a9c
branches:  trunk
changeset: 747632:7cb6cb681a9c
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Sep 25 13:56:32 2009 +0000

description:
Ensure FP state is reset, if FP is used in a signal handler.
Fixes PR kern/39299 for 32bit code.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r a333edeb55ec -r 7cb6cb681a9c sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Fri Sep 25 13:51:27 2009 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Fri Sep 25 13:56:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.58 2009/08/16 17:12:47 pgoyette Exp $   */
+/*     $NetBSD: netbsd32_machdep.c,v 1.59 2009/09/25 13:56:32 mlelstv Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.58 2009/08/16 17:12:47 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.59 2009/09/25 13:56:32 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -269,6 +269,9 @@
        tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL);
        tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL);
 
+       /* Ensure FP state is reset, if FP is used. */
+       l->l_md.md_flags &= ~MDP_USEDFPU;
+
        tf->tf_rip = (uint64_t)catcher;
        tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL);
        tf->tf_rflags &= ~PSL_CLEARSIG;
@@ -360,6 +363,9 @@
        tf->tf_rsp = (uint64_t)fp;
        tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL);
 
+       /* Ensure FP state is reset, if FP is used. */
+       l->l_md.md_flags &= ~MDP_USEDFPU;
+
        /* Remember that we're now on the signal stack. */
        if (onstack)
                l->l_sigstk.ss_flags |= SS_ONSTACK;



Home | Main Index | Thread Index | Old Index