Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ HelenOS.config	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -417,4 +417,7 @@
 ! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_PC_KBD (y/n)
 
+% PC keyboard support
+! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_PC_KBD (y/n)
+
 % Support for msim/GXemul keyboard
 ! [CONFIG_HID_IN=generic&PLATFORM=mips32] CONFIG_MIPS_KBD (y/n)
Index: kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
===================================================================
--- kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -292,5 +292,5 @@
 		.y = 480,
 		.scan = 2560,
-		.visual = VISUAL_BGR_0_8_8_8,
+		.visual = VISUAL_RGB_8_8_8_0,
 	};
 	
Index: kernel/arch/mips32/include/cp0.h
===================================================================
--- kernel/arch/mips32/include/cp0.h	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ kernel/arch/mips32/include/cp0.h	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -70,5 +70,5 @@
   { \
       uint32_t retval; \
-      asm("mfc0 %0, $" #reg : "=r"(retval)); \
+      asm volatile ("mfc0 %0, $" #reg : "=r"(retval)); \
       return retval; \
   }
@@ -76,5 +76,5 @@
 #define GEN_WRITE_CP0(nm,reg) static inline void cp0_ ##nm##_write(uint32_t val) \
  { \
-    asm("mtc0 %0, $" #reg : : "r"(val) ); \
+    asm volatile ("mtc0 %0, $" #reg : : "r"(val) ); \
  }
 
Index: kernel/arch/sparc64/src/smp/sun4v/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -1,5 +1,5 @@
 /*
  * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky 
+ * Copyright (c) 2009 Pavel Rimsky
  * All rights reserved.
  *
@@ -439,5 +439,5 @@
 	if (waitq_sleep_timeout(&ap_completion_wq, 10000000, SYNCH_FLAGS_NONE) ==
 	    ESYNCH_TIMEOUT)
-		printf("%s: waiting for processor (cpuid = %" PRIu32 ") timed out\n",
+		printf("%s: waiting for processor (cpuid = %" PRIu64 ") timed out\n",
 		    __func__, cpuid);
 	
Index: kernel/arch/sparc64/src/sun4v/start.S
===================================================================
--- kernel/arch/sparc64/src/sun4v/start.S	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ kernel/arch/sparc64/src/sun4v/start.S	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -296,5 +296,5 @@
 	 * Create the first stack frame.
 	 */
-	save %sp, -(STACK_WINDWO_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
+	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
 	flushw
 	add %g0, -STACK_BIAS, %fp
Index: kernel/arch/sparc64/src/trap/sun4v/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -111,5 +111,5 @@
 			((void (*)(void)) data1)();
 		} else {
-			printf("Spurious interrupt on %d, data = %" PRIx64 ".\n",
+			printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n",
 			    CPU->arch.id, data1);
 		}
Index: kernel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ kernel/genarch/Makefile.inc	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -122,10 +122,4 @@
 endif
 
-ifeq ($(CONFIG_PL050),y)
-	GENARCH_SOURCES += \
-		genarch/src/kbrd/kbrd_pl050.c \
-		genarch/src/kbrd/scanc_pl050.c
-endif
-
 ifeq ($(CONFIG_MAC_KBD),y)
 	GENARCH_SOURCES += \
Index: rnel/genarch/src/kbrd/kbrd_pl050.c
===================================================================
--- kernel/genarch/src/kbrd/kbrd_pl050.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * 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 genarch
- * @{
- */
-/**
- * @file
- * @brief pl050 Keyboard processing.
- */
-
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/kbrd/scanc.h>
-
-#include <genarch/kbrd/scanc_pl050.h>
-
-#include <synch/spinlock.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <macros.h>
-
-#define PRESSED_SHIFT     (1 << 0)
-#define PRESSED_CAPSLOCK  (1 << 1)
-#define LOCKED_CAPSLOCK   (1 << 0)
-
-#define PL050_KEY_RELEASE 0xF0
-#define PL050_ESC_KEY   0xE0
-#define PL050_CAPS_SCAN_CODE   0x58
-#define PL050_NUM_SCAN_CODE   0x77
-#define PL050_SCROLL_SCAN_CODE   0x7E
-
-static bool is_lock_key(wchar_t);
-
-static indev_operations_t kbrd_raw_ops = {
-	.poll = NULL
-};
-
-/** Process release of key.
- *
- * @param sc Scancode of the key being released.
- */
-static void key_released(kbrd_instance_t *instance, wchar_t sc)
-{
-	spinlock_lock(&instance->keylock);
-	
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags &= ~PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags &= ~PRESSED_CAPSLOCK;
-		if (instance->lockflags & LOCKED_CAPSLOCK)
-			instance->lockflags &= ~LOCKED_CAPSLOCK;
-		else
-			instance->lockflags |= LOCKED_CAPSLOCK;
-		break;
-	default:
-		break;
-	}
-	
-	spinlock_unlock(&instance->keylock);
-}
-
-/** Process keypress.
- *
- * @param sc Scancode of the key being pressed.
- */
-static void key_pressed(kbrd_instance_t *instance, wchar_t sc)
-{
-	bool letter;
-	bool shift;
-	bool capslock;
-	
-	spinlock_lock(&instance->keylock);
-	
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags |= PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags |= PRESSED_CAPSLOCK;
-		break;
-	case SC_SCAN_ESCAPE:
-		break;
-	default:
-		letter = islower(sc_primary_map[sc]);
-		shift = instance->keyflags & PRESSED_SHIFT;
-		capslock = (instance->keyflags & PRESSED_CAPSLOCK) ||
-		    (instance->lockflags & LOCKED_CAPSLOCK);
-		
-		if ((letter) && (capslock))
-			shift = !shift;
-		
-		if (shift)
-			indev_push_character(instance->sink, sc_secondary_map[sc]);
-		else
-			indev_push_character(instance->sink, sc_primary_map[sc]);
-		break;
-	}
-	
-	spinlock_unlock(&instance->keylock);
-}
-
-static void kkbrd(void *arg)
-{
-	static int key_released_flag = 0;
-	static int is_locked = 0;
-	kbrd_instance_t *instance = (kbrd_instance_t *) arg;
-	
-	while (true) {
-		wchar_t sc = indev_pop_character(&instance->raw);
-
-		if (sc == PL050_KEY_RELEASE) {
-			key_released_flag = 1;
-		} else {
-			if (key_released_flag) {
-				key_released_flag = 0;
-				if (is_lock_key(sc)) {
-					if (!is_locked) {
-						is_locked = 1;
-					} else {
-						is_locked = 0;
-						continue;
-					}
-				}
-				key_released(instance, sc);
-
-			} else {
-				if (is_lock_key(sc) && is_locked)
-					continue;
-				key_pressed(instance, sc);
-			}
-		}
-		
-	}
-}
-
-kbrd_instance_t *kbrd_init(void)
-{
-	kbrd_instance_t *instance
-	    = malloc(sizeof(kbrd_instance_t), FRAME_ATOMIC);
-	if (instance) {
-		instance->thread
-			= thread_create(kkbrd, (void *) instance, TASK, 0, "kkbrd", false);
-		
-		if (!instance->thread) {
-			free(instance);
-			return NULL;
-		}
-		
-		instance->sink = NULL;
-		indev_initialize("kbrd", &instance->raw, &kbrd_raw_ops);
-		
-		spinlock_initialize(&instance->keylock, "kbrd_pl050.instance.keylock");
-		instance->keyflags = 0;
-		instance->lockflags = 0;
-	}
-	
-	return instance;
-}
-
-indev_t *kbrd_wire(kbrd_instance_t *instance, indev_t *sink)
-{
-	ASSERT(instance);
-	ASSERT(sink);
-	
-	instance->sink = sink;
-	thread_ready(instance->thread);
-	
-	return &instance->raw;
-}
-
-static bool is_lock_key(wchar_t sc)
-{
-	return ((sc == PL050_CAPS_SCAN_CODE) || (sc == PL050_NUM_SCAN_CODE) ||
-		(sc == PL050_SCROLL_SCAN_CODE));
-}
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/scanc_pl050.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_pl050.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ 	(revision )
@@ -1,234 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * 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, U_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 genarch	
- * @{
- */
-/**
- * @file
- * @brief	Scan codes for pl050 keyboards.
- */
-#include <genarch/kbrd/scanc.h>
-#include <typedefs.h>
-#include <str.h>
-
-
-/** Primary meaning of scancodes. */
-wchar_t sc_primary_map[] = {
-	U_NULL, /* 0x00 */
-	U_SPECIAL, /* 0x01 - F9 */
-	U_SPECIAL, /* 0x02 - F7 */
-	U_SPECIAL, /* 0x03 - F5 */
-	U_SPECIAL, /* 0x04 - F3 */
-	U_SPECIAL, /* 0x05 - F1 */
-	U_SPECIAL, /* 0x06 - F2 */
-	U_SPECIAL, /* 0x07 - F12 */
-	U_SPECIAL, /* 0x08 -  */
-	U_SPECIAL, /* 0x09 - F10 */
-	U_SPECIAL, /* 0x0A - F8 */
-	U_SPECIAL, /* 0x0B - F10 */
-	U_SPECIAL, /* 0x0C - F4 */
-	'\t', /* 0x0D - Tab */
-	'`',
-	U_SPECIAL, /* 0x0F */
-	U_SPECIAL, /* 0x10 */
-	U_SPECIAL, /* 0x11 - LAlt */
-	U_SPECIAL, /* 0x12 - LShift */
-	U_SPECIAL, /* ox13 */
-	U_SPECIAL, /* 0x14 Ctrl */
-	'q', '1',
-	U_SPECIAL, /* 0x17 */
-	U_SPECIAL, /* 0x18 */
-	U_SPECIAL, /* 0x19 */
-	'z', 's', 'a', 'w', '2',
-	U_SPECIAL, /* 0x1F */
-	U_SPECIAL, /* 0x20 */
-	'c', 'x', 'd', 'e', '4', '3',
-	U_SPECIAL, /* 0x27 */
-	U_SPECIAL, /* 0x28 */
-	' ', 'v', 'f', 't', 'r', '5',
-	U_SPECIAL, /* 0x2F */
-	U_SPECIAL, /* 0x30 */
-	'n', 'b', 'h', 'g', 'y', '6',
-	U_SPECIAL, /* 0x37 */
-	U_SPECIAL, /* 0x38 */
-	U_SPECIAL, /* 0x39 */
-	'm', 'j', 'u', '7', '8',
-	U_SPECIAL, /* 0x3F */
-	U_SPECIAL, /* 0x40 */
-	',', 'k', 'i', 'o', '0', '9',
-	U_SPECIAL, /* 0x47 */
-	U_SPECIAL, /* 0x48 */
-	'.', '/', 'l', ';', 'p', '-',
-	U_SPECIAL, /* 0x4F */
-	U_SPECIAL, /* 0x50 */
-	U_SPECIAL, /* 0x51 */
-	'\'',
-	U_SPECIAL, /* 0x53 */
-	'[', '=',
-	U_SPECIAL, /* 0x56 */
-	U_SPECIAL, /* 0x57 */
-	U_SPECIAL, /* 0x58 - Caps Lock */
-	U_SPECIAL, /* 0x59 - RShift */
-	'\n', ']',
-	U_SPECIAL, /* 0x5C */
-	'\\',
-	U_SPECIAL, /* 0x5E */
-	U_SPECIAL, /* 0x5F */
-	U_SPECIAL, /* 0x60 */
-	U_SPECIAL, /* 0x61 */
-	U_SPECIAL, /* 0x62 */
-	U_SPECIAL, /* 0x63 */
-	U_SPECIAL, /* 0x64 */
-	U_SPECIAL, /* 0x65 */
-	'\b', /* 0x66  - backspace*/
-	U_SPECIAL, /* 0x67 */
-	U_SPECIAL, /* 0x68 */
-	U_END_ARROW, /* 0x69 */
-	U_SPECIAL, /* 0x6a */
-	U_LEFT_ARROW, /* 0x6b - Left Arrow */
-	U_SPECIAL, /* 0x6c */
-	U_SPECIAL, /* 0x6d */
-	U_SPECIAL, /* 0x6e */
-	U_SPECIAL, /* 0x6f */
-	U_SPECIAL, /* 0x70 */
-	U_DELETE, /* 0x71 - Del*/
-	U_DOWN_ARROW, /* 0x72 Down Arrow */
-	U_SPECIAL, /* 0x73 */
-	U_RIGHT_ARROW, /* 0x74  - Right Arrow */
-	U_UP_ARROW, /* 0x75  Up Arrow */
-	U_ESCAPE, /* 0x76 Esc */
-	U_SPECIAL, /* 0x77 - NumLock*/
-	U_SPECIAL, /* 0x78  F11*/
-	U_SPECIAL, /* 0x79 */
-	U_PAGE_DOWN, /* 0x7a */
-	U_SPECIAL, /* 0x7b */
-	U_SPECIAL, /* 0x7c */
-	U_PAGE_UP, /* 0x7d */
-	U_SPECIAL, /* 0x7e */
-	U_SPECIAL /* 0x7f */
-};
-
-/** Secondary meaning of scancodes. */
-wchar_t sc_secondary_map[] = {
-	U_NULL, /* 0x00 */
-	U_SPECIAL, /* 0x01 - F9 */
-	U_SPECIAL, /* 0x02 - F7 */
-	U_SPECIAL, /* 0x03 - F5 */
-	U_SPECIAL, /* 0x04 - F3 */
-	U_SPECIAL, /* 0x05 - F1 */
-	U_SPECIAL, /* 0x06 - F2 */
-	U_SPECIAL, /* 0x07 - F12 */
-	U_SPECIAL, /* 0x08 -  */
-	U_SPECIAL, /* 0x09 - F10 */
-	U_SPECIAL, /* 0x0A - F8 */
-	U_SPECIAL, /* 0x0B - F10 */
-	U_SPECIAL, /* 0x0C - F4 */
-	'\t', /* 0x0D - Tab */
-	'~',
-	U_SPECIAL, /* 0x0F */
-	U_SPECIAL, /* 0x10 */
-	U_SPECIAL, /* 0x11 - LAlt */
-	U_SPECIAL, /* 0x12 - LShift */
-	U_SPECIAL, /* ox13 */
-	U_SPECIAL, /* 0x14 Ctrl */
-	'Q', '!',
-	U_SPECIAL, /* 0x17 */
-	U_SPECIAL, /* 0x18 */
-	U_SPECIAL, /* 0x19 */
-	'Z', 'S', 'A', 'W', '@',
-	U_SPECIAL, /* 0x1F */
-	U_SPECIAL, /* 0x20 */
-	'C', 'X', 'D', 'E', '$', '#',
-	U_SPECIAL, /* 0x27 */
-	U_SPECIAL, /* 0x28 */
-	' ', 'V', 'F', 'T', 'R', '%',
-	U_SPECIAL, /* 0x2F */
-	U_SPECIAL, /* 0x30 */
-	'N', 'B', 'H', 'G', 'Y', '^',
-	U_SPECIAL, /* 0x37 */
-	U_SPECIAL, /* 0x38 */
-	U_SPECIAL, /* 0x39 */
-	'M', 'J', 'U', '&', '*',
-	U_SPECIAL, /* 0x3F */
-	U_SPECIAL, /* 0x40 */
-	'<', 'K', 'I', 'O', ')', '(',
-	U_SPECIAL, /* 0x47 */
-	U_SPECIAL, /* 0x48 */
-	'>', '?', 'L', ':', 'P', '_',
-	U_SPECIAL, /* 0x4F */
-	U_SPECIAL, /* 0x50 */
-	U_SPECIAL, /* 0x51 */
-	'"',
-	U_SPECIAL, /* 0x53 */
-	'{', '+',
-	U_SPECIAL, /* 0x56 */
-	U_SPECIAL, /* 0x57 */
-	U_SPECIAL, /* 0x58 - Caps Lock */
-	U_SPECIAL, /* 0x59 - RShift */
-	'\n', '}',
-	U_SPECIAL, /* 0x5C */
-	'|',
-	U_SPECIAL, /* 0x5E */
-	U_SPECIAL, /* 0x5F */
-	U_SPECIAL, /* 0x60 */
-	U_SPECIAL, /* 0x61 */
-	U_SPECIAL, /* 0x62 */
-	U_SPECIAL, /* 0x63 */
-	U_SPECIAL, /* 0x64 */
-	U_SPECIAL, /* 0x65 */
-	'\b', /* 0x66  - backspace*/
-	U_SPECIAL, /* 0x67 */
-	U_SPECIAL, /* 0x68 */
-	U_END_ARROW, /* 0x69 */
-	U_SPECIAL, /* 0x6a */
-	U_LEFT_ARROW, /* 0x6b - Left Arrow */
-	U_SPECIAL, /* 0x6c */
-	U_SPECIAL, /* 0x6d */
-	U_SPECIAL, /* 0x6e */
-	U_SPECIAL, /* 0x6f */
-	U_SPECIAL, /* 0x70 */
-	U_DELETE, /* 0x71 - Del*/
-	U_DOWN_ARROW, /* 0x72 Down Arrow */
-	U_SPECIAL, /* 0x73 */
-	U_RIGHT_ARROW, /* 0x74  - Right Arrow */
-	U_UP_ARROW, /* 0x75  Up Arrow */
-	U_ESCAPE, /* 0x76 Esc */
-	U_SPECIAL, /* 0x77 - NumLock*/
-	U_SPECIAL, /* 0x78  F11*/
-	U_SPECIAL, /* 0x79 */
-	U_PAGE_DOWN, /* 0x7a */
-	U_SPECIAL, /* 0x7b */
-	U_SPECIAL, /* 0x7c */
-	U_PAGE_UP, /* 0x7d */
-	U_SPECIAL, /* 0x7e */
-	U_SPECIAL /* 0x7f */
-};
-
-/** @}
- */
Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -1,3 +1,4 @@
 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com>
+ * Copyright (c) 2011, Martin Sucha
  * All rights reserved.
  *
@@ -35,4 +36,11 @@
 #include <str.h>
 #include <fcntl.h>
+#include <io/console.h>
+#include <io/color.h>
+#include <io/style.h>
+#include <io/keycode.h>
+#include <errno.h>
+#include <vfs/vfs.h>
+#include <assert.h>
 
 #include "config.h"
@@ -48,4 +56,12 @@
 
 static const char *cat_oops = "That option is not yet supported\n";
+static const char *hexchars = "0123456789abcdef";
+
+static bool paging_enabled = false;
+static size_t chars_remaining = 0;
+static size_t lines_remaining = 0;
+static sysarg_t console_cols = 0;
+static sysarg_t console_rows = 0;
+static bool should_quit = false;
 
 static struct option const long_options[] = {
@@ -56,4 +72,5 @@
 	{ "buffer", required_argument, 0, 'b' },
 	{ "more", no_argument, 0, 'm' },
+	{ "hex", no_argument, 0, 'x' },
 	{ 0, 0, 0, 0 }
 };
@@ -75,4 +92,5 @@
 		"  -b, --buffer ##  Set the read buffer size to ##\n"
 		"  -m, --more       Pause after each screen full\n"
+		"  -x, --hex        Print bytes as hex values\n"
 		"Currently, %s is under development, some options don't work.\n",
 		cmdname, cmdname);
@@ -82,9 +100,72 @@
 }
 
-static unsigned int cat_file(const char *fname, size_t blen)
+static void waitprompt()
+{
+	console_set_pos(fphone(stdout), 0, console_rows-1);
+	console_set_color(fphone(stdout), COLOR_BLUE, COLOR_WHITE, 0);
+	printf("ENTER/SPACE/PAGE DOWN - next page, "
+	       "ESC/Q - quit, C - continue unpaged");
+	fflush(stdout);
+	console_set_style(fphone(stdout), STYLE_NORMAL);
+}
+
+static void waitkey()
+{
+	console_event_t ev;
+	
+	while (true) {
+		if (!console_get_event(fphone(stdin), &ev)) {
+			return;
+		}
+		if (ev.type == KEY_PRESS) {
+			if (ev.key == KC_ESCAPE || ev.key == KC_Q) {
+				should_quit = true;
+				return;
+			}
+			if (ev.key == KC_C) {
+				paging_enabled = false;
+				return;
+			}
+			if (ev.key == KC_ENTER || ev.key == KC_SPACE ||
+			    ev.key == KC_PAGE_DOWN) {
+				return;
+			}
+		}
+	}
+	assert(false);
+}
+
+static void newpage()
+{
+	console_clear(fphone(stdout));
+	chars_remaining = console_cols;
+	lines_remaining = console_rows-1;
+}
+
+static void paged_char(wchar_t c)
+{
+	putchar(c);
+	if (paging_enabled) {
+		chars_remaining--;
+		if (c == '\n' || chars_remaining == 0) {
+			chars_remaining = console_cols;
+			lines_remaining--;
+		}
+		if (lines_remaining == 0) {
+			fflush(stdout);
+			waitprompt();
+			waitkey();
+			newpage();
+		}
+	}
+}
+
+static unsigned int cat_file(const char *fname, size_t blen, bool hex)
 {
 	int fd, bytes = 0, count = 0, reads = 0;
 	off64_t total = 0;
 	char *buff = NULL;
+	int i;
+	size_t offset = 0;
 
 	fd = open(fname, O_RDONLY);
@@ -109,8 +190,23 @@
 			count += bytes;
 			buff[bytes] = '\0';
-			printf("%s", buff);
+			offset = 0;
+			for (i = 0; i < bytes && !should_quit; i++) {
+				if (hex) {
+					paged_char(hexchars[((uint8_t)buff[i])/16]);
+					paged_char(hexchars[((uint8_t)buff[i])%16]);
+				}
+				else {
+					wchar_t c = str_decode(buff, &offset, bytes);
+					if (c == 0) {
+						// reached end of string
+						break;
+					}
+					paged_char(c);
+				}
+				
+			}
 			reads++;
 		}
-	} while (bytes > 0);
+	} while (bytes > 0 && !should_quit);
 
 	close(fd);
@@ -131,9 +227,22 @@
 	unsigned int argc, i, ret = 0, buffer = 0;
 	int c, opt_ind;
+	bool hex = false;
+	bool more = false;
+	sysarg_t rows, cols;
+	int rc;
+	
+	// reset global state
+	// TODO: move to structure?
+	paging_enabled = false;
+	chars_remaining = 0;
+	lines_remaining = 0;
+	console_cols = 0;
+	console_rows = 0;
+	should_quit = false;
 
 	argc = cli_count_args(argv);
 
 	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "hvmH:t:b:", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "xhvmH:t:b:", long_options, &opt_ind);
 		switch (c) {
 		case 'h':
@@ -153,6 +262,9 @@
 			break;
 		case 'm':
-			printf("%s", cat_oops);
-			return CMD_FAILURE;
+			more = true;
+			break;
+		case 'x':
+			hex = true;
+			break;
 		}
 	}
@@ -168,7 +280,19 @@
 	if (buffer <= 0)
 		buffer = CAT_DEFAULT_BUFLEN;
-
-	for (i = optind; argv[i] != NULL; i++)
-		ret += cat_file(argv[i], buffer);
+	
+	if (more) {
+		rc = console_get_size(fphone(stdout), &cols, &rows);
+		if (rc != EOK) {
+			printf("%s - cannot get console size\n", cmdname);
+			return CMD_FAILURE;
+		}
+		console_cols = cols;
+		console_rows = rows;
+		paging_enabled = true;
+		newpage();
+	}
+
+	for (i = optind; argv[i] != NULL && !should_quit; i++)
+		ret += cat_file(argv[i], buffer, hex);
 
 	if (ret)
Index: uspace/app/bdsh/cmds/modules/cat/cat.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.h	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -4,5 +4,5 @@
 /* Prototypes for the cat command, excluding entry points */
 
-static unsigned int cat_file(const char *, size_t);
+static unsigned int cat_file(const char *, size_t, bool);
 
 #endif /* CAT_H */
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -108,4 +108,5 @@
 	for (;;) {
 		ssize_t res;
+		size_t written = 0;
 
 		bytes = read(fd1, buff, blen);
@@ -120,7 +121,8 @@
 			 * returned less data than requested.
 			 */
-			bytes = write(fd2, buff, res);
+			bytes = write(fd2, buff + written, res);
 			if (bytes < 0)
 				goto err;
+			written += bytes;
 			res -= bytes;
 		} while (res > 0);
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -101,7 +101,42 @@
 }
 
+static unsigned int rm_recursive_not_empty_dirs(const char *path)
+{
+	DIR *dirp;
+	struct dirent *dp;
+	char buff[PATH_MAX];
+	unsigned int scope;
+	unsigned int ret = 0;
+
+	dirp = opendir(path);
+	if (!dirp) {
+		/* May have been deleted between scoping it and opening it */
+		cli_error(CL_EFAIL, "Could not open %s", path);
+		return ret;
+	}
+
+	memset(buff, 0, sizeof(buff));
+	while ((dp = readdir(dirp))) {
+		snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
+		scope = rm_scope(buff);
+		switch (scope) {
+		case RM_BOGUS:
+			break;
+		case RM_FILE:
+			ret += rm_single(buff);
+			break;
+		case RM_DIR:
+			ret += rm_recursive(buff);
+			break;
+		}
+	}
+	
+	return ret;
+}
+
 static unsigned int rm_recursive(const char *path)
 {
 	int rc;
+	unsigned int ret = 0;
 
 	/* First see if it will just go away */
@@ -111,7 +146,14 @@
 
 	/* Its not empty, recursively scan it */
-	cli_error(CL_ENOTSUP,
-		"Can not remove %s, directory not empty", path);
-	return 1;
+	ret = rm_recursive_not_empty_dirs(path);
+
+	/* Delete directory */
+	rc = rmdir(path);
+	if (rc == 0)
+		return ret;
+
+	cli_error(CL_ENOTSUP, "Can not remove %s", path);
+
+	return ret + 1;
 }
 
Index: uspace/drv/pciintel/pci.c
===================================================================
--- uspace/drv/pciintel/pci.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/drv/pciintel/pci.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -95,18 +95,11 @@
 	sysarg_t i8259;
 
-	int irc_phone = -1;
-	int irc_service = -1;
-
-	if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) {
-		irc_service = SERVICE_APIC;
-	} else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) {
-		irc_service = SERVICE_I8259;
-	}
-
-	if (irc_service == -1) {
-		return false;
-	}
-
-	irc_phone = service_connect_blocking(irc_service, 0, 0);
+	int irc_phone = ENOTSUP;
+
+	if (((sysinfo_get_value("apic", &apic) == EOK) && (apic))
+	    || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) {
+		irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
+	}
+
 	if (irc_phone < 0) {
 		return false;
Index: uspace/lib/c/include/ipc/services.h
===================================================================
--- uspace/lib/c/include/ipc/services.h	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/lib/c/include/ipc/services.h	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -47,8 +47,5 @@
 	SERVICE_DEVMAP,
 	SERVICE_DEVMAN,
-	SERVICE_FHC,
-	SERVICE_OBIO,
-	SERVICE_APIC,
-	SERVICE_I8259,
+	SERVICE_IRC,
 	SERVICE_CLIPBOARD,
 	SERVICE_NETWORKING,
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/lib/fs/libfs.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -391,4 +391,6 @@
 						if (lflag & L_CREATE)
 							(void) ops->destroy(fn);
+						else
+							(void) ops->node_put(fn);
 						async_answer_0(rid, rc);
 					} else {
@@ -473,4 +475,6 @@
 					if (lflag & L_CREATE)
 						(void) ops->destroy(fn);
+					else
+						(void) ops->node_put(fn);
 					async_answer_0(rid, rc);
 				} else {
Index: uspace/srv/hid/kbd/Makefile
===================================================================
--- uspace/srv/hid/kbd/Makefile	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hid/kbd/Makefile	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -78,5 +78,5 @@
 		SOURCES += \
 			port/pl050.c \
-			ctl/pl050.c
+			ctl/pc.c
 	endif
 endif
Index: pace/srv/hid/kbd/ctl/pl050.c
===================================================================
--- uspace/srv/hid/kbd/ctl/pl050.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * 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 kbd_ctl
- * @ingroup kbd
- * @{
- */
-/**
- * @file
- * @brief PL050 keyboard controller driver.
- */
-
-#include <kbd.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <kbd_ctl.h>
-#include <gsp.h>
-#include <stdio.h>
-
-#define PL050_CAPS_SCAN_CODE 0x58
-#define PL050_NUM_SCAN_CODE 0x77
-#define PL050_SCROLL_SCAN_CODE 0x7E
-
-static bool is_lock_key(int);
-enum dec_state {
-	ds_s,
-	ds_e
-};
-
-static enum dec_state ds;
-
-static int scanmap_simple[] = {
-
-	[0x0e] = KC_BACKTICK,
-
-	[0x16] = KC_1,
-	[0x1e] = KC_2,
-	[0x26] = KC_3,
-	[0x25] = KC_4,
-	[0x2e] = KC_5,
-	[0x36] = KC_6,
-	[0x3d] = KC_7,
-	[0x3e] = KC_8,
-	[0x46] = KC_9,
-	[0x45] = KC_0,
-
-	[0x4e] = KC_MINUS,
-	[0x55] = KC_EQUALS,
-	[0x66] = KC_BACKSPACE,
-
-	[0x0d] = KC_TAB,
-
-	[0x15] = KC_Q,
-	[0x1d] = KC_W,
-	[0x24] = KC_E,
-	[0x2d] = KC_R,
-	[0x2c] = KC_T,
-	[0x35] = KC_Y,
-	[0x3c] = KC_U,
-	[0x43] = KC_I,
-	[0x44] = KC_O,
-	[0x4d] = KC_P,
-
-	[0x54] = KC_LBRACKET,
-	[0x5b] = KC_RBRACKET,
-
-	[0x58] = KC_CAPS_LOCK,
-
-	[0x1c] = KC_A,
-	[0x1b] = KC_S,
-	[0x23] = KC_D,
-	[0x2b] = KC_F,
-	[0x34] = KC_G,
-	[0x33] = KC_H,
-	[0x3b] = KC_J,
-	[0x42] = KC_K,
-	[0x4b] = KC_L,
-
-	[0x4c] = KC_SEMICOLON,
-	[0x52] = KC_QUOTE,
-	[0x5d] = KC_BACKSLASH,
-
-	[0x12] = KC_LSHIFT,
-
-	[0x1a] = KC_Z,
-	[0x22] = KC_X,
-	[0x21] = KC_C,
-	[0x2a] = KC_V,
-	[0x32] = KC_B,
-	[0x31] = KC_N,
-	[0x3a] = KC_M,
-
-	[0x41] = KC_COMMA,
-	[0x49] = KC_PERIOD,
-	[0x4a] = KC_SLASH,
-
-	[0x59] = KC_RSHIFT,
-
-	[0x14] = KC_LCTRL,
-	[0x11] = KC_LALT,
-	[0x29] = KC_SPACE,
-
-	[0x76] = KC_ESCAPE,
-
-	[0x05] = KC_F1,
-	[0x06] = KC_F2,
-	[0x04] = KC_F3,
-	[0x0c] = KC_F4,
-	[0x03] = KC_F5,
-	[0x0b] = KC_F6,
-	[0x02] = KC_F7,
-
-	[0x0a] = KC_F8,
-	[0x01] = KC_F9,
-	[0x09] = KC_F10,
-
-	[0x78] = KC_F11,
-	[0x07] = KC_F12,
-
-	[0x60] = KC_SCROLL_LOCK,
-
-	[0x5a] = KC_ENTER,
-
-	[0x77] = KC_NUM_LOCK,
-	[0x7c] = KC_NTIMES,
-	[0x7b] = KC_NMINUS,
-	[0x79] = KC_NPLUS,
-	[0x6c] = KC_N7,
-	[0x75] = KC_N8,
-	[0x7d] = KC_N9,
-	[0x6b] = KC_N4,
-	[0x73] = KC_N5,
-	[0x74] = KC_N6,
-	[0x69] = KC_N1,
-	[0x72] = KC_N2,
-	[0x7a] = KC_N3,
-	[0x70] = KC_N0,
-	[0x71] = KC_NPERIOD
-};
-
-static int scanmap_e0[] = {
-	[0x65] = KC_RALT,
-	[0x59] = KC_RSHIFT,
-
-	[0x64] = KC_PRTSCR,
-
-	[0x70] = KC_INSERT,
-	[0x6c] = KC_HOME,
-	[0x7d] = KC_PAGE_UP,
-
-	[0x71] = KC_DELETE,
-	[0x69] = KC_END,
-	[0x7a] = KC_PAGE_DOWN,
-
-	[0x75] = KC_UP,
-	[0x6b] = KC_LEFT,
-	[0x72] = KC_DOWN,
-	[0x74] = KC_RIGHT,
-
-	[0x4a] = KC_NSLASH,
-	[0x5a] = KC_NENTER
-};
-
-int kbd_ctl_init(void)
-{
-	ds = ds_s;
-	return 0;
-}
-
-void kbd_ctl_parse_scancode(int scancode)
-{
-	static int key_release_flag = 0;
-	static int is_locked = 0;
-	console_ev_type_t type;
-	unsigned int key;
-	int *map;
-	size_t map_length;
-
-	if (scancode == 0xe0) {
-		ds = ds_e;
-		return;
-	}
-
-	switch (ds) {
-	case ds_s:
-		map = scanmap_simple;
-		map_length = sizeof(scanmap_simple) / sizeof(int);
-		break;
-	case ds_e:
-		map = scanmap_e0;
-		map_length = sizeof(scanmap_e0) / sizeof(int);
-		break;
-	default:
-		map = NULL;
-		map_length = 0;
-	}
-
-	ds = ds_s;
-	if (scancode == 0xf0) {
-		key_release_flag = 1;
-		return;
-	} else {
-		if (key_release_flag) {
-			type = KEY_RELEASE;
-			key_release_flag = 0;
-			if (is_lock_key(scancode)) {
-				if (!is_locked) {
-					is_locked = 1;
-				} else {
-					is_locked = 0;
-					return;
-				}
-			}
-		} else {
-			if (is_lock_key(scancode) && is_locked)
-				return;
-			type = KEY_PRESS;
-		}
-	}
-
-	if (scancode < 0)
-		return;
-
-	key = map[scancode];
-	if (key != 0)
-		kbd_push_ev(type, key);
-}
-
-static bool is_lock_key(int sc)
-{
-	return ((sc == PL050_CAPS_SCAN_CODE) || (sc == PL050_NUM_SCAN_CODE) ||
-	    (sc == PL050_SCROLL_SCAN_CODE));
-}
-
-void kbd_ctl_set_ind(unsigned mods)
-{
-	(void) mods;
-}
-
-/**
- * @}
- */ 
Index: uspace/srv/hid/kbd/generic/kbd.c
===================================================================
--- uspace/srv/hid/kbd/generic/kbd.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hid/kbd/generic/kbd.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -67,6 +67,6 @@
 static unsigned lock_keys;
 
-int cir_service = 0;
-int cir_phone = -1;
+bool irc_service = false;
+int irc_phone = -1;
 
 #define NUM_LAYOUTS 3
@@ -216,12 +216,11 @@
 	sysarg_t obio;
 	
-	if ((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
-		cir_service = SERVICE_FHC;
-	else if ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio))
-		cir_service = SERVICE_OBIO;
-	
-	if (cir_service) {
-		while (cir_phone < 0)
-			cir_phone = service_connect_blocking(cir_service, 0, 0);
+	if (((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
+	    || ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio)))
+		irc_service = true;
+	
+	if (irc_service) {
+		while (irc_phone < 0)
+			irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
 	}
 	
Index: uspace/srv/hid/kbd/include/kbd.h
===================================================================
--- uspace/srv/hid/kbd/include/kbd.h	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hid/kbd/include/kbd.h	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -38,6 +38,8 @@
 #define KBD_KBD_H_
 
-extern int cir_service;
-extern int cir_phone;
+#include <bool.h>
+
+extern bool irc_service;
+extern int irc_phone;
 
 extern void kbd_push_scancode(int);
Index: uspace/srv/hid/kbd/port/ns16550.c
===================================================================
--- uspace/srv/hid/kbd/port/ns16550.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hid/kbd/port/ns16550.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -120,6 +120,6 @@
 	kbd_push_scancode(scan_code);
 	
-	if (cir_service)
-		async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
+	if (irc_service)
+		async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
 		    IPC_GET_IMETHOD(*call));
 }
Index: uspace/srv/hid/kbd/port/z8530.c
===================================================================
--- uspace/srv/hid/kbd/port/z8530.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hid/kbd/port/z8530.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -108,6 +108,6 @@
 	kbd_push_scancode(scan_code);
 	
-	if (cir_service)
-		async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
+	if (irc_service)
+		async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
 		    IPC_GET_IMETHOD(*call));
 }
Index: uspace/srv/hw/irc/apic/apic.c
===================================================================
--- uspace/srv/hw/irc/apic/apic.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hw/irc/apic/apic.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -54,6 +54,4 @@
 #define NAME  "apic"
 
-static bool apic_found = false;
-
 static int apic_enable_irq(sysarg_t irq)
 {
@@ -81,15 +79,5 @@
 		callid = async_get_call(&call);
 		
-		sysarg_t method = IPC_GET_IMETHOD(call);
-		if (method == IPC_M_PHONE_HUNGUP) {
-			return;
-		}
-
-		if (!apic_found) {
-			async_answer_0(callid, ENOTSUP);
-			break;
-		}
-
-		switch (method) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IRC_ENABLE_INTERRUPT:
 			async_answer_0(callid, apic_enable_irq(IPC_GET_ARG1(call)));
@@ -109,15 +97,17 @@
  *
  */
-static void apic_init(void)
+static bool apic_init(void)
 {
 	sysarg_t apic;
 	
-	apic_found = sysinfo_get_value("apic", &apic) && apic;
-	if (!apic_found) {
-		printf(NAME ": Warning: no APIC found\n");
+	if ((sysinfo_get_value("apic", &apic) != EOK) || (!apic)) {
+		printf(NAME ": No APIC found\n");
+		return false;
 	}
 	
 	async_set_client_connection(apic_connection);
-	service_register(SERVICE_APIC);
+	service_register(SERVICE_IRC);
+	
+	return true;
 }
 
@@ -126,6 +116,7 @@
 	printf(NAME ": HelenOS APIC driver\n");
 	
-	apic_init();
-
+	if (!apic_init())
+		return -1;
+	
 	printf(NAME ": Accepting connections\n");
 	async_manager();
Index: uspace/srv/hw/irc/fhc/fhc.c
===================================================================
--- uspace/srv/hw/irc/fhc/fhc.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hw/irc/fhc/fhc.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -136,5 +136,5 @@
 	
 	async_set_client_connection(fhc_connection);
-	service_register(SERVICE_FHC);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/irc/i8259/i8259.c
===================================================================
--- uspace/srv/hw/irc/i8259/i8259.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hw/irc/i8259/i8259.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -149,5 +149,5 @@
 	
 	async_set_client_connection(i8259_connection);
-	service_register(SERVICE_I8259);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/irc/obio/obio.c
===================================================================
--- uspace/srv/hw/irc/obio/obio.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hw/irc/obio/obio.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -137,5 +137,5 @@
 	
 	async_set_client_connection(obio_connection);
-	service_register(SERVICE_OBIO);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/netif/ne2000/ne2000.c
===================================================================
--- uspace/srv/hw/netif/ne2000/ne2000.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/hw/netif/ne2000/ne2000.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -75,5 +75,5 @@
 #define IRQ_GET_TSR(call)  ((int) IPC_GET_ARG3(call))
 
-static int irc_service = 0;
+static bool irc_service = false;
 static int irc_phone = -1;
 
@@ -383,12 +383,11 @@
 	sysarg_t i8259;
 	
-	if ((sysinfo_get_value("apic", &apic) == EOK) && (apic))
-		irc_service = SERVICE_APIC;
-	else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))
-		irc_service = SERVICE_I8259;
+	if (((sysinfo_get_value("apic", &apic) == EOK) && (apic))
+	    || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)))
+		irc_service = true;
 	
 	if (irc_service) {
 		while (irc_phone < 0)
-			irc_phone = service_connect_blocking(irc_service, 0, 0);
+			irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
 	}
 	
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/net/net/net.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -289,12 +289,15 @@
 	if (rc != EOK)
 		return rc;
+	
 	rc = add_module(NULL, &net_globals.modules, (uint8_t *) NE2000_NAME,
 	    (uint8_t *) NE2000_FILENAME, SERVICE_NE2000, 0, connect_to_service);
 	if (rc != EOK)
 		return rc;
+	
 	rc = add_module(NULL, &net_globals.modules, (uint8_t *) ETHERNET_NAME,
 	    (uint8_t *) ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service);
 	if (rc != EOK)
 		return rc;
+	
 	rc = add_module(NULL, &net_globals.modules, (uint8_t *) NILDUMMY_NAME,
 	    (uint8_t *) NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service);
@@ -590,10 +593,9 @@
 		rc = start_device(netif);
 		if (rc != EOK) {
-			printf("%s: Error starting interface %s (%s)\n", NAME,
+			printf("%s: Ignoring failed interface %s (%s)\n", NAME,
 			    netif->name, str_error(rc));
 			measured_strings_destroy(&netif->configuration);
 			netifs_exclude_index(&net_globals.netifs, index);
-			
-			return rc;
+			continue;
 		}
 		
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ uspace/srv/vfs/vfs_ops.c	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -1234,4 +1234,5 @@
 	if (!parentc) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, rc);
 		free(old);
@@ -1251,4 +1252,5 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, rc);
 		free(old);
@@ -1261,4 +1263,5 @@
 	    (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, EXDEV);	/* different file systems */
 		free(old);
@@ -1279,4 +1282,5 @@
 		if (!new_node) {
 			fibril_rwlock_write_unlock(&namespace_rwlock);
+			vfs_node_put(old_node);
 			async_answer_0(rid, ENOMEM);
 			free(old);
@@ -1290,4 +1294,5 @@
 	default:
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, ENOTEMPTY);
 		free(old);
@@ -1300,4 +1305,5 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		if (new_node)
 			vfs_node_put(new_node);
Index: version
===================================================================
--- version	(revision b330b30992d41a4f6eadbdc16f917a8f403439fb)
+++ version	(revision 51e56082eec8e027a6c98fab13db059785df9728)
@@ -37,5 +37,5 @@
 VERSION = 0
 PATCHLEVEL = 4
-SUBLEVEL = 2
+SUBLEVEL = 3
 
 ifdef EXTRAVERSION
@@ -45,3 +45,3 @@
 endif
 
-NAME = Skewer
+NAME = Sashimi
