[PATCH 2/3] kvm-unit-test: nSVM: Add helper functions to write and read vmcb fields

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

 



Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>
---
 x86/svm.c | 16 ++++++++++++++++
 x86/svm.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/x86/svm.c b/x86/svm.c
index 7ce33a6..3803032 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -233,6 +233,22 @@ int svm_vmrun(void)
 	return (vmcb->control.exit_code);
 }
 
+u64 vmcb_save_read64(size_t offset)
+{
+	u64 *ptr = (u64 *) ((char *) vmcb + offsetof(struct vmcb, save) +
+	    offset);
+
+       return (*ptr);
+}
+
+void vmcb_save_write64(size_t offset, u64 value)
+{
+	u64 *ptr = (u64 *) ((char *) vmcb + offsetof(struct vmcb, save) +
+	    offset);
+
+       *ptr = value;
+}
+
 static void test_run(struct svm_test *test)
 {
 	u64 vmcb_phys = virt_to_phys(vmcb);
diff --git a/x86/svm.h b/x86/svm.h
index 25514de..3a6af6e 100644
--- a/x86/svm.h
+++ b/x86/svm.h
@@ -380,5 +380,7 @@ struct regs get_regs(void);
 void vmmcall(void);
 int svm_vmrun(void);
 void test_set_guest(test_guest_func func);
+u64 vmcb_save_read64(size_t offset);
+void vmcb_save_write64(size_t offset, u64 value);
 
 #endif
-- 
1.8.3.1




[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