[kvm-unit-tests PATCH 1/2] Fix vmptrst result type

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

 



vmptrst stores a 64-bit physical address to memory (or -1 if there is
no current VMCS).

Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
---
 x86/vmx.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/x86/vmx.h b/x86/vmx.h
index 392979ba8ae8..a368f31b159d 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -5,6 +5,7 @@
 #include "processor.h"
 #include "bitops.h"
 #include "asm/page.h"
+#include "asm/io.h"
 
 struct vmcs {
 	u32 revision_id; /* vmcs revision identifier */
@@ -646,10 +647,12 @@ static inline int vmcs_write(enum Encoding enc, u64 val)
 static inline int vmcs_save(struct vmcs **vmcs)
 {
 	bool ret;
+	unsigned long pa;
 	u64 rflags = read_rflags() | X86_EFLAGS_CF | X86_EFLAGS_ZF;
 
-	asm volatile ("push %1; popf; vmptrst %2; setbe %0"
-		      : "=q" (ret) : "q" (rflags), "m" (*vmcs) : "cc");
+	asm volatile ("push %2; popf; vmptrst %1; setbe %0"
+		      : "=q" (ret), "=m" (pa) : "r" (rflags) : "cc");
+	*vmcs = (pa == -1ull) ? NULL : phys_to_virt(pa);
 	return ret;
 }
 
-- 
2.13.2.932.g7449e964c-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux