Index: kernel/generic/src/console/chardev.c
===================================================================
--- kernel/generic/src/console/chardev.c	(revision d1dabe1fc36c1dce16ddab03c323e1af9fd3c5ff)
+++ kernel/generic/src/console/chardev.c	(revision f2d2c7ba676ff1a37b6198b134c840dd09e1d11b)
@@ -36,4 +36,7 @@
 #include <synch/waitq.h>
 #include <synch/spinlock.h>
+#include <print.h>
+#include <func.h>
+#include <arch.h>
 
 /** Initialize input character device.
@@ -80,4 +83,44 @@
 }
 
+/** Pop character from input character device.
+ *
+ * @param indev Input character device.
+ *
+ * @return Character read.
+ *
+ */
+wchar_t indev_pop_character(indev_t *indev)
+{
+	if (atomic_get(&haltstate)) {
+		/* If we are here, we are hopefully on the processor that
+		 * issued the 'halt' command, so proceed to read the character
+		 * directly from input
+		 */
+		if (check_poll(indev))
+			return indev->op->poll(indev);
+		
+		/* No other way of interacting with user */
+		interrupts_disable();
+		
+		if (CPU)
+			printf("cpu%u: ", CPU->id);
+		else
+			printf("cpu: ");
+		
+		printf("halted (no polling input)\n");
+		cpu_halt();
+	}
+	
+	waitq_sleep(&indev->wq);
+	ipl_t ipl = interrupts_disable();
+	spinlock_lock(&indev->lock);
+	wchar_t ch = indev->buffer[(indev->index - indev->counter) % INDEV_BUFLEN];
+	indev->counter--;
+	spinlock_unlock(&indev->lock);
+	interrupts_restore(ipl);
+	
+	return ch;
+}
+
 /** Initialize output character device.
  *
@@ -94,4 +137,15 @@
 }
 
+bool check_poll(indev_t *indev)
+{
+	if (indev == NULL)
+		return false;
+	
+	if (indev->op == NULL)
+		return false;
+	
+	return (indev->op->poll != NULL);
+}
+
 /** @}
  */
