]> xenbits.xensource.com Git - xen.git/commitdiff
mini-os: use irqs_disabled() helper in schedule
authorThomas Leonard <talex5@gmail.com>
Thu, 26 Jun 2014 11:28:33 +0000 (12:28 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 27 Jun 2014 13:13:21 +0000 (14:13 +0100)
Testing whether the result of local_irq_save is zero doesn't work on
ARM.

Suggested by Julien Grall.
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
extras/mini-os/sched.c

index 99d87b609fdce10a886101cb0fe33d2ee39beb9c..d0c607e84319a12b55efa5019c107c93d3e31969 100644 (file)
@@ -78,6 +78,11 @@ void schedule(void)
     struct thread *prev, *next, *thread, *tmp;
     unsigned long flags;
 
+    if (irqs_disabled()) {
+        printk("Must not call schedule() with IRQs disabled\n");
+        BUG();
+    }
+
     prev = current;
     local_irq_save(flags); 
 
@@ -86,11 +91,6 @@ void schedule(void)
         BUG();
     }
 
-    if (flags) {
-        printk("Must not call schedule() with IRQs disabled\n");
-        BUG();
-    }
-
     do {
         /* Examine all threads.
            Find a runnable thread, but also wake up expired ones and find the