# HG changeset patch
# User Jerone Young <[EMAIL PROTECTED]>
# Date 1194887893 21600
# Node ID 41925cedf395c050fb31083eeda8a08bad609169
# Parent a40de75e2bf823c092a20009c7646bf4c026a260
Make kvm_run more arch friendly
This patch creates hook kvm_arch_run in kvm_run function. This
is to handle cases that are architecture specific on a run exit.
Currently there is only one case that is handled that is obvious.
Others have at least some similarity on all archs.
Though really these return codes will need to be worked out in the
kernel kvm module. But here is a start.
Signed-off-by: Jerone Young <[EMAIL PROTECTED]>
diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h
--- a/libkvm/kvm-common.h
+++ b/libkvm/kvm-common.h
@@ -71,6 +71,8 @@ int kvm_arch_create_default_phys_mem(kvm
int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
unsigned long phys_mem_bytes,
void **vm_mem);
+int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu);
+
void kvm_show_code(kvm_context_t kvm, int vcpu);
int kvm_run_abi10(kvm_context_t kvm, int vcpu);
diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -156,6 +156,23 @@ int kvm_arch_create(kvm_context_t kvm, u
return r;
return 0;
+}
+
+int kvm_arch_run(struct kvm_run *run,kvm_context_t kvm, int vcpu)
+{
+ int r = 0;
+
+ switch (run->exit_reason) {
+#ifdef KVM_EXIT_SET_TPR
+ case KVM_EXIT_SET_TPR:
+ break;
+#endif
+ default:
+ r = 1;
+ break;
+ }
+
+ return r;
}
void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -954,14 +954,13 @@ again:
case KVM_EXIT_SHUTDOWN:
r = handle_shutdown(kvm, vcpu);
break;
-#ifdef KVM_EXIT_SET_TPR
- case KVM_EXIT_SET_TPR:
- break;
-#endif
default:
- fprintf(stderr, "unhandled vm exit: 0x%x\n",
run->exit_reason);
- kvm_show_regs(kvm, vcpu);
- abort();
+ if (kvm_arch_run(run, kvm, vcpu)) {
+ fprintf(stderr, "unhandled vm exit: 0x%x\n",
+ run->exit_reason);
+ kvm_show_regs(kvm, vcpu);
+ abort();
+ }
break;
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel