Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ kernel/Makefile	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -162,5 +162,4 @@
 	generic/src/ddi/device.c \
 	generic/src/debug/symtab.c \
-	generic/src/event/event.c \
 	generic/src/interrupt/interrupt.c \
 	generic/src/main/main.c \
@@ -215,4 +214,5 @@
 	generic/src/ipc/ipcrsc.c \
 	generic/src/ipc/irq.c \
+	generic/src/ipc/event.c \
 	generic/src/security/cap.c \
 	generic/src/sysinfo/sysinfo.c
Index: kernel/generic/include/event/event.h
===================================================================
--- kernel/generic/include/event/event.h	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_EVENT_H_
-#define KERN_EVENT_H_
-
-#include <event/event_types.h>
-#include <arch/types.h>
-#include <synch/spinlock.h>
-#include <ipc/ipc.h>
-
-/** Event notification structure. */
-typedef struct {
-	SPINLOCK_DECLARE(lock);
-	
-	/** Answerbox for notifications. */
-	answerbox_t *answerbox;
-	/** Method to be used for the notification. */
-	unative_t method;
-	/** Counter. */
-	count_t counter;
-} event_t;
-
-extern void event_init(void);
-extern unative_t sys_event_subscribe(unative_t, unative_t);
-extern bool event_is_subscribed(event_type_t);
-extern void event_cleanup_answerbox(answerbox_t *);
-
-#define event_notify_0(e) \
-	event_notify((e), 0, 0, 0, 0, 0)
-#define event_notify_1(e, a1) \
-	event_notify((e), (a1), 0, 0, 0, 0)
-#define event_notify_2(e, a1, a2) \
-	event_notify((e), (a1), (a2), 0, 0, 0)
-#define event_notify_3(e, a1, a2, a3) \
-	event_notify((e), (a1), (a2), (a3), 0, 0)
-#define event_notify_4(e, a1, a2, a3, a4) \
-	event_notify((e), (a1), (a2), (a3), (a4), 0)
-#define event_notify_5(e, a1, a2, a3, a4, a5) \
-	event_notify((e), (a1), (a2), (a3), (a4), (a5))
-
-extern void event_notify(event_type_t, unative_t, unative_t, unative_t,
-    unative_t, unative_t);
-
-#endif
-
-/** @}
- */
Index: kernel/generic/include/event/event_types.h
===================================================================
--- kernel/generic/include/event/event_types.h	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_EVENT_TYPES_H_
-#define KERN_EVENT_TYPES_H_
-
-typedef enum event_type {
-	EVENT_KLOG = 0,
-	EVENT_KCONSOLE,
-	EVENT_END
-} event_type_t;
-
-#endif
-
-/** @}
- */
Index: kernel/generic/include/ipc/event.h
===================================================================
--- kernel/generic/include/ipc/event.h	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
+++ kernel/generic/include/ipc/event.h	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2009 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_EVENT_H_
+#define KERN_EVENT_H_
+
+#include <ipc/event_types.h>
+#include <arch/types.h>
+#include <synch/spinlock.h>
+#include <ipc/ipc.h>
+
+/** Event notification structure. */
+typedef struct {
+	SPINLOCK_DECLARE(lock);
+	
+	/** Answerbox for notifications. */
+	answerbox_t *answerbox;
+	/** Method to be used for the notification. */
+	unative_t method;
+	/** Counter. */
+	count_t counter;
+} event_t;
+
+extern void event_init(void);
+extern unative_t sys_event_subscribe(unative_t, unative_t);
+extern bool event_is_subscribed(event_type_t);
+extern void event_cleanup_answerbox(answerbox_t *);
+
+#define event_notify_0(e) \
+	event_notify((e), 0, 0, 0, 0, 0)
+#define event_notify_1(e, a1) \
+	event_notify((e), (a1), 0, 0, 0, 0)
+#define event_notify_2(e, a1, a2) \
+	event_notify((e), (a1), (a2), 0, 0, 0)
+#define event_notify_3(e, a1, a2, a3) \
+	event_notify((e), (a1), (a2), (a3), 0, 0)
+#define event_notify_4(e, a1, a2, a3, a4) \
+	event_notify((e), (a1), (a2), (a3), (a4), 0)
+#define event_notify_5(e, a1, a2, a3, a4, a5) \
+	event_notify((e), (a1), (a2), (a3), (a4), (a5))
+
+extern void event_notify(event_type_t, unative_t, unative_t, unative_t,
+    unative_t, unative_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/generic/include/ipc/event_types.h
===================================================================
--- kernel/generic/include/ipc/event_types.h	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
+++ kernel/generic/include/ipc/event_types.h	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2009 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_EVENT_TYPES_H_
+#define KERN_EVENT_TYPES_H_
+
+typedef enum event_type {
+	EVENT_KLOG = 0,
+	EVENT_KCONSOLE,
+	EVENT_END
+} event_type_t;
+
+#endif
+
+/** @}
+ */
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ kernel/generic/src/console/cmd.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -65,5 +65,5 @@
 #include <ipc/ipc.h>
 #include <ipc/irq.h>
-#include <event/event.h>
+#include <ipc/event.h>
 #include <symtab.h>
 #include <errno.h>
Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ kernel/generic/src/console/console.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -42,5 +42,5 @@
 #include <ddi/irq.h>
 #include <ddi/ddi.h>
-#include <event/event.h>
+#include <ipc/event.h>
 #include <ipc/irq.h>
 #include <arch.h>
@@ -53,6 +53,6 @@
 #include <string.h>
 
-#define KLOG_SIZE     PAGE_SIZE
-#define KLOG_LENGTH   (KLOG_SIZE / sizeof(wchar_t))
+#define KLOG_PAGES    4
+#define KLOG_LENGTH   (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t))
 #define KLOG_LATENCY  8
 
@@ -96,5 +96,4 @@
 	
 	ASSERT((uintptr_t) faddr % FRAME_SIZE == 0);
-	ASSERT(KLOG_SIZE % FRAME_SIZE == 0);
 	
 	klog_parea.pbase = (uintptr_t) faddr;
@@ -103,5 +102,5 @@
 	
 	sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
-	sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(sizeof(klog)));
+	sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
 	
 	spinlock_lock(&klog_lock);
Index: kernel/generic/src/event/event.c
===================================================================
--- kernel/generic/src/event/event.c	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/**
- * @file
- * @brief	Kernel event notifications.
- */
-
-#include <event/event.h>
-#include <event/event_types.h>
-#include <mm/slab.h>
-#include <arch/types.h>
-#include <synch/spinlock.h>
-#include <console/console.h>
-#include <memstr.h>
-#include <errno.h>
-#include <arch.h>
-
-/**
- * The events array.
- * Arranging the events in this two-dimensional array should decrease the
- * likelyhood of cacheline ping-pong.
- */
-static event_t *events[EVENT_END];
-
-/** Initialize kernel events. */
-void event_init(void)
-{
-	int i;
-
-	for (i = 0; i < EVENT_END; i++) {
-		events[i] = (event_t *) malloc(sizeof(event_t), 0);
-		spinlock_initialize(&events[i]->lock, "event.lock");
-		events[i]->answerbox = NULL;
-		events[i]->counter = 0;
-		events[i]->method = 0;
-	}
-}
-
-static int
-event_subscribe(event_type_t e, unative_t method, answerbox_t *answerbox)
-{
-	if (e >= EVENT_END)
-		return ELIMIT;
-
-	int res = EEXISTS;
-	event_t *event = events[e];
-
-	spinlock_lock(&event->lock);
-	if (!event->answerbox) {
-		event->answerbox = answerbox;
-		event->method = method;
-		event->counter = 0;
-		res = EOK;
-	}
-	spinlock_unlock(&event->lock);
-
-	return res;
-}
-
-unative_t sys_event_subscribe(unative_t evno, unative_t method)
-{
-	return (unative_t) event_subscribe((event_type_t) evno, (unative_t)
-	    method, &TASK->answerbox);
-}
-
-bool event_is_subscribed(event_type_t e)
-{
-	bool res;
-
-	ASSERT(e < EVENT_END);
-	spinlock_lock(&events[e]->lock);
-	res = events[e]->answerbox != NULL;
-	spinlock_unlock(&events[e]->lock);
-
-	return res;
-}
-
-
-void event_cleanup_answerbox(answerbox_t *answerbox)
-{
-	int i;
-
-	for (i = 0; i < EVENT_END; i++) {
-		spinlock_lock(&events[i]->lock);
-		if (events[i]->answerbox == answerbox) {
-			events[i]->answerbox = NULL;
-			events[i]->counter = 0;
-			events[i]->method = 0;
-		}
-		spinlock_unlock(&events[i]->lock);
-	}
-}
-
-void
-event_notify(event_type_t e, unative_t a1, unative_t a2, unative_t a3,
-    unative_t a4, unative_t a5)
-{
-	ASSERT(e < EVENT_END);
-	event_t *event = events[e];
-	spinlock_lock(&event->lock);
-	if (event->answerbox) {
-		call_t *call = ipc_call_alloc(FRAME_ATOMIC);
-		if (call) {
-			call->flags |= IPC_CALL_NOTIF;
-			call->priv = ++event->counter;
-			IPC_SET_METHOD(call->data, event->method);
-			IPC_SET_ARG1(call->data, a1);
-			IPC_SET_ARG2(call->data, a2);
-			IPC_SET_ARG3(call->data, a3);
-			IPC_SET_ARG4(call->data, a4);
-			IPC_SET_ARG5(call->data, a5);
-
-			spinlock_lock(&event->answerbox->irq_lock);
-			list_append(&call->link, &event->answerbox->irq_notifs);
-			spinlock_unlock(&event->answerbox->irq_lock);
-
-			waitq_wakeup(&event->answerbox->wq, WAKEUP_FIRST);
-		}
-	}
-	spinlock_unlock(&event->lock);
-}
-
-/** @}
- */
Index: kernel/generic/src/ipc/event.c
===================================================================
--- kernel/generic/src/ipc/event.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
+++ kernel/generic/src/ipc/event.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2009 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+/**
+ * @file
+ * @brief Kernel event notifications.
+ */
+
+#include <ipc/event.h>
+#include <ipc/event_types.h>
+#include <mm/slab.h>
+#include <arch/types.h>
+#include <synch/spinlock.h>
+#include <console/console.h>
+#include <memstr.h>
+#include <errno.h>
+#include <arch.h>
+
+/**
+ * The events array.
+ * Arranging the events in this two-dimensional array should decrease the
+ * likelyhood of cacheline ping-pong.
+ */
+static event_t events[EVENT_END];
+
+/** Initialize kernel events. */
+void event_init(void)
+{
+	unsigned int i;
+	
+	for (i = 0; i < EVENT_END; i++) {
+		spinlock_initialize(&events[i].lock, "event.lock");
+		events[i].answerbox = NULL;
+		events[i].counter = 0;
+		events[i].method = 0;
+	}
+}
+
+static int
+event_subscribe(event_type_t evno, unative_t method, answerbox_t *answerbox)
+{
+	if (evno >= EVENT_END)
+		return ELIMIT;
+	
+	spinlock_lock(&events[evno].lock);
+	
+	int res;
+	
+	if (events[evno].answerbox == NULL) {
+		events[evno].answerbox = answerbox;
+		events[evno].method = method;
+		events[evno].counter = 0;
+		res = EOK;
+	} else
+		res = EEXISTS;
+	
+	spinlock_unlock(&events[evno].lock);
+	
+	return res;
+}
+
+unative_t sys_event_subscribe(unative_t evno, unative_t method)
+{
+	return (unative_t) event_subscribe((event_type_t) evno, (unative_t)
+	    method, &TASK->answerbox);
+}
+
+bool event_is_subscribed(event_type_t evno)
+{
+	bool res;
+	
+	ASSERT(evno < EVENT_END);
+	
+	spinlock_lock(&events[evno].lock);
+	res = events[evno].answerbox != NULL;
+	spinlock_unlock(&events[evno].lock);
+	
+	return res;
+}
+
+
+void event_cleanup_answerbox(answerbox_t *answerbox)
+{
+	unsigned int i;
+	
+	for (i = 0; i < EVENT_END; i++) {
+		spinlock_lock(&events[i].lock);
+		if (events[i].answerbox == answerbox) {
+			events[i].answerbox = NULL;
+			events[i].counter = 0;
+			events[i].method = 0;
+		}
+		spinlock_unlock(&events[i].lock);
+	}
+}
+
+void
+event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
+    unative_t a4, unative_t a5)
+{
+	ASSERT(evno < EVENT_END);
+	
+	spinlock_lock(&events[evno].lock);
+	if (events[evno].answerbox != NULL) {
+		call_t *call = ipc_call_alloc(FRAME_ATOMIC);
+		if (call) {
+			call->flags |= IPC_CALL_NOTIF;
+			call->priv = ++events[evno].counter;
+			IPC_SET_METHOD(call->data, events[evno].method);
+			IPC_SET_ARG1(call->data, a1);
+			IPC_SET_ARG2(call->data, a2);
+			IPC_SET_ARG3(call->data, a3);
+			IPC_SET_ARG4(call->data, a4);
+			IPC_SET_ARG5(call->data, a5);
+			
+			spinlock_lock(&events[evno].answerbox->irq_lock);
+			list_append(&call->link, &events[evno].answerbox->irq_notifs);
+			spinlock_unlock(&events[evno].answerbox->irq_lock);
+			
+			waitq_wakeup(&events[evno].answerbox->wq, WAKEUP_FIRST);
+		}
+	}
+	spinlock_unlock(&events[evno].lock);
+}
+
+/** @}
+ */
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ kernel/generic/src/ipc/ipc.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -45,5 +45,5 @@
 #include <ipc/ipc.h>
 #include <ipc/kbox.h>
-#include <event/event.h>
+#include <ipc/event.h>
 #include <errno.h>
 #include <mm/slab.h>
@@ -52,6 +52,4 @@
 #include <memstr.h>
 #include <debug.h>
-
-
 #include <print.h>
 #include <console/console.h>
Index: kernel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ kernel/generic/src/main/main.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -33,5 +33,5 @@
 /**
  * @file
- * @brief 	Main initialization kernel function for all processors.
+ * @brief Main initialization kernel function for all processors.
  *
  * During kernel boot, all processors, after architecture dependent
@@ -83,5 +83,5 @@
 #include <ddi/ddi.h>
 #include <main/main.h>
-#include <event/event.h>
+#include <ipc/event.h>
 
 /** Global configuration structure. */
Index: kernel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision 149d14e522aa5c449b696ad4420f3caa33ca9b8e)
+++ kernel/generic/src/syscall/syscall.c	(revision 13a638d3605c8d5aaaa69c1cba72bf0787e576fa)
@@ -49,5 +49,5 @@
 #include <synch/smc.h>
 #include <ddi/ddi.h>
-#include <event/event.h>
+#include <ipc/event.h>
 #include <security/cap.h>
 #include <sysinfo/sysinfo.h>
