Module Name:    src
Committed By:   mlelstv
Date:           Fri Sep 25 13:56:32 UTC 2009

Modified Files:
        src/sys/arch/amd64/amd64: netbsd32_machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amd64/amd64/netbsd32_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.58 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.59
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.58	Sun Aug 16 17:12:47 2009
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Fri Sep 25 13:56:32 2009
@@ -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;

Reply via email to