[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 40/48] target/i386: Added DR6 and DR7 consistency checks
From: |
Paolo Bonzini |
Subject: |
[PULL 40/48] target/i386: Added DR6 and DR7 consistency checks |
Date: |
Thu, 8 Jul 2021 17:17:40 +0200 |
From: Lara Lazier <laramglazier@gmail.com>
DR6[63:32] and DR7[63:32] are reserved and need to be zero.
(AMD64 Architecture Programmer's Manual, V2, 15.5)
Signed-off-by: Lara Lazier <laramglazier@gmail.com>
Message-Id: <20210705081802.18960-3-laramglazier@gmail.com>
[Ignore for 32-bit builds. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/svm.h | 2 ++
target/i386/tcg/sysemu/svm_helper.c | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/target/i386/svm.h b/target/i386/svm.h
index adc058dc76..4bde9f3475 100644
--- a/target/i386/svm.h
+++ b/target/i386/svm.h
@@ -140,6 +140,8 @@
#define SVM_MSRPM_SIZE (1ULL << 13)
#define SVM_IOPM_SIZE ((1ULL << 13) + 1)
+#define SVM_DR_RESERVED_MASK 0xffffffff00000000ULL
+
struct QEMU_PACKED vmcb_control_area {
uint16_t intercept_cr_read;
uint16_t intercept_cr_write;
diff --git a/target/i386/tcg/sysemu/svm_helper.c
b/target/i386/tcg/sysemu/svm_helper.c
index fa701829e5..047f31628e 100644
--- a/target/i386/tcg/sysemu/svm_helper.c
+++ b/target/i386/tcg/sysemu/svm_helper.c
@@ -269,7 +269,14 @@ void helper_vmrun(CPUX86State *env, int aflag, int
next_eip_addend)
env->dr[6] = x86_ldq_phys(cs,
env->vm_vmcb + offsetof(struct vmcb, save.dr6));
- /* FIXME: guest state consistency checks */
+#ifdef TARGET_X86_64
+ if (env->dr[6] & SVM_DR_RESERVED_MASK) {
+ cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
+ }
+ if (env->dr[7] & SVM_DR_RESERVED_MASK) {
+ cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
+ }
+#endif
switch (x86_ldub_phys(cs,
env->vm_vmcb + offsetof(struct vmcb, control.tlb_ctl))) {
--
2.31.1
- [PULL 29/48] accel: autoload modules, (continued)
- [PULL 29/48] accel: autoload modules, Paolo Bonzini, 2021/07/08
- [PULL 28/48] modules: hook up modules.h to docs build, Paolo Bonzini, 2021/07/08
- [PULL 30/48] accel: add qtest module annotations, Paolo Bonzini, 2021/07/08
- [PULL 32/48] accel: add tcg module annotations, Paolo Bonzini, 2021/07/08
- [PULL 35/48] usb: drop usb_host_dev_is_scsi_storage hook, Paolo Bonzini, 2021/07/08
- [PULL 37/48] usb: build usb-host as module, Paolo Bonzini, 2021/07/08
- [PULL 34/48] monitor: allow register hmp commands, Paolo Bonzini, 2021/07/08
- [PULL 33/48] accel: build tcg modular, Paolo Bonzini, 2021/07/08
- [PULL 26/48] modules: add module_obj() note to QOM docs, Paolo Bonzini, 2021/07/08
- [PULL 39/48] target/i386: Added MSRPM and IOPM size check, Paolo Bonzini, 2021/07/08
- [PULL 40/48] target/i386: Added DR6 and DR7 consistency checks,
Paolo Bonzini <=
- [PULL 36/48] monitor/usb: register 'info usbhost' dynamically, Paolo Bonzini, 2021/07/08
- [PULL 38/48] monitor/tcg: move tcg hmp commands to accel/tcg, register them dynamically, Paolo Bonzini, 2021/07/08
- [PULL 45/48] hw/arm: add dependency on OR_IRQ for XLNX_VERSAL, Paolo Bonzini, 2021/07/08
- [PULL 48/48] configure: allow the selection of alternate config in the build, Paolo Bonzini, 2021/07/08
- [PULL 31/48] accel: build qtest modular, Paolo Bonzini, 2021/07/08
- [PULL 41/48] target/i386: fix exceptions for MOV to DR, Paolo Bonzini, 2021/07/08
- [PULL 43/48] meson: switch function tests from compilation to linking, Paolo Bonzini, 2021/07/08
- [PULL 44/48] meson: Introduce target-specific Kconfig, Paolo Bonzini, 2021/07/08