From: Cristiano Giuffrida Date: Tue, 16 Mar 2010 10:20:36 +0000 (+0000) Subject: Fixed a bug in interrupt handling code when removing a handler in case of X-Git-Tag: v3.1.7~232 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-dsfromkey.html?a=commitdiff_plain;h=83d1f4557819d8277dab9dc0e44afc70c48125a7;p=minix.git Fixed a bug in interrupt handling code when removing a handler in case of a shared IRQ. --- diff --git a/kernel/system/do_irqctl.c b/kernel/system/do_irqctl.c index 7656e2586..67d414802 100644 --- a/kernel/system/do_irqctl.c +++ b/kernel/system/do_irqctl.c @@ -81,22 +81,32 @@ PUBLIC int do_irqctl(struct proc * caller, message * m_ptr) } } - /* Find a free IRQ hook for this mapping. */ - hook_ptr = NULL; - for (irq_hook_id=0; irq_hook_idIRQ_HOOK_ID; if (notify_id > CHAR_BIT * sizeof(irq_id_t) - 1) return(EINVAL); + /* Try to find an existing mapping to override. */ + hook_ptr = NULL; + for (i=0; !hook_ptr && im_source + && irq_hooks[i].notify_id == notify_id) { + irq_hook_id = i; + hook_ptr = &irq_hooks[irq_hook_id]; /* existing hook */ + rm_irq_handler(&irq_hooks[irq_hook_id]); + } + } + + /* If there is nothing to override, find a free hook for this mapping. */ + for (i=0; !hook_ptr && iproc_nr_e = m_ptr->m_source; /* process to notify */ hook_ptr->notify_id = notify_id; /* identifier to pass */