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 Ah, take XSAVE into account in ECX too, not...



details:   https://anonhg.NetBSD.org/src/rev/eb65962066ca
branches:  trunk
changeset: 840834:eb65962066ca
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Apr 20 08:45:30 2019 +0000

description:
Ah, take XSAVE into account in ECX too, not just in EBX. Otherwise if the
guest relies only on ECX to initialize/copy the FPU state (like NetBSD
does), spurious #GPs can be encountered because the bitmap is clobbered.

diffstat:

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

diffs (54 lines):

diff -r 529b2222e2ec -r eb65962066ca sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Sat Apr 20 08:44:10 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Sat Apr 20 08:45:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.38 2019/04/07 14:28:50 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.39 2019/04/20 08:45:30 maxv Exp $   */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.38 2019/04/07 14:28:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.39 2019/04/20 08:45:30 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -806,7 +806,7 @@
                                cpudata->gprs[NVMM_X64_GPR_RBX] = sizeof(struct save87);
                        }
                        cpudata->gprs[NVMM_X64_GPR_RBX] += 64; /* XSAVE header */
-                       cpudata->gprs[NVMM_X64_GPR_RCX] = sizeof(struct fxsave);
+                       cpudata->gprs[NVMM_X64_GPR_RCX] = sizeof(struct fxsave) + 64;
                        cpudata->gprs[NVMM_X64_GPR_RDX] = svm_xcr0_mask >> 32;
                        break;
                case 1:
diff -r 529b2222e2ec -r eb65962066ca sys/dev/nvmm/x86/nvmm_x86_vmx.c
--- a/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Sat Apr 20 08:44:10 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Sat Apr 20 08:45:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_vmx.c,v 1.25 2019/04/07 14:28:50 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_vmx.c,v 1.26 2019/04/20 08:45:30 maxv Exp $   */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.25 2019/04/07 14:28:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.26 2019/04/20 08:45:30 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1122,7 +1122,7 @@
                                cpudata->gprs[NVMM_X64_GPR_RBX] = sizeof(struct save87);
                        }
                        cpudata->gprs[NVMM_X64_GPR_RBX] += 64; /* XSAVE header */
-                       cpudata->gprs[NVMM_X64_GPR_RCX] = sizeof(struct fxsave);
+                       cpudata->gprs[NVMM_X64_GPR_RCX] = sizeof(struct fxsave) + 64;
                        cpudata->gprs[NVMM_X64_GPR_RDX] = vmx_xcr0_mask >> 32;
                        break;
                case 1:



Home | Main Index | Thread Index | Old Index