Checks for non-VCPD mboxs and INDIRs
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 15 Aug 2011 22:24:44 +0000 (15:24 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:36:06 +0000 (17:36 -0700)
Seems the easiest place to check for INDIRs to VCPD mboxes.  It won't
catch all of them btw, but it's userspace's responsibility to not screw
this up too bad.

kern/src/event.c

index e2c1b2b..148481e 100644 (file)
@@ -219,6 +219,10 @@ void send_event(struct proc *p, struct event_queue *ev_q, struct event_msg *msg,
         * vehicle for sending the ev_type. */
        assert(msg);
        post_ev_msg(ev_mbox, msg, ev_q->ev_flags);
+       /* Help out userspace a bit by checking for a potentially confusing bug */
+       if ((ev_mbox == get_proc_ev_mbox(vcoreid)) &&
+           (ev_q->ev_flags & EVENT_INDIR))
+               printk("[kernel] User-bug: ev_q has an INDIR with a VCPD ev_mbox!\n");
        /* Prod/alert a vcore with an IPI or INDIR, if desired */
        if ((ev_q->ev_flags & (EVENT_IPI | EVENT_INDIR)))
                alert_vcore(p, ev_q, vcoreid);