Hi Avi,
   Attached is a small patch to let user land know where the guest was
at last vmexit. I am using this to debug the big real mode guests. I
think this will be useful to more people.

Author: Nitin A Kamble <[EMAIL PROTECTED]>

Thanks & Regards,
Nitin 
Open Source Technology Center, Intel Corporation.
-------------------------------------------------------------------------
The mind is like a parachute; it works much better when it's open. 
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index e35434b..9950a7e 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -255,6 +255,8 @@ struct kvm_stat {
 	u32 irq_exits;
 	u32 light_exits;
 	u32 efer_reload;
+	u32 last_exit_cs_base;
+	u64 last_exit_eip;
 };
 
 struct kvm_vcpu {
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index fef5d13..e83fa97 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -73,6 +73,8 @@ static struct kvm_stats_debugfs_item {
 	{ "irq_exits", STAT_OFFSET(irq_exits) },
 	{ "light_exits", STAT_OFFSET(light_exits) },
 	{ "efer_reload", STAT_OFFSET(efer_reload) },
+	{ "last_exit_cs_base", STAT_OFFSET(last_exit_cs_base) },
+	{ "last_exit_eip", STAT_OFFSET(last_exit_eip) },
 	{ NULL }
 };
 
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index bfd5f8e..805514f 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1941,6 +1941,8 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 {
 	u32 vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
 	u32 exit_reason = vmcs_read32(VM_EXIT_REASON);
+	vcpu->stat.last_exit_cs_base = vmcs_read32(GUEST_CS_BASE);
+	vcpu->stat.last_exit_eip = vmcs_read64(GUEST_RIP);
 
 	if ( (vectoring_info & VECTORING_INFO_VALID_MASK) &&
 				exit_reason != EXIT_REASON_EXCEPTION_NMI )

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to