Index: abi/include/abi/syscall.h
===================================================================
--- abi/include/abi/syscall.h	(revision d2e0af475248fbaed0e492a9193a1c189871e3f1)
+++ abi/include/abi/syscall.h	(revision ad211c849e7c6874c1c3f6ce9695684e0420bd95)
@@ -108,7 +108,5 @@
 	SYS_DEBUG_CONSOLE,
 
-	SYS_KLOG,
-
-	SYSCALL_END
+	SYS_KLOG
 } syscall_t;
 
Index: kernel/generic/include/macros.h
===================================================================
--- kernel/generic/include/macros.h	(revision d2e0af475248fbaed0e492a9193a1c189871e3f1)
+++ kernel/generic/include/macros.h	(revision ad211c849e7c6874c1c3f6ce9695684e0420bd95)
@@ -164,4 +164,14 @@
 	    ((void *) &(((type *) 0)->member_identif))))
 
+/** Get the size of an array in array elements
+ *
+ * @param array Array to determine the size of
+ *
+ * @return Size of array in array elements
+ *
+ */
+#define sizeof_array(array) \
+	(sizeof(array) / sizeof((array)[0]))
+
 #endif
 
Index: kernel/generic/include/syscall/syscall.h
===================================================================
--- kernel/generic/include/syscall/syscall.h	(revision d2e0af475248fbaed0e492a9193a1c189871e3f1)
+++ kernel/generic/include/syscall/syscall.h	(revision ad211c849e7c6874c1c3f6ce9695684e0420bd95)
@@ -42,5 +42,4 @@
     sysarg_t, sysarg_t);
 
-extern syshandler_t syscall_table[SYSCALL_END];
 extern sysarg_t syscall_handler(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t);
Index: kernel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision d2e0af475248fbaed0e492a9193a1c189871e3f1)
+++ kernel/generic/src/syscall/syscall.c	(revision ad211c849e7c6874c1c3f6ce9695684e0420bd95)
@@ -56,67 +56,5 @@
 #include <log.h>
 
-/** Dispatch system call */
-sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,
-    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
-{
-	/* Do userpace accounting */
-	irq_spinlock_lock(&THREAD->lock, true);
-	thread_update_accounting(true);
-	irq_spinlock_unlock(&THREAD->lock, true);
-
-#ifdef CONFIG_UDEBUG
-	/*
-	 * An istate_t-compatible record was created on the stack by the
-	 * low-level syscall handler. This is the userspace space state
-	 * structure.
-	 */
-	THREAD->udebug.uspace_state = istate_get(THREAD);
-
-	/*
-	 * Early check for undebugged tasks. We do not lock anything as this
-	 * test need not be precise in either direction.
-	 */
-	if (THREAD->udebug.active)
-		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
-#endif
-
-	sysarg_t rc;
-	if (id < SYSCALL_END) {
-		rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
-	} else {
-		log(LF_OTHER, LVL_ERROR,
-		    "Task %" PRIu64 ": Unknown syscall %#" PRIxn, TASK->taskid, id);
-		task_kill_self(true);
-	}
-
-	if (THREAD->interrupted)
-		thread_exit();
-
-#ifdef CONFIG_UDEBUG
-	if (THREAD->udebug.active) {
-		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
-
-		/*
-		 * Stopping point needed for tasks that only invoke
-		 * non-blocking system calls. Not needed if the task
-		 * is not being debugged (it cannot block here).
-		 */
-		udebug_stoppable_begin();
-		udebug_stoppable_end();
-	}
-
-	/* Clear userspace state pointer */
-	THREAD->udebug.uspace_state = NULL;
-#endif
-
-	/* Do kernel accounting */
-	irq_spinlock_lock(&THREAD->lock, true);
-	thread_update_accounting(false);
-	irq_spinlock_unlock(&THREAD->lock, true);
-
-	return rc;
-}
-
-syshandler_t syscall_table[SYSCALL_END] = {
+static syshandler_t syscall_table[] = {
 	/* System management syscalls. */
 	[SYS_KIO] = (syshandler_t) sys_kio,
@@ -198,4 +136,66 @@
 };
 
+/** Dispatch system call */
+sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,
+    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
+{
+	/* Do userpace accounting */
+	irq_spinlock_lock(&THREAD->lock, true);
+	thread_update_accounting(true);
+	irq_spinlock_unlock(&THREAD->lock, true);
+
+#ifdef CONFIG_UDEBUG
+	/*
+	 * An istate_t-compatible record was created on the stack by the
+	 * low-level syscall handler. This is the userspace space state
+	 * structure.
+	 */
+	THREAD->udebug.uspace_state = istate_get(THREAD);
+
+	/*
+	 * Early check for undebugged tasks. We do not lock anything as this
+	 * test need not be precise in either direction.
+	 */
+	if (THREAD->udebug.active)
+		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
+#endif
+
+	sysarg_t rc;
+	if (id < sizeof_array(syscall_table)) {
+		rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
+	} else {
+		log(LF_OTHER, LVL_ERROR,
+		    "Task %" PRIu64 ": Unknown syscall %#" PRIxn, TASK->taskid, id);
+		task_kill_self(true);
+	}
+
+	if (THREAD->interrupted)
+		thread_exit();
+
+#ifdef CONFIG_UDEBUG
+	if (THREAD->udebug.active) {
+		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
+
+		/*
+		 * Stopping point needed for tasks that only invoke
+		 * non-blocking system calls. Not needed if the task
+		 * is not being debugged (it cannot block here).
+		 */
+		udebug_stoppable_begin();
+		udebug_stoppable_end();
+	}
+
+	/* Clear userspace state pointer */
+	THREAD->udebug.uspace_state = NULL;
+#endif
+
+	/* Do kernel accounting */
+	irq_spinlock_lock(&THREAD->lock, true);
+	thread_update_accounting(false);
+	irq_spinlock_unlock(&THREAD->lock, true);
+
+	return rc;
+}
+
 /** @}
  */
