[MINI-OS] Fix for event initialisation in Mini-OS. All events are masked when
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 15 Jun 2006 12:20:43 +0000 (13:20 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 15 Jun 2006 12:20:43 +0000 (13:20 +0100)
the system is started up. This prevents from getting spurious events
between hypercall to bind an event-channel and registering
appropriate event handler.
Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
extras/mini-os/events.c

index e45a1364fecebe19f42dbc3d9fcbf221a3df36ea..2aa5349b37df92cbe6e4beb1a53fd539892cb564 100644 (file)
@@ -35,24 +35,29 @@ int do_event(u32 port, struct pt_regs *regs)
     ev_action_t  *action;
     if (port >= NR_EVS) {
         printk("Port number too large: %d\n", port);
-        return 0;
+        goto out;
     }
 
     action = &ev_actions[port];
     action->count++;
 
     if (!action->handler)
+    {
+        printk("Spurious event on port %d\n", port);
         goto out;
+    }
     
     if (action->status & EVS_DISABLED)
+    {
+        printk("Event on port %d disabled\n", port);
         goto out;
+    }
     
     /* call the handler */
     action->handler(port, regs);
-
-       clear_evtchn(port);
     
  out:
+       clear_evtchn(port);
     return 1;
 
 }
@@ -135,6 +140,7 @@ void init_events(void)
     {
         ev_actions[i].status  = EVS_DISABLED;
         ev_actions[i].handler = default_handler;
+        mask_evtchn(i);
     }
 }