Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/nvmm/x86 Switch to fpu_kern_enter/leave, to prevent ...



details:   https://anonhg.NetBSD.org/src/rev/ed1ee2421936
branches:  trunk
changeset: 936095:ed1ee2421936
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jul 19 06:56:09 2020 +0000

description:
Switch to fpu_kern_enter/leave, to prevent clobbering, now that the kernel
itself uses the fpu.

diffstat:

 sys/dev/nvmm/x86/nvmm_x86_svm.c |  7 ++++---
 sys/dev/nvmm/x86/nvmm_x86_vmx.c |  7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (70 lines):

diff -r b892ecd20dd9 -r ed1ee2421936 sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Sun Jul 19 06:36:37 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Sun Jul 19 06:56:09 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.64 2020/07/19 06:36:37 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.65 2020/07/19 06:56:09 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.64 2020/07/19 06:36:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.65 2020/07/19 06:56:09 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1219,7 +1219,7 @@
 {
        struct svm_cpudata *cpudata = vcpu->cpudata;
 
-       fpu_save();
+       fpu_kern_enter();
        fpu_area_restore(&cpudata->gfpu, svm_xcr0_mask);
 
        if (svm_xcr0_mask != 0) {
@@ -1239,6 +1239,7 @@
        }
 
        fpu_area_save(&cpudata->gfpu, svm_xcr0_mask);
+       fpu_kern_leave();
 }
 
 static void
diff -r b892ecd20dd9 -r ed1ee2421936 sys/dev/nvmm/x86/nvmm_x86_vmx.c
--- a/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Sun Jul 19 06:36:37 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Sun Jul 19 06:56:09 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_vmx.c,v 1.64 2020/07/19 06:36:37 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_vmx.c,v 1.65 2020/07/19 06:56:09 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.64 2020/07/19 06:36:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.65 2020/07/19 06:56:09 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1875,7 +1875,7 @@
 {
        struct vmx_cpudata *cpudata = vcpu->cpudata;
 
-       fpu_save();
+       fpu_kern_enter();
        fpu_area_restore(&cpudata->gfpu, vmx_xcr0_mask);
 
        if (vmx_xcr0_mask != 0) {
@@ -1895,6 +1895,7 @@
        }
 
        fpu_area_save(&cpudata->gfpu, vmx_xcr0_mask);
+       fpu_kern_leave();
 }
 
 static void



Home | Main Index | Thread Index | Old Index