Index: kernel/arch/sparc64/src/trap/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/interrupt.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/arch/sparc64/src/trap/interrupt.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -40,5 +40,4 @@
 #include <arch/types.h>
 #include <debug.h>
-#include <ipc/sysipc.h>
 #include <arch/asm.h>
 #include <arch/barrier.h>
@@ -48,10 +47,4 @@
 #include <config.h>
 #include <synch/spinlock.h>
-
-/*
- * To be removed once we get rid of the dependency in ipc_irq_bind_arch().
- */
-#include <arch/drivers/kbd.h>
-#include <genarch/kbd/z8530.h>
 
 /** Register Interrupt Level Handler.
@@ -66,13 +59,4 @@
 	
 	exc_register(n - 1, name, f);
-}
-
-/* Reregister irq to be IPC-ready */
-void irq_ipc_bind_arch(unative_t irq)
-{
-#ifdef CONFIG_Z8530
-	if (kbd_type == KBD_Z8530)
-		z8530_belongs_to_kernel = false;
-#endif
 }
 
Index: kernel/genarch/src/kbd/z8530.c
===================================================================
--- kernel/genarch/src/kbd/z8530.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/genarch/src/kbd/z8530.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -41,4 +41,5 @@
 #include <arch/drivers/z8530.h>
 #include <ddi/irq.h>
+#include <ipc/irq.h>
 #include <arch/interrupt.h>
 #include <arch/drivers/kbd.h>
@@ -59,6 +60,4 @@
 #define IGNORE_CODE	0x7f		/* all keys up */
 
-bool z8530_belongs_to_kernel = true;
-
 static z8530_t z8530;		/**< z8530 device structure. */
 static irq_t z8530_irq;		/**< z8530's IRQ. */ 
@@ -73,16 +72,12 @@
 };
 
-void z8530_wait(void);
-
-/** Initialize keyboard and service interrupts using kernel routine */
+/** Initialize keyboard and service interrupts using kernel routine. */
 void z8530_grab(void)
 {
-	z8530_belongs_to_kernel = true;
-}
-
-/** Resume the former interrupt vector */
+}
+
+/** Resume the former IPC notification behavior. */
 void z8530_release(void)
 {
-	z8530_belongs_to_kernel = false;
 }
 
@@ -132,8 +127,4 @@
 {
 	z8530_poll();
-}
-
-/** Wait until the controller reads its data. */
-void z8530_wait(void) {
 }
 
@@ -195,13 +186,13 @@
 	/*
 	 * So far, we know we got this interrupt through the FHC.
-	 * Since we don't have enough information about the FHC and
-	 * because the interrupt looks like level sensitive,
+	 * Since we don't have enough documentation about the FHC
+	 * and because the interrupt looks like level sensitive,
 	 * we cannot handle it by scheduling one of the level
 	 * interrupt traps. Process the interrupt directly.
 	 */
-	if (z8530_belongs_to_kernel)
+	if (irq->notif_cfg.answerbox)
+		ipc_irq_send_notif(irq);
+	else
 		z8530_interrupt();
-	else
-		ipc_irq_send_notif(0);
 	fhc_clear_interrupt(central_fhc, irq->inr);
 }
Index: kernel/generic/include/ddi/irq.h
===================================================================
--- kernel/generic/include/ddi/irq.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ddi/irq.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -37,8 +37,7 @@
 
 #include <arch/types.h>
+#include <typedefs.h>
 #include <adt/list.h>
-#include <ipc/ipc.h>
 #include <ipc/irq.h>
-#include <atomic.h>
 #include <synch/spinlock.h>
 
@@ -52,6 +51,4 @@
 	IRQ_TRIGGER_EDGE
 } irq_trigger_t;
-
-typedef struct irq irq_t;
 
 typedef void (* irq_handler_t)(irq_t *irq, void *arg, ...);
@@ -88,13 +85,6 @@
 	void *arg;
 
-	/** Answerbox of the task that wanted to be notified. */
-	answerbox_t *notif_answerbox;
-	/** Pseudo-code to be performed by the top-half
-	 *  before a notification is sent. */
-	irq_code_t *code;
-	/** Method of the notification. */
-	unative_t method;
-	/** Counter of IRQ notifications. */
-	atomic_t counter;
+	/** Notification configuration structure. */
+	ipc_notif_cfg_t notif_cfg; 
 };
 
Index: kernel/generic/include/ipc/ipc.h
===================================================================
--- kernel/generic/include/ipc/ipc.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ipc/ipc.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -156,6 +156,5 @@
 #ifdef KERNEL
 
-#include <synch/mutex.h>
-#include <synch/condvar.h>
+#include <synch/waitq.h>
 #include <adt/list.h>
 
Index: kernel/generic/include/ipc/irq.h
===================================================================
--- kernel/generic/include/ipc/irq.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ipc/irq.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -39,9 +39,6 @@
 #define IRQ_MAX_PROG_SIZE 10
 
-/** Reserved 'virtual' messages for kernel notifications */
-#define IPC_IRQ_RESERVED_VIRTUAL 10
-
-#define IPC_IRQ_KLOG       (-1)
-#define IPC_IRQ_KBDRESTART (-2)
+#define VIRT_INR_KLOG		-2
+#define VIRT_INR_KBDRESTART	-3
 
 typedef enum {
@@ -76,11 +73,24 @@
 
 #include <ipc/ipc.h>
+#include <typedefs.h>
+#include <arch/types.h>
 
-extern void ipc_irq_make_table(int irqcount);
-extern int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode);
-extern void ipc_irq_send_notif(int irq);
-extern void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3);
-extern void ipc_irq_unregister(answerbox_t *box, int irq);
-extern void irq_ipc_bind_arch(unative_t irq);
+/** IPC notification config structure.
+ *
+ * Primarily, this structure is encapsulated in the irq_t structure.
+ * It is protected by irq_t::lock.
+ */
+struct ipc_notif_cfg {
+	answerbox_t *answerbox;		/**< Answerbox for notifications. */
+	unative_t method;		/**< Method to be used for the notification. */
+	irq_code_t *code;		/**< Top-half pseudocode. */
+	count_t counter;		/**< Counter. */
+};
+
+extern int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method,
+	irq_code_t *ucode);
+extern void ipc_irq_send_notif(irq_t *irq);
+extern void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3);
+extern void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno);
 extern void ipc_irq_cleanup(answerbox_t *box);
 
Index: kernel/generic/include/ipc/sysipc.h
===================================================================
--- kernel/generic/include/ipc/sysipc.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ipc/sysipc.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -39,4 +39,5 @@
 #include <ipc/irq.h>
 #include <arch/types.h>
+#include <typedefs.h>
 
 unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, 
@@ -54,6 +55,6 @@
 			      unative_t method, unative_t arg1);
 unative_t sys_ipc_hangup(int phoneid);
-unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode);
-unative_t sys_ipc_unregister_irq(int irq);
+unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode);
+unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
 
 #endif
Index: kernel/generic/include/typedefs.h
===================================================================
--- kernel/generic/include/typedefs.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/typedefs.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -98,4 +98,6 @@
 typedef signed int inr_t;
 typedef signed int devno_t;
+typedef struct irq irq_t;
+typedef struct ipc_notif_cfg ipc_notif_cfg_t;
 
 #endif
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/src/console/cmd.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -803,5 +803,6 @@
 	printf("Use userspace controls to redraw the screen.\n");
 	arch_release_console();
-	ipc_irq_send_msg(IPC_IRQ_KBDRESTART, 0, 0, 0);
+	/* TODO: send some vitual IRQ */
+	ipc_irq_send_msg(NULL, 0, 0, 0);
 	return 1;
 }
Index: kernel/generic/src/console/klog.c
===================================================================
--- kernel/generic/src/console/klog.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/src/console/klog.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -37,8 +37,10 @@
 #include <console/klog.h>
 #include <print.h>
+#include <ddi/device.h>
+#include <ddi/irq.h>
 #include <ipc/irq.h>
 
 /* Order of frame to be allocated for klog communication */
-#define KLOG_ORDER 0
+#define KLOG_ORDER	0
 
 static char *klog;
@@ -47,4 +49,8 @@
 
 SPINLOCK_INITIALIZE(klog_lock);
+
+static irq_t klog_irq;
+
+static irq_ownership_t klog_claim(void);
 
 /** Initialize kernel logging facility
@@ -64,9 +70,30 @@
 	klog = (char *)PA2KA(faddr);
 	
+	devno_t devno = device_assign_devno();
+	
 	sysinfo_set_item_val("klog.faddr", NULL, (unative_t)faddr);
 	sysinfo_set_item_val("klog.pages", NULL, 1 << KLOG_ORDER);
+	sysinfo_set_item_val("klog.devno", NULL, devno);
+	sysinfo_set_item_val("klog.inr", NULL, VIRT_INR_KLOG); 
+
+	irq_initialize(&klog_irq);
+	klog_irq.devno = devno;
+	klog_irq.inr = VIRT_INR_KLOG;
+	klog_irq.claim = klog_claim;
+	irq_register(&klog_irq);
 
 	klogsize = PAGE_SIZE << KLOG_ORDER;
 	klogpos = 0;
+}
+
+/** Allways refuse IRQ ownership.
+ *
+ * This is not a real IRQ, so we always decline.
+ *
+ * @return Always returns IRQ_DECLINE.
+ */
+irq_ownership_t klog_claim(void)
+{
+	return IRQ_DECLINE;
 }
 
@@ -85,5 +112,5 @@
 			goto out;
 	}
-	ipc_irq_send_msg(IPC_IRQ_KLOG, klogpos, ret, 0);
+	ipc_irq_send_msg(&klog_irq, klogpos, ret, 0);
 	klogpos += ret;
 	if (klogpos >= klogsize)
Index: kernel/generic/src/ddi/irq.c
===================================================================
--- kernel/generic/src/ddi/irq.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/src/ddi/irq.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -72,5 +72,4 @@
 #include <typedefs.h>
 #include <synch/spinlock.h>
-#include <atomic.h>
 #include <arch.h>
 
@@ -147,8 +146,8 @@
 	irq->handler = NULL;
 	irq->arg = NULL;
-	irq->notif_answerbox = NULL;
-	irq->code = NULL;
-	irq->method = 0;
-	atomic_set(&irq->counter, 0);
+	irq->notif_cfg.answerbox = NULL;
+	irq->notif_cfg.code = NULL;
+	irq->notif_cfg.method = 0;
+	irq->notif_cfg.counter = 0;
 }
 
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/src/ipc/ipc.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -441,12 +441,8 @@
 
 
-/** Initilize ipc subsystem */
+/** Initilize IPC subsystem */
 void ipc_init(void)
 {
-	ipc_call_slab = slab_cache_create("ipc_call",
-					  sizeof(call_t),
-					  0,
-					  NULL, NULL, 0);
-	ipc_irq_make_table(IRQ_COUNT);
+	ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL, NULL, 0);
 }
 
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/src/ipc/irq.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -1,4 +1,5 @@
 /*
  * Copyright (C) 2006 Ondrej Palkovsky
+ * Copyright (C) 2006 Jakub Jermar
  * All rights reserved.
  *
@@ -40,8 +41,8 @@
  *
  * The structure of a notification message is as follows:
- * - METHOD: interrupt number
+ * - METHOD: method as registered by the SYS_IPC_REGISTER_IRQ syscall
  * - ARG1: payload modified by a 'top-half' handler
- * - ARG2: payload
- * - ARG3: payload
+ * - ARG2: payload modified by a 'top-half' handler
+ * - ARG3: payload modified by a 'top-half' handler
  * - in_phone_hash: interrupt counter (may be needed to assure correct order
  *         in multithreaded drivers)
@@ -51,24 +52,16 @@
 #include <mm/slab.h>
 #include <errno.h>
+#include <ddi/irq.h>
 #include <ipc/ipc.h>
 #include <ipc/irq.h>
-#include <atomic.h>
 #include <syscall/copy.h>
 #include <console/console.h>
 #include <print.h>
 
-typedef struct {
-	SPINLOCK_DECLARE(lock);
-	answerbox_t *box;
-	irq_code_t *code;
-	atomic_t counter;
-} ipc_irq_t;
-
-
-static ipc_irq_t *irq_conns = NULL;
-static int irq_conns_size;
-
-
-/* Execute code associated with IRQ notification */
+/** Execute code associated with IRQ notification.
+ *
+ * @param call Notification call.
+ * @param code Top-half pseudocode.
+ */
 static void code_execute(call_t *call, irq_code_t *code)
 {
@@ -169,30 +162,46 @@
 }
 
-/** Unregister task from irq */
-void ipc_irq_unregister(answerbox_t *box, int irq)
+/** Unregister task from IRQ notification.
+ *
+ * @param box Answerbox associated with the notification.
+ * @param inr IRQ numbe.
+ * @param devno Device number.
+ */
+void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno)
 {
 	ipl_t ipl;
-	int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
+	irq_t *irq;
 
 	ipl = interrupts_disable();
-	spinlock_lock(&irq_conns[mq].lock);
-	if (irq_conns[mq].box == box) {
-		irq_conns[mq].box = NULL;
-		code_free(irq_conns[mq].code);
-		irq_conns[mq].code = NULL;
-	}
-
-	spinlock_unlock(&irq_conns[mq].lock);
+	irq = irq_find_and_lock(inr, devno);
+	if (irq) {
+		if (irq->notif_cfg.answerbox == box) {
+			code_free(irq->notif_cfg.code);
+			irq->notif_cfg.code = NULL;
+			irq->notif_cfg.answerbox = NULL;
+			irq->notif_cfg.method = 0;
+			irq->notif_cfg.counter = 0;
+			spinlock_unlock(&irq->lock);
+		}
+	}
 	interrupts_restore(ipl);
 }
 
-/** Register an answerbox as a receiving end of interrupts notifications */
-int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode)
+/** Register an answerbox as a receiving end for IRQ notifications.
+ *
+ * @param box Receiving answerbox.
+ * @param inr IRQ number.
+ * @param devno Device number.
+ * @param method Method to be associated with the notification.
+ * @param ucode Uspace pointer to top-half pseudocode.
+ *
+ * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
+ */
+int
+ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
 {
 	ipl_t ipl;
 	irq_code_t *code;
-	int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
-
-	ASSERT(irq_conns);
+	irq_t *irq;
 
 	if (ucode) {
@@ -204,16 +213,23 @@
 
 	ipl = interrupts_disable();
-	spinlock_lock(&irq_conns[mq].lock);
-
-	if (irq_conns[mq].box) {
-		spinlock_unlock(&irq_conns[mq].lock);
+	irq = irq_find_and_lock(inr, devno);
+	if (!irq) {
+		interrupts_restore(ipl);
+		code_free(code);
+		return ENOENT;
+	}
+	
+	if (irq->notif_cfg.answerbox) {
+		spinlock_unlock(&irq->lock);
 		interrupts_restore(ipl);
 		code_free(code);
 		return EEXISTS;
 	}
-	irq_conns[mq].box = box;
-	irq_conns[mq].code = code;
-	atomic_set(&irq_conns[mq].counter, 0);
-	spinlock_unlock(&irq_conns[mq].lock);
+	
+	irq->notif_cfg.answerbox = box;
+	irq->notif_cfg.method = method;
+	irq->notif_cfg.code = code;
+	irq->notif_cfg.counter = 0;
+	spinlock_unlock(&irq->lock);
 	interrupts_restore(ipl);
 
@@ -221,14 +237,16 @@
 }
 
-/** Add call to proper answerbox queue
- *
- * Assume irq_conns[mq].lock is locked */
-static void send_call(int mq, call_t *call)
-{
-	spinlock_lock(&irq_conns[mq].box->irq_lock);
-	list_append(&call->link, &irq_conns[mq].box->irq_notifs);
-	spinlock_unlock(&irq_conns[mq].box->irq_lock);
+/** Add call to proper answerbox queue.
+ *
+ * Assume irq->lock is locked.
+ *
+ */
+static void send_call(irq_t *irq, call_t *call)
+{
+	spinlock_lock(&irq->notif_cfg.answerbox->irq_lock);
+	list_append(&call->link, &irq->notif_cfg.answerbox->irq_notifs);
+	spinlock_unlock(&irq->notif_cfg.answerbox->irq_lock);
 		
-	waitq_wakeup(&irq_conns[mq].box->wq, 0);
+	waitq_wakeup(&irq->notif_cfg.answerbox->wq, WAKEUP_FIRST);
 }
 
@@ -236,101 +254,64 @@
  *
  */
-void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3)
+void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3)
 {
 	call_t *call;
-	int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
-
-	spinlock_lock(&irq_conns[mq].lock);
-
-	if (irq_conns[mq].box) {
+
+	spinlock_lock(&irq->lock);
+
+	if (irq->notif_cfg.answerbox) {
 		call = ipc_call_alloc(FRAME_ATOMIC);
 		if (!call) {
-			spinlock_unlock(&irq_conns[mq].lock);
+			spinlock_unlock(&irq->lock);
 			return;
 		}
 		call->flags |= IPC_CALL_NOTIF;
-		IPC_SET_METHOD(call->data, irq);
+		IPC_SET_METHOD(call->data, irq->notif_cfg.method);
 		IPC_SET_ARG1(call->data, a1);
 		IPC_SET_ARG2(call->data, a2);
 		IPC_SET_ARG3(call->data, a3);
 		/* Put a counter to the message */
-		call->private = atomic_preinc(&irq_conns[mq].counter);
+		call->private = ++irq->notif_cfg.counter;
 		
-		send_call(mq, call);
-	}
-	spinlock_unlock(&irq_conns[mq].lock);
+		send_call(irq, call);
+	}
+	spinlock_unlock(&irq->lock);
 }
 
 /** Notify task that an irq had occurred.
  *
- * We expect interrupts to be disabled
- */
-void ipc_irq_send_notif(int irq)
+ * We expect interrupts to be disabled and the irq->lock already held.
+ */
+void ipc_irq_send_notif(irq_t *irq)
 {
 	call_t *call;
-	int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
-
-	ASSERT(irq_conns);
-	spinlock_lock(&irq_conns[mq].lock);
-
-	if (irq_conns[mq].box) {
+
+	ASSERT(irq);
+
+	if (irq->notif_cfg.answerbox) {
 		call = ipc_call_alloc(FRAME_ATOMIC);
 		if (!call) {
-			spinlock_unlock(&irq_conns[mq].lock);
 			return;
 		}
 		call->flags |= IPC_CALL_NOTIF;
 		/* Put a counter to the message */
-		call->private = atomic_preinc(&irq_conns[mq].counter);
+		call->private = ++irq->notif_cfg.counter;
 		/* Set up args */
-		IPC_SET_METHOD(call->data, irq);
+		IPC_SET_METHOD(call->data, irq->notif_cfg.method);
 
 		/* Execute code to handle irq */
-		code_execute(call, irq_conns[mq].code);
+		code_execute(call, irq->notif_cfg.code);
 		
-		send_call(mq, call);
-	}
-		
-	spinlock_unlock(&irq_conns[mq].lock);
-}
-
-
-/** Initialize table of interrupt handlers
- *
- * @param irqcount Count of required hardware IRQs to be supported
- */
-void ipc_irq_make_table(int irqcount)
-{
-	int i;
-
-	irqcount +=  IPC_IRQ_RESERVED_VIRTUAL;
-
-	irq_conns_size = irqcount;
-	irq_conns = malloc(irqcount * (sizeof(*irq_conns)), 0);
-	for (i=0; i < irqcount; i++) {
-		spinlock_initialize(&irq_conns[i].lock, "irq_ipc_lock");
-		irq_conns[i].box = NULL;
-		irq_conns[i].code = NULL;
-	}
-}
-
-/** Disconnect all irq's notifications
- *
- * @todo It may be better to do some linked list, so that
- *       we wouldn't need to go through whole array every cleanup
+		send_call(irq, call);
+	}
+}
+
+/** Disconnect all IRQ notifications from an answerbox.
+ *
+ * @param box Answerbox for which we want to carry out the cleanup.
  */
 void ipc_irq_cleanup(answerbox_t *box)
 {
-	int i;
-	ipl_t ipl;
-	
-	for (i=0; i < irq_conns_size; i++) {
-		ipl = interrupts_disable();
-		spinlock_lock(&irq_conns[i].lock);
-		if (irq_conns[i].box == box)
-			irq_conns[i].box = NULL;
-		spinlock_unlock(&irq_conns[i].lock);
-		interrupts_restore(ipl);
-	}
+	/* TODO */
 }
 
Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/src/ipc/sysipc.c	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -566,28 +566,32 @@
 }
 
-/** Connect irq handler to task */
-unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode)
+/** Connect irq handler to task.
+ *
+ * @param inr IRQ number.
+ * @param devno Device number.
+ * @param method Method to be associated with the notification.
+ * @param ucode Uspace pointer to the top-half pseudocode.
+ *
+ * @return EPERM or a return code returned by ipc_irq_register().
+ */
+unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
 {
 	if (!(cap_get(TASK) & CAP_IRQ_REG))
 		return EPERM;
 
-	if (irq >= IRQ_COUNT || irq <= -IPC_IRQ_RESERVED_VIRTUAL)
-		return (unative_t) ELIMIT;
-	
-	irq_ipc_bind_arch(irq);
-
-	return ipc_irq_register(&TASK->answerbox, irq, ucode);
-}
-
-/* Disconnect irq handler from task */
-unative_t sys_ipc_unregister_irq(int irq)
+	return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
+}
+
+/** Disconnect irq handler from task.
+ *
+ * @param inr IRQ number.
+ * @param devno Device number.
+ */
+unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
 {
 	if (!(cap_get(TASK) & CAP_IRQ_REG))
 		return EPERM;
 
-	if (irq >= IRQ_COUNT || irq <= -IPC_IRQ_RESERVED_VIRTUAL)
-		return (unative_t) ELIMIT;
-
-	ipc_irq_unregister(&TASK->answerbox, irq);
+	ipc_irq_unregister(&TASK->answerbox, inr, devno);
 
 	return 0;
