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 Hide XSAVES-specific stuff and the masked e...



details:   https://anonhg.NetBSD.org/src/rev/3a9398c9c6bd
branches:  trunk
changeset: 461243:3a9398c9c6bd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Nov 20 10:26:56 2019 +0000

description:
Hide XSAVES-specific stuff and the masked extended states.

diffstat:

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

diffs (76 lines):

diff -r 83f9c348d731 -r 3a9398c9c6bd sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Wed Nov 20 09:37:44 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Wed Nov 20 10:26:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.53 2019/10/28 08:30:49 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.54 2019/11/20 10:26:56 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.53 2019/10/28 08:30:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.54 2019/11/20 10:26:56 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -826,7 +826,18 @@
                        cpudata->gprs[NVMM_X64_GPR_RDX] = svm_xcr0_mask >> 32;
                        break;
                case 1:
-                       cpudata->vmcb->state.rax &= ~CPUID_PES1_XSAVES;
+                       cpudata->vmcb->state.rax &=
+                           (CPUID_PES1_XSAVEOPT | CPUID_PES1_XSAVEC |
+                            CPUID_PES1_XGETBV);
+                       cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RDX] = 0;
+                       break;
+               default:
+                       cpudata->vmcb->state.rax = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RDX] = 0;
                        break;
                }
                break;
diff -r 83f9c348d731 -r 3a9398c9c6bd sys/dev/nvmm/x86/nvmm_x86_vmx.c
--- a/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Wed Nov 20 09:37:44 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Wed Nov 20 10:26:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_vmx.c,v 1.44 2019/10/28 08:30:49 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_vmx.c,v 1.45 2019/11/20 10:26:56 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.44 2019/10/28 08:30:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.45 2019/11/20 10:26:56 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1201,7 +1201,18 @@
                        cpudata->gprs[NVMM_X64_GPR_RDX] = vmx_xcr0_mask >> 32;
                        break;
                case 1:
-                       cpudata->gprs[NVMM_X64_GPR_RAX] &= ~CPUID_PES1_XSAVES;
+                       cpudata->gprs[NVMM_X64_GPR_RAX] &=
+                           (CPUID_PES1_XSAVEOPT | CPUID_PES1_XSAVEC |
+                            CPUID_PES1_XGETBV);
+                       cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RDX] = 0;
+                       break;
+               default:
+                       cpudata->gprs[NVMM_X64_GPR_RAX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
+                       cpudata->gprs[NVMM_X64_GPR_RDX] = 0;
                        break;
                }
                break;



Home | Main Index | Thread Index | Old Index