Index: kernel/generic/src/main/shutdown.c
===================================================================
--- kernel/generic/src/main/shutdown.c	(revision 40043e8d61ecdedef8f915d74b90ad59d8d19f85)
+++ kernel/generic/src/main/shutdown.c	(revision bb580548c8543f1ac3b0535a53deab5ecd530bb2)
@@ -37,11 +37,15 @@
  */
 
+#include <abi/shutdown.h>
 #include <shutdown.h>
 #include <log.h>
 #include <cpu.h>
-#include <arch/asm.h>
-#include <arch.h>
 #include <console/kconsole.h>
-#include <proc/task.h>
+#include <console/console.h>
+#include <proc/thread.h>
+#include <stdlib.h>
+
+/* pointer to the thread for the shutdown process */
+thread_t *shutdown_thread = NULL;
 
 /** Halt flag */
@@ -81,4 +85,5 @@
 }
 
+/* Reboots the kernel */
 void reboot(void)
 {
@@ -93,4 +98,86 @@
 }
 
+/* argument structure for the shutdown thread */
+typedef struct {
+	sysarg_t mode;
+	sysarg_t delay;
+} sys_shutdown_arg_t;
+
+/* function for the shutdown thread */
+static void sys_shutdown_function(void *arguments)
+{
+	sys_shutdown_arg_t *arg = (sys_shutdown_arg_t *)arguments;
+
+	if (arg->delay != 0) {
+		thread_sleep(arg->delay);
+	}
+
+	if (thread_interrupted(THREAD)) {
+		free(arguments);
+		return;
+	}
+
+	if (arg->mode == SHUTDOWN_REBOOT) {
+		reboot();
+	} else {
+		halt();
+	}
+}
+
+/* system call handler for shutdown */
+sys_errno_t sys_shutdown(sysarg_t mode, sysarg_t delay, sysarg_t kconsole)
+{
+
+#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
+	if (kconsole) {
+		grab_console();
+	}
+#endif
+
+	irq_spinlock_lock(&threads_lock, true);
+	thread_t *thread = atomic_load(&shutdown_thread);
+	if (thread != NULL) {
+		thread_interrupt(thread);
+		atomic_store(&shutdown_thread, NULL);
+	}
+	irq_spinlock_unlock(&threads_lock, true);
+
+	/* `cancel` or default has been called */
+	if (mode != SHUTDOWN_HALT && mode != SHUTDOWN_REBOOT) {
+		return EOK;
+	}
+
+	sys_shutdown_arg_t *arg = malloc(sizeof(sys_shutdown_arg_t));
+	if (arg == NULL) {
+		return ENOMEM;
+	}
+
+	//TODO: find a better way for accessing the kernel task
+	irq_spinlock_lock(&tasks_lock, true);
+	task_t *kernel_task = task_find_by_id(1);
+	irq_spinlock_unlock(&tasks_lock, true);
+
+	if (kernel_task == NULL) {
+		goto error;
+	}
+
+	arg->mode = mode;
+	arg->delay = delay;
+
+	thread = thread_create(sys_shutdown_function, arg, kernel_task, THREAD_FLAG_NONE, "shutdown");
+
+	if (thread == NULL) {
+		goto error;
+	}
+
+	thread_ready(thread);
+	atomic_store(&shutdown_thread, thread);
+	return EOK;
+
+error:
+	free(arg);
+	return ENOENT;
+}
+
 /** @}
  */
Index: kernel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision 40043e8d61ecdedef8f915d74b90ad59d8d19f85)
+++ kernel/generic/src/syscall/syscall.c	(revision bb580548c8543f1ac3b0535a53deab5ecd530bb2)
@@ -192,4 +192,6 @@
 	[SYS_SYSINFO_GET_DATA] = (syshandler_t) sys_sysinfo_get_data,
 
+	[SYS_SHUTDOWN] = (syshandler_t) sys_shutdown,
+
 	/* Kernel console syscalls. */
 	[SYS_DEBUG_CONSOLE] = (syshandler_t) sys_debug_console,
