Merge branch 'arrakis'
[barrelfish] / kernel / dispatch.c
index c7950d4..bcdfabc 100644 (file)
@@ -234,37 +234,38 @@ void __attribute__ ((noreturn)) dispatch(struct dcb *dcb)
     arch_registers_state_t *disabled_area =
         dispatcher_get_disabled_save_area(handle);
 
-    assert(disp != NULL);
-    disp->systime = kernel_now + kcb_current->kernel_off;
-       TRACE(KERNEL, SC_YIELD, 1);
+    if(disp != NULL) {
+        disp->systime = kernel_now + kcb_current->kernel_off;
+    }
+    TRACE(KERNEL, SC_YIELD, 1);
        
     if (dcb->disabled) {
-        debug(SUBSYS_DISPATCH, "resume %.*s at 0x%" PRIx64 "\n", DISP_NAME_LEN,
-              disp->name, (uint64_t)registers_get_ip(disabled_area));
-        assert(dispatcher_is_disabled_ip(handle,
-                                         registers_get_ip(disabled_area)));
+        if (disp != NULL) {
+            debug(SUBSYS_DISPATCH, "resume %.*s at 0x%" PRIx64 "\n", DISP_NAME_LEN,
+                  disp->name, (uint64_t)registers_get_ip(disabled_area));
+            assert(dispatcher_is_disabled_ip(handle,
+                                             registers_get_ip(disabled_area)));
+        }
 
-#if defined(__x86_64__) && !defined(__k1om__)
         if(!dcb->is_vm_guest) {
             resume(disabled_area);
+#if defined(__x86_64__) && !defined(__k1om__)
         } else {
             vmkit_vmenter(dcb);
-        }
-#else
-        resume(disabled_area);
 #endif
+        }
     } else {
-        debug(SUBSYS_DISPATCH, "dispatch %.*s\n", DISP_NAME_LEN, disp->name);
-        assert(disp->dispatcher_run != 0);
-        disp->disabled = 1;
-#if defined(__x86_64__) && !defined(__k1om__)
+        if (disp != NULL) {
+            debug(SUBSYS_DISPATCH, "dispatch %.*s\n", DISP_NAME_LEN, disp->name);
+            assert(disp->dispatcher_run != 0);
+            disp->disabled = 1;
+        }
         if(!dcb->is_vm_guest) {
             execute(disp->dispatcher_run);
+#if defined(__x86_64__) && !defined(__k1om__)
         } else {
-            vmkit_vmexec(dcb, disp->dispatcher_run);
+            vmkit_vmexec(dcb, (disp) ? disp->dispatcher_run : 0);
         }
-#else
-        execute(disp->dispatcher_run);
 #endif
     }
 } // end function: dispatch