]> xenbits.xensource.com Git - xen.git/commitdiff
Clean up convoluted hvm_inject_exception() logic.
authorKeir Fraser <keir@xen.org>
Fri, 20 Apr 2012 08:33:35 +0000 (09:33 +0100)
committerKeir Fraser <keir@xen.org>
Fri, 20 Apr 2012 08:33:35 +0000 (09:33 +0100)
Signed-off-by: Keir Fraser <keir@xen.org>
xen/arch/x86/hvm/hvm.c

index e353acfb2edfb84db2a76da061b51a337c9dc4d7..42d545ba400e0ab5fe49ff790a9847b2adcc88aa 100644 (file)
@@ -1203,30 +1203,19 @@ void hvm_triple_fault(void)
 
 void hvm_inject_exception(unsigned int trapnr, int errcode, unsigned long cr2)
 {
-    struct vcpu *v = current;
-
-    if ( !nestedhvm_enabled(v->domain) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( nestedhvm_vmswitch_in_progress(v) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( !nestedhvm_vcpu_in_guestmode(v) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
+    struct vcpu *curr = current;
 
-    if ( nhvm_vmcx_guest_intercepts_trap(v, trapnr, errcode) )
+    if ( nestedhvm_enabled(curr->domain) &&
+         !nestedhvm_vmswitch_in_progress(curr) &&
+         nestedhvm_vcpu_in_guestmode(curr) &&
+         nhvm_vmcx_guest_intercepts_trap(curr, trapnr, errcode) )
     {
         enum nestedhvm_vmexits nsret;
 
-        nsret = nhvm_vcpu_vmexit_trap(v, trapnr, errcode, cr2);
+        nsret = nhvm_vcpu_vmexit_trap(curr, trapnr, errcode, cr2);
 
-        switch (nsret) {
+        switch ( nsret )
+        {
         case NESTEDHVM_VMEXIT_DONE:
         case NESTEDHVM_VMEXIT_ERROR: /* L1 guest will crash L2 guest */
             return;