Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ HelenOS.config	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -417,7 +417,4 @@
 ! [(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)
@@ -535,10 +532,4 @@
 ! [CONFIG_BUILD_SHARED_LIBS=n] CONFIG_USE_SHARED_LIBS (n)
 
-% Run devman on startup
-! CONFIG_START_DEVMAN (y/n)
-
-% Launch (devman) test drivers
-! [CONFIG_START_DEVMAN=y&CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
-
 % Load disk drivers on startup
 ! CONFIG_START_BD (n/y)
@@ -561,2 +552,6 @@
 % Line debugging information
 ! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y)
+
+% Launch (devman) test drivers
+! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
+
Index: defaults/arm32/gta02/Makefile.config
===================================================================
--- defaults/arm32/gta02/Makefile.config	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ defaults/arm32/gta02/Makefile.config	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -4,2 +4,11 @@
 # RAM disk format
 RDFMT = tmpfs
+
+# Support for userspace debuggers
+CONFIG_UDEBUG = n
+
+# Compile kernel tests
+CONFIG_TEST = n
+
+# Barebone build with essential binaries only
+CONFIG_BAREBONE = y
Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/Makefile	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -240,5 +240,4 @@
 	generic/src/lib/func.c \
 	generic/src/lib/memstr.c \
-	generic/src/lib/memfnc.c \
 	generic/src/lib/sort.c \
 	generic/src/lib/str.c \
Index: kernel/arch/abs32le/include/memstr.h
===================================================================
--- kernel/arch/abs32le/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/abs32le/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * 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 abs32le
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_abs32le_MEMSTR_H_
+#define KERN_abs32le_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)   _memcpy((dst), (src), (cnt))
+#define memsetb(dst, cnt, val)  _memsetb((dst), (cnt), (val))
+#define memsetw(dst, cnt, val)  _memsetw((dst), (cnt), (val))
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/amd64/Makefile.inc	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -33,22 +33,5 @@
 
 FPU_NO_CFLAGS = -mno-sse -mno-sse2
-
-#
-# FIXME:
-#
-# The -fno-optimize-sibling-calls should be removed as soon as a bug
-# in GCC concerning the "large" memory model and tail call optimization
-# is fixed.
-#
-# If GCC generates a code for tail call, instead of generating ..
-#
-#   jmp *fnc
-#
-# it generates an assembly code with an illegal immediate prefix:
-#
-#   jmp *$fnc
-#
-
-CMN1 = -m64 -mcmodel=large -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer -fno-optimize-sibling-calls
+CMN1 = -m64 -mcmodel=large -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
 GCC_CFLAGS += $(CMN1)
 ICC_CFLAGS += $(CMN1)
Index: kernel/arch/amd64/_link.ld.in
===================================================================
--- kernel/arch/amd64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/amd64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -26,10 +26,10 @@
 	.mapped (PA2KA(BOOT_OFFSET)+SIZEOF(.unmapped)) : AT (SIZEOF(.unmapped)) {
 		ktext_start = .;
-		*(.text .text.*);
+		*(.text);
 		ktext_end = .;
 		
 		kdata_start = .;
-		*(.data);              /* initialized data */
-		*(.rodata .rodata.*);  /* string literals */
+		*(.data);       /* initialized data */
+		*(.rodata*);    /* string literals */
 		hardcoded_load_address = .;
 		QUAD(PA2KA(BOOT_OFFSET));
Index: kernel/arch/amd64/include/memstr.h
===================================================================
--- kernel/arch/amd64/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/amd64/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 amd64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_amd64_MEMSTR_H_
+#define KERN_amd64_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/amd64/src/asm.S
===================================================================
--- kernel/arch/amd64/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/amd64/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -37,4 +37,7 @@
 .global read_efer_flag
 .global set_efer_flag
+.global memsetb
+.global memsetw
+.global memcpy
 .global memcpy_from_uspace
 .global memcpy_to_uspace
@@ -43,4 +46,12 @@
 .global early_putchar
 
+/* Wrapper for generic memsetb */
+memsetb:
+	jmp _memsetb
+
+/* Wrapper for generic memsetw */
+memsetw:
+	jmp _memsetw
+
 #define MEMCPY_DST   %rdi
 #define MEMCPY_SRC   %rsi
@@ -63,4 +74,5 @@
  *
  */
+memcpy:
 memcpy_from_uspace:
 memcpy_to_uspace:
Index: kernel/arch/arm32/include/memstr.h
===================================================================
--- kernel/arch/arm32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/arm32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 arm32
+ * @{
+ */
+/** @file
+ *  @brief Memory manipulating functions declarations.
+ */
+
+#ifndef KERN_arm32_MEMSTR_H_
+#define KERN_arm32_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/arm32/src/asm.S
===================================================================
--- kernel/arch/arm32/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/arm32/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -29,4 +29,7 @@
 .text
 
+.global memsetb
+.global memsetw
+.global memcpy
 .global memcpy_from_uspace
 .global memcpy_to_uspace
@@ -35,4 +38,11 @@
 .global early_putchar
 
+memsetb:
+	b _memsetb
+
+memsetw:
+	b _memsetw
+
+memcpy:
 memcpy_from_uspace:
 memcpy_to_uspace:
Index: kernel/arch/arm32/src/exception.c
===================================================================
--- kernel/arch/arm32/src/exception.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/arm32/src/exception.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -35,4 +35,5 @@
 
 #include <arch/exception.h>
+#include <arch/memstr.h>
 #include <arch/regutils.h>
 #include <arch/machine_func.h>
Index: kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
===================================================================
--- kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -292,5 +292,5 @@
 		.y = 480,
 		.scan = 2560,
-		.visual = VISUAL_RGB_8_8_8_0,
+		.visual = VISUAL_BGR_0_8_8_8,
 	};
 	
Index: kernel/arch/ia32/_link.ld.in
===================================================================
--- kernel/arch/ia32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ia32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -25,10 +25,10 @@
 	.mapped (PA2KA(BOOT_OFFSET)+SIZEOF(.unmapped)): AT (SIZEOF(.unmapped)) { 
 		ktext_start = .;
-		*(.text .text.*);
+		*(.text);
 		ktext_end = .;
 		
 		kdata_start = .;
 		*(.data);               /* initialized data */
-		*(.rodata .rodata.*);   /* string literals */
+		*(.rodata*);            /* string literals */
 		*(COMMON);              /* global variables */
 		hardcoded_load_address = .;
Index: kernel/arch/ia32/include/memstr.h
===================================================================
--- kernel/arch/ia32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/ia32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 ia32
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_ia32_MEMSTR_H_
+#define KERN_ia32_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/ia32/src/asm.S
===================================================================
--- kernel/arch/ia32/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ia32/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -38,4 +38,7 @@
 .global paging_on
 .global enable_l_apic_in_msr
+.global memsetb
+.global memsetw
+.global memcpy
 .global memcpy_from_uspace
 .global memcpy_from_uspace_failover_address
@@ -44,4 +47,12 @@
 .global early_putchar
 
+/* Wrapper for generic memsetb */
+memsetb:
+	jmp _memsetb
+
+/* Wrapper for generic memsetw */
+memsetw:
+	jmp _memsetw
+
 #define MEMCPY_DST   4
 #define MEMCPY_SRC   8
@@ -63,4 +74,5 @@
  *
  */
+memcpy:
 memcpy_from_uspace:
 memcpy_to_uspace:
Index: kernel/arch/ia32/src/cpu/cpu.c
===================================================================
--- kernel/arch/ia32/src/cpu/cpu.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ia32/src/cpu/cpu.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -92,4 +92,5 @@
 void cpu_arch_init(void)
 {
+	cpuid_extended_feature_info efi;
 	cpu_info_t info;
 	uint32_t help = 0;
@@ -103,4 +104,5 @@
 	
 	CPU->arch.fi.word = info.cpuid_edx;
+	efi.word = info.cpuid_ecx;
 	
 	if (CPU->arch.fi.bits.fxsr)
Index: kernel/arch/ia64/_link.ld.in
===================================================================
--- kernel/arch/ia64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ia64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -16,5 +16,5 @@
 		ktext_start = .;
 		*(K_TEXT_START);
-		*(.text .text.*)
+		*(.text)
 		ktext_end = .;
 		
@@ -36,14 +36,15 @@
 		*(.bss)
 		*(COMMON);
-		
+
 		. = ALIGN(8);
-		symbol_table = .;
-		*(symtab.*);            /* Symbol table, must be LAST symbol!*/
-		
+                symbol_table = .;
+                *(symtab.*);            /* Symbol table, must be LAST symbol!*/
+
 		kdata_end = .;
 	}
-	
+
 	/DISCARD/ : {
 		*(*);
 	}
+
 }
Index: kernel/arch/ia64/include/memstr.h
===================================================================
--- kernel/arch/ia64/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/ia64/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 ia64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_ia64_MEMSTR_H_
+#define KERN_ia64_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/ia64/src/asm.S
===================================================================
--- kernel/arch/ia64/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ia64/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -30,4 +30,5 @@
 
 .text
+.global memcpy
 .global memcpy_from_uspace
 .global memcpy_to_uspace
@@ -38,6 +39,5 @@
  *
  * This memcpy() has been taken from the assembler output of
- * a plain C implementation of memcpy() modified to have the
- * failover part.
+ * the generic _memcpy() and modified to have the failover part.
  *
  * @param in0 Destination address.
@@ -46,4 +46,5 @@
  *
  */
+memcpy:
 memcpy_from_uspace:
 memcpy_to_uspace:
@@ -140,4 +141,12 @@
 	br.ret.sptk.many rp
 
+.global memsetb
+memsetb:
+	br _memsetb
+
+.global memsetw
+memsetw:
+	br _memsetw
+
 .global cpu_halt
 cpu_halt:
Index: kernel/arch/ia64/src/mm/tlb.c
===================================================================
--- kernel/arch/ia64/src/mm/tlb.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ia64/src/mm/tlb.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -475,8 +475,12 @@
 void alternate_instruction_tlb_fault(uint64_t vector, istate_t *istate)
 {
+	region_register_t rr;
+	rid_t rid;
 	uintptr_t va;
 	pte_t *t;
 	
 	va = istate->cr_ifa; /* faulting address */
+	rr.word = rr_read(VA2VRN(va));
+	rid = rr.map.rid;
 	
 	page_table_lock(AS, true);
@@ -645,8 +649,12 @@
 void data_dirty_bit_fault(uint64_t vector, istate_t *istate)
 {
+	region_register_t rr;
+	rid_t rid;
 	uintptr_t va;
 	pte_t *t;
 	
 	va = istate->cr_ifa;  /* faulting address */
+	rr.word = rr_read(VA2VRN(va));
+	rid = rr.map.rid;
 	
 	page_table_lock(AS, true);
@@ -678,8 +686,12 @@
 void instruction_access_bit_fault(uint64_t vector, istate_t *istate)
 {
+	region_register_t rr;
+	rid_t rid;
 	uintptr_t va;
 	pte_t *t;
 	
 	va = istate->cr_ifa;  /* faulting address */
+	rr.word = rr_read(VA2VRN(va));
+	rid = rr.map.rid;
 	
 	page_table_lock(AS, true);
@@ -711,8 +723,12 @@
 void data_access_bit_fault(uint64_t vector, istate_t *istate)
 {
+	region_register_t rr;
+	rid_t rid;
 	uintptr_t va;
 	pte_t *t;
 	
 	va = istate->cr_ifa;  /* faulting address */
+	rr.word = rr_read(VA2VRN(va));
+	rid = rr.map.rid;
 	
 	page_table_lock(AS, true);
@@ -744,8 +760,12 @@
 void data_access_rights_fault(uint64_t vector, istate_t *istate)
 {
+	region_register_t rr;
+	rid_t rid;
 	uintptr_t va;
 	pte_t *t;
 	
 	va = istate->cr_ifa;  /* faulting address */
+	rr.word = rr_read(VA2VRN(va));
+	rid = rr.map.rid;
 	
 	/*
@@ -772,8 +792,12 @@
 void page_not_present(uint64_t vector, istate_t *istate)
 {
+	region_register_t rr;
+	rid_t rid;
 	uintptr_t va;
 	pte_t *t;
 	
 	va = istate->cr_ifa;  /* faulting address */
+	rr.word = rr_read(VA2VRN(va));
+	rid = rr.map.rid;
 	
 	page_table_lock(AS, true);
Index: kernel/arch/mips32/include/cp0.h
===================================================================
--- kernel/arch/mips32/include/cp0.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/mips32/include/cp0.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -70,5 +70,5 @@
   { \
       uint32_t retval; \
-      asm volatile ("mfc0 %0, $" #reg : "=r"(retval)); \
+      asm("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 volatile ("mtc0 %0, $" #reg : : "r"(val) ); \
+    asm("mtc0 %0, $" #reg : : "r"(val) ); \
  }
 
Index: kernel/arch/mips32/include/memstr.h
===================================================================
--- kernel/arch/mips32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/mips32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 mips32
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_mips32_MEMSTR_H_
+#define KERN_mips32_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/mips32/src/asm.S
===================================================================
--- kernel/arch/mips32/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/mips32/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -57,8 +57,20 @@
 	nop
 
+.global memsetb
+memsetb:
+	j _memsetb
+	nop
+
+.global memsetw
+memsetw:
+	j _memsetw
+	nop
+
+.global memcpy
 .global memcpy_from_uspace
 .global memcpy_to_uspace
 .global memcpy_from_uspace_failover_address
 .global memcpy_to_uspace_failover_address
+memcpy:
 memcpy_from_uspace:
 memcpy_to_uspace:
Index: kernel/arch/ppc32/_link.ld.in
===================================================================
--- kernel/arch/ppc32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ppc32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -36,5 +36,6 @@
 		kdata_start = .;
 		*(K_DATA_START);
-		*(.rodata .rodata.*);
+		*(.rodata);
+		*(.rodata.*);
 		*(.data);       /* initialized data */
 		*(.sdata);
Index: kernel/arch/ppc32/include/memstr.h
===================================================================
--- kernel/arch/ppc32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/ppc32/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 ppc32
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_ppc32_MEMSTR_H_
+#define KERN_ppc32_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/ppc32/src/asm.S
===================================================================
--- kernel/arch/ppc32/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/ppc32/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -35,4 +35,7 @@
 .global iret
 .global iret_syscall
+.global memsetb
+.global memsetw
+.global memcpy
 .global memcpy_from_uspace
 .global memcpy_to_uspace
@@ -205,4 +208,11 @@
 	rfi
 
+memsetb:
+	b _memsetb
+
+memsetw:
+	b _memsetw
+
+memcpy:
 memcpy_from_uspace:
 memcpy_to_uspace:
Index: kernel/arch/sparc64/_link.ld.in
===================================================================
--- kernel/arch/sparc64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -15,10 +15,11 @@
 		ktext_start = .;
 		*(K_TEXT_START)
-		*(.text .text.*);
+		*(.text);
 		ktext_end = .;
 		
 		kdata_start = .;
 		*(K_DATA_START)
-		*(.rodata .rodata.*);
+		*(.rodata);
+		*(.rodata.*);
 		*(.data);                   /* initialized data */
 		*(.sdata);
Index: kernel/arch/sparc64/include/memstr.h
===================================================================
--- kernel/arch/sparc64/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/arch/sparc64/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Sergey Bondari
+ * 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 sparc64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_sparc64_MEMSTR_H_
+#define KERN_sparc64_MEMSTR_H_
+
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
+
+extern void memsetw(void *, size_t, uint16_t);
+extern void memsetb(void *, size_t, uint8_t);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/sparc64/src/asm.S
===================================================================
--- kernel/arch/sparc64/src/asm.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/src/asm.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -36,4 +36,78 @@
 
 /*
+ * This is the assembly language version of our _memcpy() generated by gcc.
+ */
+.global memcpy
+memcpy:
+	mov %o0, %o3  /* save dst */
+	add %o1, 7, %g1
+	and %g1, -8, %g1
+	cmp %o1, %g1
+	be,pn %xcc, 3f
+	add %o0, 7, %g1
+	mov 0, %g3
+	
+	0:
+	
+		brz,pn %o2, 2f
+		mov 0, %g2
+	
+	1:
+	
+		ldub [%g3 + %o1], %g1
+		add %g2, 1, %g2
+		cmp %o2, %g2
+		stb %g1, [%g3 + %o0]
+		bne,pt %xcc, 1b
+		mov %g2, %g3
+	
+	2:
+	
+		jmp %o7 + 8  /* exit point */
+		mov %o3, %o0
+	
+	3:
+	
+		and %g1, -8, %g1
+		cmp %o0, %g1
+		bne,pt %xcc, 0b
+		mov 0, %g3
+		srlx %o2, 3, %g4
+		brz,pn %g4, 5f
+		mov 0, %g5
+	
+	4:
+	
+		sllx %g3, 3, %g2
+		add %g5, 1, %g3
+		ldx [%o1 + %g2], %g1
+		mov %g3, %g5
+		cmp %g4, %g3
+		bne,pt %xcc, 4b
+		stx %g1, [%o0 + %g2]
+	
+	5:
+	
+		and %o2, 7, %o2
+		brz,pn %o2, 2b
+		sllx %g4, 3, %g1
+		mov 0, %g2
+		add %g1, %o0, %o0
+		add %g1, %o1, %g4
+		mov 0, %g3
+	
+	6:
+	
+		ldub [%g2 + %g4], %g1
+		stb %g1, [%g2 + %o0]
+		add %g3, 1, %g2
+		cmp %o2, %g2
+		bne,pt %xcc, 6b
+		mov %g2, %g3
+		
+		jmp %o7 + 8  /* exit point */
+		mov %o3, %o0
+
+/*
  * Almost the same as memcpy() except the loads are from userspace.
  */
@@ -190,4 +264,14 @@
 	mov %g0, %o0  /* return 0 on failure */
 
+.global memsetb
+memsetb:
+	ba %xcc, _memsetb
+	nop
+
+.global memsetw
+memsetw:
+	ba %xcc, _memsetw
+	nop
+
 .global early_putchar
 early_putchar:
Index: kernel/arch/sparc64/src/mm/sun4u/as.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/as.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/src/mm/sun4u/as.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -43,4 +43,5 @@
 
 #include <arch/mm/tsb.h>
+#include <arch/memstr.h>
 #include <arch/asm.h>
 #include <mm/frame.h>
Index: kernel/arch/sparc64/src/mm/sun4v/as.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/as.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/src/mm/sun4v/as.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -46,4 +46,5 @@
 
 #include <arch/mm/tsb.h>
+#include <arch/memstr.h>
 #include <arch/asm.h>
 #include <mm/frame.h>
Index: kernel/arch/sparc64/src/smp/sun4v/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -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 = %" PRIu64 ") timed out\n",
+		printf("%s: waiting for processor (cpuid = %" PRIu32 ") timed out\n",
 		    __func__, cpuid);
 	
Index: kernel/arch/sparc64/src/sun4v/start.S
===================================================================
--- kernel/arch/sparc64/src/sun4v/start.S	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/src/sun4v/start.S	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -296,5 +296,5 @@
 	 * Create the first stack frame.
 	 */
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
+	save %sp, -(STACK_WINDWO_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 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -111,5 +111,5 @@
 			((void (*)(void)) data1)();
 		} else {
-			printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n",
+			printf("Spurious interrupt on %d, data = %" PRIx64 ".\n",
 			    CPU->arch.id, data1);
 		}
Index: kernel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/Makefile.inc	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -122,4 +122,10 @@
 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: kernel/genarch/src/drivers/via-cuda/cuda.c
===================================================================
--- kernel/genarch/src/drivers/via-cuda/cuda.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/src/drivers/via-cuda/cuda.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -239,9 +239,9 @@
 	cuda_instance_t *instance = irq->instance;
 	cuda_t *dev = instance->cuda;
-	uint8_t b;
-	
+	uint8_t data, b;
+
 	b = pio_read_8(&dev->b);
-	pio_read_8(&dev->sr);
-	
+	data = pio_read_8(&dev->sr);
+
 	if ((b & TREQ) == 0) {
 		instance->xstate = cx_receive;
@@ -251,7 +251,7 @@
 		cuda_send_start(instance);
 	}
-	
-	memcpy(buf, instance->rcv_buf, instance->bidx);
-	*len = instance->bidx;
+
+        memcpy(buf, instance->rcv_buf, instance->bidx);
+        *len = instance->bidx;
 	instance->bidx = 0;
 }
Index: kernel/genarch/src/kbrd/kbrd_pl050.c
===================================================================
--- kernel/genarch/src/kbrd/kbrd_pl050.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/genarch/src/kbrd/kbrd_pl050.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,209 @@
+/*
+ * 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: kernel/genarch/src/kbrd/scanc_pl050.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_pl050.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ kernel/genarch/src/kbrd/scanc_pl050.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,234 @@
+/*
+ * 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: kernel/genarch/src/ofw/ebus.c
===================================================================
--- kernel/genarch/src/ofw/ebus.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/src/ofw/ebus.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -39,4 +39,5 @@
 #include <genarch/ofw/ebus.h>
 #include <genarch/ofw/pci.h>
+#include <arch/memstr.h>
 #include <str.h>
 #include <panic.h>
Index: kernel/genarch/src/ofw/fhc.c
===================================================================
--- kernel/genarch/src/ofw/fhc.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/src/ofw/fhc.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -39,4 +39,5 @@
 #include <genarch/ofw/fhc.h>
 #include <arch/drivers/fhc.h>
+#include <arch/memstr.h>
 #include <str.h>
 #include <panic.h>
Index: kernel/genarch/src/ofw/ofw_tree.c
===================================================================
--- kernel/genarch/src/ofw/ofw_tree.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/src/ofw/ofw_tree.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -37,6 +37,6 @@
 
 #include <genarch/ofw/ofw_tree.h>
+#include <arch/memstr.h>
 #include <mm/slab.h>
-#include <memstr.h>
 #include <str.h>
 #include <panic.h>
Index: kernel/genarch/src/ofw/pci.c
===================================================================
--- kernel/genarch/src/ofw/pci.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/src/ofw/pci.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -40,4 +40,5 @@
 #include <arch/drivers/pci.h>
 #include <arch/trap/interrupt.h>
+#include <arch/memstr.h>
 #include <str.h>
 #include <panic.h>
Index: kernel/genarch/src/ofw/upa.c
===================================================================
--- kernel/genarch/src/ofw/upa.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/genarch/src/ofw/upa.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -38,4 +38,5 @@
 #include <genarch/ofw/ofw_tree.h>
 #include <genarch/ofw/upa.h>
+#include <arch/memstr.h>
 #include <func.h>
 #include <panic.h>
Index: rnel/generic/include/lib/memfnc.h
===================================================================
--- kernel/generic/include/lib/memfnc.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * 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_LIB_MEMFNC_H_
-#define KERN_LIB_MEMFNC_H_
-
-#include <typedefs.h>
-
-extern void *memset(void *, int, size_t);
-extern void *memcpy(void *, const void *, size_t);
-
-#endif
-
-/** @}
- */
Index: kernel/generic/include/memstr.h
===================================================================
--- kernel/generic/include/memstr.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/generic/include/memstr.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -37,11 +37,13 @@
 
 #include <typedefs.h>
+#include <arch/memstr.h>
 
-#define memset(dst, val, cnt)  __builtin_memset((dst), (val), (cnt))
-#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
-
-extern void memsetb(void *, size_t, uint8_t);
-extern void memsetw(void *, size_t, uint16_t);
-extern void *memmove(void *, const void *, size_t);
+/*
+ * Architecture independent variants.
+ */
+extern void *_memcpy(void *dst, const void *src, size_t cnt);
+extern void _memsetb(void *dst, size_t cnt, uint8_t x);
+extern void _memsetw(void *dst, size_t cnt, uint16_t x);
+extern void *memmove(void *dst, const void *src, size_t cnt);
 
 #endif
Index: rnel/generic/src/lib/memfnc.c
===================================================================
--- kernel/generic/src/lib/memfnc.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,91 +1,0 @@
-	/*
- * Copyright (c) 2011 Martin Decky
- * 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 Memory string functions.
- *
- * This file provides architecture independent functions to manipulate blocks
- * of memory. These functions are optimized as much as generic functions of
- * this type can be.
- */
-
-#include <lib/memfnc.h>
-#include <typedefs.h>
-
-/** Fill block of memory.
- *
- * Fill cnt bytes at dst address with the value val.
- *
- * @param dst Destination address to fill.
- * @param val Value to fill.
- * @param cnt Number of bytes to fill.
- *
- * @return Destination address.
- *
- */
-void *memset(void *dst, int val, size_t cnt)
-{
-	size_t i;
-	uint8_t *ptr = (uint8_t *) dst;
-	
-	for (i = 0; i < cnt; i++)
-		ptr[i] = val;
-	
-	return dst;
-}
-
-/** Move memory block without overlapping.
- *
- * Copy cnt bytes from src address to dst address. The source
- * and destination memory areas cannot overlap.
- *
- * @param dst Destination address to copy to.
- * @param src Source address to copy from.
- * @param cnt Number of bytes to copy.
- *
- * @return Destination address.
- *
- */
-void *memcpy(void *dst, const void *src, size_t cnt)
-{
-	uint8_t *dp = (uint8_t *) dst;
-	const uint8_t *sp = (uint8_t *) src;
-	
-	while (cnt-- != 0)
-			*dp++ = *sp++;
-	
-	return dst;
-}
-
-/** @}
- */
Index: kernel/generic/src/lib/memstr.c
===================================================================
--- kernel/generic/src/lib/memstr.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/generic/src/lib/memstr.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -28,5 +28,5 @@
  */
 
-/** @addtogroup generic
+/** @addtogroup generic	
  * @{
  */
@@ -34,90 +34,129 @@
 /**
  * @file
- * @brief Memory string operations.
+ * @brief	Memory string operations.
  *
- * This file provides architecture independent functions to manipulate blocks
- * of memory. These functions are optimized as much as generic functions of
- * this type can be.
+ * This file provides architecture independent functions to manipulate blocks of
+ * memory. These functions are optimized as much as generic functions of this
+ * type can be. However, architectures are free to provide even more optimized
+ * versions of these functions.
  */
 
 #include <memstr.h>
 #include <typedefs.h>
+#include <align.h>
 
-/** Fill block of memory.
+/** Copy block of memory.
  *
- * Fill cnt bytes at dst address with the value val.
+ * Copy cnt bytes from src address to dst address.  The copying is done
+ * word-by-word and then byte-by-byte.  The source and destination memory areas
+ * cannot overlap.
  *
- * @param dst Destination address to fill.
- * @param cnt Number of bytes to fill.
- * @param val Value to fill.
+ * @param src		Source address to copy from.
+ * @param dst		Destination address to copy to.
+ * @param cnt		Number of bytes to copy.
+ *
+ * @return		Destination address.
+ */
+void *_memcpy(void *dst, const void *src, size_t cnt)
+{
+	unsigned int i, j;
+	
+	if (ALIGN_UP((uintptr_t) src, sizeof(sysarg_t)) != (uintptr_t) src ||
+	    ALIGN_UP((uintptr_t) dst, sizeof(sysarg_t)) != (uintptr_t) dst) {
+		for (i = 0; i < cnt; i++)
+			((uint8_t *) dst)[i] = ((uint8_t *) src)[i];
+	} else { 
+		for (i = 0; i < cnt / sizeof(sysarg_t); i++)
+			((sysarg_t *) dst)[i] = ((sysarg_t *) src)[i];
+		
+		for (j = 0; j < cnt % sizeof(sysarg_t); j++)
+			((uint8_t *)(((sysarg_t *) dst) + i))[j] =
+			    ((uint8_t *)(((sysarg_t *) src) + i))[j];
+	}
+		
+	return (char *) dst;
+}
+
+/** Move memory block with possible overlapping.
+ *
+ * Copy cnt bytes from src address to dst address. The source and destination
+ * memory areas may overlap.
+ *
+ * @param src		Source address to copy from.
+ * @param dst		Destination address to copy to.
+ * @param cnt		Number of bytes to copy.
+ *
+ * @return		Destination address.
+ */
+void *memmove(void *dst, const void *src, size_t n)
+{
+	const uint8_t *sp;
+	uint8_t *dp;
+
+	/* Nothing to do? */
+	if (src == dst)
+		return dst;
+
+	/* Non-overlapping? */
+	if (dst >= src + n || src >= dst + n) {	
+		return memcpy(dst, src, n);
+	}
+
+	/* Which direction? */
+	if (src > dst) {
+		/* Forwards. */
+		sp = src;
+		dp = dst;
+
+		while (n-- != 0)
+			*dp++ = *sp++;
+	} else {
+		/* Backwards. */
+		sp = src + (n - 1);
+		dp = dst + (n - 1);
+
+		while (n-- != 0)
+			*dp-- = *sp--;
+	}
+
+	return dst;
+}
+
+/** Fill block of memory
+ *
+ * Fill cnt bytes at dst address with the value x.  The filling is done
+ * byte-by-byte.
+ *
+ * @param dst		Destination address to fill.
+ * @param cnt		Number of bytes to fill.
+ * @param x		Value to fill.
  *
  */
-void memsetb(void *dst, size_t cnt, uint8_t val)
+void _memsetb(void *dst, size_t cnt, uint8_t x)
 {
-	memset(dst, val, cnt);
+	unsigned int i;
+	uint8_t *p = (uint8_t *) dst;
+	
+	for (i = 0; i < cnt; i++)
+		p[i] = x;
 }
 
 /** Fill block of memory.
  *
- * Fill cnt words at dst address with the value val. The filling
- * is done word-by-word.
+ * Fill cnt words at dst address with the value x.  The filling is done
+ * word-by-word.
  *
- * @param dst Destination address to fill.
- * @param cnt Number of words to fill.
- * @param val Value to fill.
+ * @param dst		Destination address to fill.
+ * @param cnt		Number of words to fill.
+ * @param x		Value to fill.
  *
  */
-void memsetw(void *dst, size_t cnt, uint16_t val)
+void _memsetw(void *dst, size_t cnt, uint16_t x)
 {
-	size_t i;
-	uint16_t *ptr = (uint16_t *) dst;
+	unsigned int i;
+	uint16_t *p = (uint16_t *) dst;
 	
 	for (i = 0; i < cnt; i++)
-		ptr[i] = val;
-}
-
-/** Move memory block with possible overlapping.
- *
- * Copy cnt bytes from src address to dst address. The source
- * and destination memory areas may overlap.
- *
- * @param dst Destination address to copy to.
- * @param src Source address to copy from.
- * @param cnt Number of bytes to copy.
- *
- * @return Destination address.
- *
- */
-void *memmove(void *dst, const void *src, size_t cnt)
-{
-	/* Nothing to do? */
-	if (src == dst)
-		return dst;
-	
-	/* Non-overlapping? */
-	if ((dst >= src + cnt) || (src >= dst + cnt))
-		return memcpy(dst, src, cnt);
-	
-	uint8_t *dp;
-	const uint8_t *sp;
-	
-	/* Which direction? */
-	if (src > dst) {
-		/* Forwards. */
-		dp = dst;
-		sp = src;
-		
-		while (cnt-- != 0)
-			*dp++ = *sp++;
-	} else {
-		/* Backwards. */
-		dp = dst + (cnt - 1);
-		sp = src + (cnt - 1);
-		
-		while (cnt-- != 0)
-			*dp-- = *sp--;
-	}
-	
-	return dst;
+		p[i] = x;	
 }
 
Index: kernel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/generic/src/mm/backend_elf.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -91,11 +91,7 @@
 	if (!as_area_check_access(area, access))
 		return AS_PF_FAULT;
-	
-	if (addr < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
-		return AS_PF_FAULT;
-	
-	if (addr >= entry->p_vaddr + entry->p_memsz)
-		return AS_PF_FAULT;
-	
+
+	ASSERT((addr >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) &&
+	    (addr < entry->p_vaddr + entry->p_memsz));
 	i = (addr - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
 	base = (uintptr_t)
Index: kernel/tools/genmap.py
===================================================================
--- kernel/tools/genmap.py	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ kernel/tools/genmap.py	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -100,9 +100,8 @@
 			for addr, symbol in symbols:
 				value = fname + ':' + symbol
-				value_bytes = value.encode('ascii')
-				data = struct.pack(symtabfmt, addr + offset, value_bytes[:MAXSTRING])
+				data = struct.pack(symtabfmt, addr + offset, value[:MAXSTRING])
 				out.write(data)
 			
-	out.write(struct.pack(symtabfmt, 0, b''))
+	out.write(struct.pack(symtabfmt, 0, ''))
 
 def main():
Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ tools/autotool.py	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -501,5 +501,5 @@
 		cross_prefix = os.environ['CROSS_PREFIX']
 	else:
-		cross_prefix = "/usr/local/cross"
+		cross_prefix = "/usr/local"
 	
 	# Prefix binutils tools on Solaris
Index: tools/mkfat.py
===================================================================
--- tools/mkfat.py	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ tools/mkfat.py	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -211,6 +211,6 @@
 	dir_entry = xstruct.create(DIR_ENTRY)
 	
-	dir_entry.name = mangle_fname(name).encode('ascii')
-	dir_entry.ext = mangle_ext(name).encode('ascii')
+	dir_entry.name = mangle_fname(name)
+	dir_entry.ext = mangle_ext(name)
 	
 	if (directory):
@@ -239,6 +239,6 @@
 	
 	dir_entry.signature = 0x2e
-	dir_entry.name = b'       '
-	dir_entry.ext = b'   '
+	dir_entry.name = '       '
+	dir_entry.ext = '   '
 	dir_entry.attr = 0x10
 	
@@ -258,6 +258,6 @@
 	
 	dir_entry.signature = [0x2e, 0x2e]
-	dir_entry.name = b'      '
-	dir_entry.ext = b'   '
+	dir_entry.name = '      '
+	dir_entry.ext = '   '
 	dir_entry.attr = 0x10
 	
Index: tools/mkhord.py
===================================================================
--- tools/mkhord.py	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ tools/mkhord.py	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -84,5 +84,5 @@
 	payload_size_aligned = align_up(payload_size, align)
 	
-	header.tag = b"HORD"
+	header.tag = "HORD"
 	header.version = 1
 	header.encoding = HORD_LSB
Index: tools/mktmpfs.py
===================================================================
--- tools/mktmpfs.py	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ tools/mktmpfs.py	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -80,5 +80,5 @@
 			dentry.kind = TMPFS_FILE
 			dentry.fname_len = len(name)
-			dentry.fname = name.encode('ascii')
+			dentry.fname = name
 			dentry.flen = size
 			
@@ -97,5 +97,5 @@
 			dentry.kind = TMPFS_DIRECTORY
 			dentry.fname_len = len(name)
-			dentry.fname = name.encode('ascii')
+			dentry.fname = name
 			
 			outf.write(dentry.pack())
@@ -122,5 +122,5 @@
 	
 	header = xstruct.create(HEADER)
-	header.tag = b"TMPFS"
+	header.tag = "TMPFS"
 	
 	outf.write(header.pack())
Index: tools/toolchain.sh
===================================================================
--- tools/toolchain.sh	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ tools/toolchain.sh	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -52,13 +52,4 @@
 #endif
 EOF
-
-BINUTILS_VERSION="2.21"
-GCC_VERSION="4.6.0"
-
-BASEDIR="`pwd`"
-BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2"
-GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2"
-GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2"
-GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2"
 
 #
@@ -148,9 +139,8 @@
 	echo " sparc64    SPARC V9"
 	echo " all        build all targets"
-	echo " parallel   same as 'all', but in parallel"
 	echo
 	echo "The toolchain will be installed to the directory specified by"
 	echo "the CROSS_PREFIX environment variable. If the variable is not"
-	echo "defined, /usr/local/cross will be used by default."
+	echo "defined, /usr/local will be used by default."
 	echo
 	
@@ -204,5 +194,5 @@
 }
 
-download_fetch() {
+download_check() {
 	SOURCE="$1"
 	FILE="$2"
@@ -218,15 +208,4 @@
 }
 
-source_check() {
-	FILE="$1"
-	
-	if [ ! -f "${FILE}" ]; then
-		echo
-		echo "File ${FILE} not found."
-		
-		exit 4
-	fi
-}
-
 cleanup_dir() {
 	DIR="$1"
@@ -262,16 +241,25 @@
 }
 
-prepare() {
-	show_dependencies
-	check_dependecies
-	show_countdown 10
-	
-	BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
-	GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
-	
-	download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "c84c5acc9d266f1a7044b51c85a823f5"
-	download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "b1957f3209080b2f55bc3756d3a62b7c"
-	download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" "120d4675366ee82ea52f9ed65b57da04"
-	download_fetch "${GCC_SOURCE}" "${GCC_CPP}" "a30090fa655d0db4c970740d353c81f1"
+patch_binutils() {
+	PLATFORM="$1"
+	
+	if [ "${PLATFORM}" == "arm32" ] ; then
+		patch -p1 <<EOF
+diff -Naur binutils-2.20.orig/gas/config/tc-arm.c binutils-2.20/gas/config/tc-arm.c
+--- binutils-2.20.orig/gas/config/tc-arm.c	2009-08-30 00:10:59.000000000 +0200
++++ binutils-2.20/gas/config/tc-arm.c	2009-11-02 14:25:11.000000000 +0100
+@@ -2485,8 +2485,9 @@
+       know (frag->tc_frag_data.first_map == NULL);
+       frag->tc_frag_data.first_map = symbolP;
+     }
+-  if (frag->tc_frag_data.last_map != NULL)
++  if (frag->tc_frag_data.last_map != NULL) {
+     know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP));
++  }
+   frag->tc_frag_data.last_map = symbolP;
+ }
+EOF
+		check_error $? "Error patching binutils"
+	fi
 }
 
@@ -280,5 +268,16 @@
 	TARGET="$2"
 	
-	WORKDIR="${BASEDIR}/${PLATFORM}"
+	BINUTILS_VERSION="2.20"
+	GCC_VERSION="4.5.1"
+	
+	BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2"
+	GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2"
+	GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2"
+	GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2"
+	
+	BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+	GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+	
+	WORKDIR="`pwd`"
 	BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
 	GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
@@ -286,5 +285,5 @@
 	
 	if [ -z "${CROSS_PREFIX}" ] ; then
-		CROSS_PREFIX="/usr/local/cross"
+		CROSS_PREFIX="/usr/local"
 	fi
 	
@@ -292,12 +291,14 @@
 	
 	echo ">>> Downloading tarballs"
-	source_check "${BASEDIR}/${BINUTILS}"
-	source_check "${BASEDIR}/${GCC_CORE}"
-	source_check "${BASEDIR}/${GCC_OBJC}"
-	source_check "${BASEDIR}/${GCC_CPP}"
+	download_check "${BINUTILS_SOURCE}" "${BINUTILS}" "ee2d3e996e9a2d669808713360fa96f8"
+	download_check "${GCC_SOURCE}" "${GCC_CORE}" "dc8959e31b01a65ce10d269614815054"
+	download_check "${GCC_SOURCE}" "${GCC_OBJC}" "3c11b7037896e967eddf8178af2ddd98"
+	download_check "${GCC_SOURCE}" "${GCC_CPP}" "b294953ff0bb2f20c7acb2bf005d832a"
 	
 	echo ">>> Removing previous content"
 	cleanup_dir "${PREFIX}"
-	cleanup_dir "${WORKDIR}"
+	cleanup_dir "${OBJDIR}"
+	cleanup_dir "${BINUTILSDIR}"
+	cleanup_dir "${GCCDIR}"
 	
 	create_dir "${PREFIX}" "destination directory"
@@ -305,15 +306,13 @@
 	
 	echo ">>> Unpacking tarballs"
-	cd "${WORKDIR}"
-	check_error $? "Change directory failed."
-	
-	unpack_tarball "${BASEDIR}/${BINUTILS}" "binutils"
-	unpack_tarball "${BASEDIR}/${GCC_CORE}" "GCC Core"
-	unpack_tarball "${BASEDIR}/${GCC_OBJC}" "Objective C"
-	unpack_tarball "${BASEDIR}/${GCC_CPP}" "C++"
+	unpack_tarball "${BINUTILS}" "binutils"
+	unpack_tarball "${GCC_CORE}" "GCC Core"
+	unpack_tarball "${GCC_OBJC}" "Objective C"
+	unpack_tarball "${GCC_CPP}" "C++"
 	
 	echo ">>> Processing binutils (${PLATFORM})"
 	cd "${BINUTILSDIR}"
 	check_error $? "Change directory failed."
+	patch_binutils "${PLATFORM}"
 	
 	change_title "binutils: configure (${PLATFORM})"
@@ -337,9 +336,11 @@
 	check_error $? "Error compiling/installing GCC."
 	
-	cd "${BASEDIR}"
+	cd "${WORKDIR}"
 	check_error $? "Change directory failed."
 	
 	echo ">>> Cleaning up"
-	cleanup_dir "${WORKDIR}"
+	cleanup_dir "${OBJDIR}"
+	cleanup_dir "${BINUTILSDIR}"
+	cleanup_dir "${GCCDIR}"
 	
 	echo
@@ -351,50 +352,47 @@
 fi
 
+show_dependencies
+check_dependecies
+show_countdown 10
+
 case "$1" in
 	"amd64")
-		prepare
 		build_target "amd64" "amd64-linux-gnu"
 		;;
 	"arm32")
-		prepare
 		build_target "arm32" "arm-linux-gnu"
 		;;
 	"ia32")
-		prepare
 		build_target "ia32" "i686-pc-linux-gnu"
 		;;
 	"ia64")
-		prepare
 		build_target "ia64" "ia64-pc-linux-gnu"
 		;;
+	"ia64")
+		build_target "ia64" "ia64-pc-linux-gnu"
+		;;
 	"mips32")
-		prepare
 		build_target "mips32" "mipsel-linux-gnu"
 		;;
 	"mips32eb")
-		prepare
 		build_target "mips32eb" "mips-linux-gnu"
 		;;
 	"mips64")
-		prepare
 		build_target "mips64" "mips64el-linux-gnu"
 		;;
 	"ppc32")
-		prepare
 		build_target "ppc32" "ppc-linux-gnu"
 		;;
 	"ppc64")
-		prepare
 		build_target "ppc64" "ppc64-linux-gnu"
 		;;
 	"sparc64")
-		prepare
 		build_target "sparc64" "sparc64-linux-gnu"
 		;;
 	"all")
-		prepare
 		build_target "amd64" "amd64-linux-gnu"
 		build_target "arm32" "arm-linux-gnu"
 		build_target "ia32" "i686-pc-linux-gnu"
+		build_target "ia64" "ia64-pc-linux-gnu"
 		build_target "ia64" "ia64-pc-linux-gnu"
 		build_target "mips32" "mipsel-linux-gnu"
@@ -405,18 +403,4 @@
 		build_target "sparc64" "sparc64-linux-gnu"
 		;;
-	"parallel")
-		prepare
-		build_target "amd64" "amd64-linux-gnu" &
-		build_target "arm32" "arm-linux-gnu" &
-		build_target "ia32" "i686-pc-linux-gnu" &
-		build_target "ia64" "ia64-pc-linux-gnu" &
-		build_target "mips32" "mipsel-linux-gnu" &
-		build_target "mips32eb" "mips-linux-gnu" &
-		build_target "mips64" "mips64el-linux-gnu" &
-		build_target "ppc32" "ppc-linux-gnu" &
-		build_target "ppc64" "ppc64-linux-gnu" &
-		build_target "sparc64" "sparc64-linux-gnu" &
-		wait
-		;;
 	*)
 		show_usage
Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -1,4 +1,3 @@
 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com>
- * Copyright (c) 2011, Martin Sucha
  * All rights reserved.
  *
@@ -36,11 +35,4 @@
 #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"
@@ -56,12 +48,4 @@
 
 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[] = {
@@ -72,5 +56,4 @@
 	{ "buffer", required_argument, 0, 'b' },
 	{ "more", no_argument, 0, 'm' },
-	{ "hex", no_argument, 0, 'x' },
 	{ 0, 0, 0, 0 }
 };
@@ -92,5 +75,4 @@
 		"  -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);
@@ -100,71 +82,9 @@
 }
 
-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)
+static unsigned int cat_file(const char *fname, size_t blen)
 {
 	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);
@@ -173,4 +93,7 @@
 		return 1;
 	}
+
+	total = lseek(fd, 0, SEEK_END);
+	lseek(fd, 0, SEEK_SET);
 
 	if (NULL == (buff = (char *) malloc(blen + 1))) {
@@ -186,23 +109,8 @@
 			count += bytes;
 			buff[bytes] = '\0';
-			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);
-				}
-				
-			}
+			printf("%s", buff);
 			reads++;
 		}
-	} while (bytes > 0 && !should_quit);
+	} while (bytes > 0);
 
 	close(fd);
@@ -223,24 +131,9 @@
 	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, "xhvmH:t:b:", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "hvmH:t:b:", long_options, &opt_ind);
 		switch (c) {
 		case 'h':
@@ -251,18 +144,15 @@
 			return CMD_SUCCESS;
 		case 'H':
-			printf("%s", cat_oops);
+			printf(cat_oops);
 			return CMD_FAILURE;
 		case 't':
-			printf("%s", cat_oops);
+			printf(cat_oops);
 			return CMD_FAILURE;
 		case 'b':
-			printf("%s", cat_oops);
+			printf(cat_oops);
 			break;
 		case 'm':
-			more = true;
-			break;
-		case 'x':
-			hex = true;
-			break;
+			printf(cat_oops);
+			return CMD_FAILURE;
 		}
 	}
@@ -278,19 +168,7 @@
 	if (buffer <= 0)
 		buffer = CAT_DEFAULT_BUFLEN;
-	
-	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);
+	for (i = optind; argv[i] != NULL; i++)
+		ret += cat_file(argv[i], buffer);
 
 	if (ret)
Index: uspace/app/bdsh/cmds/modules/cat/cat.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -4,5 +4,5 @@
 /* Prototypes for the cat command, excluding entry points */
 
-static unsigned int cat_file(const char *, size_t, bool);
+static unsigned int cat_file(const char *, size_t);
 
 #endif /* CAT_H */
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -108,5 +108,4 @@
 	for (;;) {
 		ssize_t res;
-		size_t written = 0;
 
 		bytes = read(fd1, buff, blen);
@@ -121,8 +120,7 @@
 			 * returned less data than requested.
 			 */
-			bytes = write(fd2, buff + written, res);
+			bytes = write(fd2, buff, res);
 			if (bytes < 0)
 				goto err;
-			written += bytes;
 			res -= bytes;
 		} while (res > 0);
Index: uspace/app/bdsh/cmds/modules/ls/ls.c
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/bdsh/cmds/modules/ls/ls.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -38,9 +38,7 @@
 #include <dirent.h>
 #include <fcntl.h>
-#include <getopt.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <str.h>
-#include <sort.h>
 
 #include "errors.h"
@@ -48,160 +46,64 @@
 #include "util.h"
 #include "entry.h"
+#include "ls.h"
 #include "cmds.h"
-
-/* Various values that can be returned by ls_scope() */
-#define LS_BOGUS 0
-#define LS_FILE  1
-#define LS_DIR   2
-
-/** Structure to represent a directory entry.
- *
- * Useful to keep together important information
- * for sorting directory entries.
- */
-struct dir_elem_t {
-	char *name;
-	struct stat s;
-};
 
 static const char *cmdname = "ls";
 
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "unsort", no_argument, 0, 'u' },
-	{ 0, 0, 0, 0 }
-};
+static void ls_scan_dir(const char *d, DIR *dirp)
+{
+	struct dirent *dp;
+	char *buff;
 
-/** Print an entry.
- *
- * ls_print currently does nothing more than print the entry.
- * In the future, we will likely pass the absolute path, and
+	if (! dirp)
+		return;
+
+	buff = (char *)malloc(PATH_MAX);
+	if (NULL == buff) {
+		cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
+		return;
+	}
+
+	while ((dp = readdir(dirp))) {
+		memset(buff, 0, sizeof(buff));
+		/* Don't worry if inserting a double slash, this will be fixed by
+		 * absolutize() later with subsequent calls to open() or readdir() */
+		snprintf(buff, PATH_MAX - 1, "%s/%s", d, dp->d_name);
+		ls_print(dp->d_name, buff);
+	}
+
+	free(buff);
+
+	return;
+}
+
+/* ls_print currently does nothing more than print the entry.
+ * in the future, we will likely pass the absolute path, and
  * some sort of ls_options structure that controls how each
  * entry is printed and what is printed about it.
  *
- * Now we just print basic DOS style lists.
- *
- * @param de		Directory element.
- */
-static void ls_print(struct dir_elem_t *de)
+ * Now we just print basic DOS style lists */
+
+static void ls_print(const char *name, const char *pathname)
 {
-	if (de->s.is_file)
-		printf("%-40s\t%llu\n", de->name, (long long) de->s.size);
-	else if (de->s.is_directory)
-		printf("%-40s\t<dir>\n", de->name);
-	else
-		printf("%-40s\n", de->name);
-}
+	struct stat s;
+	int rc;
 
-
-/** Compare 2 directory elements.
- *
- * It compares 2 elements of a directory : a file is considered
- * as bigger than a directory, and if they have the same type,
- * they are compared alphabetically.
- *
- * @param a		Pointer to the structure of the first element.
- * @param b		Pointer to the structure of the second element.
- * @param arg		Pointer for an other and optionnal argument.
- *
- * @return		-1 if a < b, 1 otherwise.
- */
-static int ls_cmp(void *a, void *b, void *arg)
-{
-	struct dir_elem_t *da = a;
-	struct dir_elem_t *db = b;
-	
-	if ((da->s.is_directory && db->s.is_file) ||
-	    ((da->s.is_directory == db->s.is_directory) &&
-	    str_cmp(da->name, db->name) < 0))
-		return -1;
-	else
-		return 1;
-}
-
-/** Scan a directory.
- *
- * Scan the content of a directory and print it.
- *
- * @param d		Name of the directory.
- * @param dirp	Directory stream.
- * @param sort	1 if the output must be sorted,
- *				0 otherwise.
- */
-static void ls_scan_dir(const char *d, DIR *dirp, int sort)
-{
-	int alloc_blocks = 20;
-	int i;
-	int nbdirs = 0;
-	int rc;
-	int len;
-	char *buff;
-	struct dir_elem_t *tmp;
-	struct dir_elem_t *tosort;
-	struct dirent *dp;
-	
-	if (!dirp)
-		return;
-
-	buff = (char *) malloc(PATH_MAX);
-	if (!buff) {
-		cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
+	rc = stat(pathname, &s);
+	if (rc != 0) {
+		/* Odd chance it was deleted from the time readdir() found it */
+		printf("ls: skipping bogus node %s\n", pathname);
+		printf("rc=%d\n", rc);
 		return;
 	}
 	
-	tosort = (struct dir_elem_t *) malloc(alloc_blocks * sizeof(*tosort));
-	if (!tosort) {
-		cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-		free(buff);
-		return;
-	}
-	
-	while ((dp = readdir(dirp))) {
-		if (nbdirs + 1 > alloc_blocks) {
-			alloc_blocks += alloc_blocks;
-			
-			tmp = (struct dir_elem_t *) realloc(tosort,
-			    alloc_blocks * sizeof(struct dir_elem_t));
-			if (!tmp) {
-				cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-				goto out;
-			}
-			tosort = tmp;
-		}
-		
-		/* fill the name field */
-		tosort[nbdirs].name = (char *) malloc(str_length(dp->d_name) + 1);
-		if (!tosort[nbdirs].name) {
-			cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-			goto out;
-		}
-		
-		str_cpy(tosort[nbdirs].name, str_length(dp->d_name) + 1, dp->d_name);
-		len = snprintf(buff, PATH_MAX - 1, "%s/%s", d, tosort[nbdirs].name);
-		buff[len] = '\0';
+	if (s.is_file)
+		printf("%-40s\t%llu\n", name, (long long) s.size);
+	else if (s.is_directory)
+		printf("%-40s\t<dir>\n", name);
+	else
+		printf("%-40s\n", name);
 
-		rc = stat(buff, &tosort[nbdirs++].s);
-		if (rc != 0) {
-			printf("ls: skipping bogus node %s\n", buff);
-			printf("rc=%d\n", rc);
-			goto out;
-		}
-	}
-	
-	if (sort) {
-		if (!qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t),
-		    ls_cmp, NULL)) {
-			printf("Sorting error.\n");
-		}
-	}
-	
-	for (i = 0; i < nbdirs; i++)
-		ls_print(&tosort[i]);
-	
-out:
-	for(i = 0; i < nbdirs; i++)
-		free(tosort[i].name);
-	free(tosort);
-	free(buff);
+	return;
 }
 
@@ -212,11 +114,6 @@
 	} else {
 		help_cmd_ls(HELP_SHORT);
-		printf(
-		"Usage:  %s [options] [path]\n"
-		"If not path is given, the current working directory is used.\n"
-		"Options:\n"
-		"  -h, --help       A short option summary\n"
-		"  -u, --unsort     Do not sort directory entries\n",
-		cmdname);
+		printf("  `%s' [path], if no path is given the current "
+				"working directory is used.\n", cmdname);
 	}
 
@@ -227,58 +124,43 @@
 {
 	unsigned int argc;
-	struct dir_elem_t de;
+	struct stat s;
+	char *buff;
 	DIR *dirp;
-	int c, opt_ind;
-	int sort = 1;
 
 	argc = cli_count_args(argv);
-	
-	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "hu", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_ls(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'u':
-			sort = 0;
-			break;
-		}
-	}
-	
-	argc -= optind;
-	
-	de.name = (char *) malloc(PATH_MAX);
-	if (!de.name) {
+
+	buff = (char *) malloc(PATH_MAX);
+	if (NULL == buff) {
 		cli_error(CL_ENOMEM, "%s: ", cmdname);
 		return CMD_FAILURE;
 	}
-	memset(de.name, 0, sizeof(PATH_MAX));
-	
-	if (argc == 0)
-		getcwd(de.name, PATH_MAX);
+	memset(buff, 0, sizeof(buff));
+
+	if (argc == 1)
+		getcwd(buff, PATH_MAX);
 	else
-		str_cpy(de.name, PATH_MAX, argv[optind]);
-	
-	if (stat(de.name, &de.s)) {
-		cli_error(CL_ENOENT, de.name);
-		free(de.name);
+		str_cpy(buff, PATH_MAX, argv[1]);
+
+	if (stat(buff, &s)) {
+		cli_error(CL_ENOENT, buff);
+		free(buff);
 		return CMD_FAILURE;
 	}
 
-	if (de.s.is_file) {
-		ls_print(&de);
+	if (s.is_file) {
+		ls_print(buff, buff);
 	} else {
-		dirp = opendir(de.name);
+		dirp = opendir(buff);
 		if (!dirp) {
 			/* May have been deleted between scoping it and opening it */
-			cli_error(CL_EFAIL, "Could not stat %s", de.name);
-			free(de.name);
+			cli_error(CL_EFAIL, "Could not stat %s", buff);
+			free(buff);
 			return CMD_FAILURE;
 		}
-		ls_scan_dir(de.name, dirp, sort);
+		ls_scan_dir(buff, dirp);
 		closedir(dirp);
 	}
 
-	free(de.name);
+	free(buff);
 
 	return CMD_SUCCESS;
Index: uspace/app/bdsh/cmds/modules/ls/ls.h
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ uspace/app/bdsh/cmds/modules/ls/ls.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,13 @@
+#ifndef LS_H
+#define LS_H
+
+/* Various values that can be returned by ls_scope() */
+#define LS_BOGUS 0
+#define LS_FILE  1
+#define LS_DIR   2
+
+static void ls_scan_dir(const char *, DIR *);
+static void ls_print(const char *, const char *);
+
+#endif /* LS_H */
+
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -101,42 +101,7 @@
 }
 
-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 */
@@ -146,14 +111,7 @@
 
 	/* Its not empty, recursively scan it */
-	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;
+	cli_error(CL_ENOTSUP,
+		"Can not remove %s, directory not empty", path);
+	return 1;
 }
 
@@ -269,5 +227,5 @@
 		}
 		memset(buff, 0, sizeof(buff));
-		snprintf(buff, len, "%s", argv[i]);
+		snprintf(buff, len, argv[i]);
 
 		scope = rm_scope(buff);
Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/init/init.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -272,7 +272,4 @@
 	mount_tmpfs();
 	
-#ifdef CONFIG_START_DEVMAN
-	spawn("/srv/devman");
-#endif
 	spawn("/srv/apic");
 	spawn("/srv/i8259");
Index: uspace/app/sbi/src/run_expr.c
===================================================================
--- uspace/app/sbi/src/run_expr.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/sbi/src/run_expr.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -2529,6 +2529,4 @@
 	if (rc1 == EOK)
 		rc2 = os_str_get_char(string->value, elem_index, &cval);
-	else
-		rc2 = EOK;
 
 	if (rc1 != EOK || rc2 != EOK) {
Index: uspace/app/stats/stats.c
===================================================================
--- uspace/app/stats/stats.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/stats/stats.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -265,5 +265,5 @@
 		/* Threads */
 		if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) {
-			/* TODO: Support for 64b range */
+			// TODO: Support for 64b range
 			int tmp;
 			int ret = arg_parse_int(argc, argv, &i, &tmp, off);
Index: uspace/app/tester/Makefile
===================================================================
--- uspace/app/tester/Makefile	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/tester/Makefile	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -49,5 +49,4 @@
 	loop/loop1.c \
 	mm/malloc1.c \
-	devs/devman1.c \
 	hw/misc/virtchar1.c \
 	hw/serial/serial1.c
Index: pace/app/tester/devs/devman1.c
===================================================================
--- uspace/app/tester/devs/devman1.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * 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 tester
- * @brief Test devman service.
- * @{
- */
-/**
- * @file
- */
-
-#include <inttypes.h>
-#include <errno.h>
-#include <str_error.h>
-#include <sys/types.h>
-#include <async.h>
-#include <devman.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include "../tester.h"
-
-#define DEVICE_PATH_NORMAL "/virt/null/a"
-#define DEVICE_CLASS "virt-null"
-#define DEVICE_CLASS_NAME "1"
-#define DEVICE_PATH_CLASSES DEVICE_CLASS "/" DEVICE_CLASS_NAME
-
-const char *test_devman1(void)
-{
-	devman_handle_t handle_primary;
-	devman_handle_t handle_class;
-	
-	int rc;
-	
-	TPRINTF("Asking for handle of `%s'...\n", DEVICE_PATH_NORMAL);
-	rc = devman_device_get_handle(DEVICE_PATH_NORMAL, &handle_primary, 0);
-	if (rc != EOK) {
-		TPRINTF(" ...failed: %s.\n", str_error(rc));
-		if (rc == ENOENT) {
-			TPRINTF("Have you compiled the test drivers?\n");
-		}
-		return "Failed getting device handle";
-	}
-
-	TPRINTF("Asking for handle of `%s' by class..\n", DEVICE_PATH_CLASSES);
-	rc = devman_device_get_handle_by_class(DEVICE_CLASS, DEVICE_CLASS_NAME,
-	    &handle_class, 0);
-	if (rc != EOK) {
-		TPRINTF(" ...failed: %s.\n", str_error(rc));
-		return "Failed getting device class handle";
-	}
-
-	TPRINTF("Received handles %" PRIun " and %" PRIun ".\n",
-	    handle_primary, handle_class);
-	if (handle_primary != handle_class) {
-		return "Retrieved different handles for the same device";
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: pace/app/tester/devs/devman1.def
===================================================================
--- uspace/app/tester/devs/devman1.def	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"devman1",
-	"devman test",
-	&test_devman1,
-	false
-},
Index: uspace/app/tester/fault/fault2.c
===================================================================
--- uspace/app/tester/fault/fault2.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/tester/fault/fault2.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -29,5 +29,4 @@
 
 #include "../tester.h"
-#include <stdio.h>
 
 typedef int __attribute__((may_alias)) aliasing_int;
@@ -39,5 +38,4 @@
 	
 	var1 = *((aliasing_int *) (((char *) (&var)) + 1));
-	printf("Read %d\n", var1);
 	
 	return "Survived unaligned read";
Index: uspace/app/tester/tester.c
===================================================================
--- uspace/app/tester/tester.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/tester/tester.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -64,5 +64,4 @@
 #include "hw/serial/serial1.def"
 #include "hw/misc/virtchar1.def"
-#include "devs/devman1.def"
 	{NULL, NULL, NULL, false}
 };
Index: uspace/app/tester/tester.h
===================================================================
--- uspace/app/tester/tester.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/tester/tester.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -80,5 +80,4 @@
 extern const char *test_serial1(void);
 extern const char *test_virtchar1(void);
-extern const char *test_devman1(void);
 
 extern test_t tests[];
Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/app/trace/trace.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -53,5 +53,5 @@
 #include <libc.h>
 
-/* Temporary: service and method names */
+// Temporary: service and method names
 #include "proto.h"
 #include <ipc/services.h>
@@ -872,5 +872,5 @@
 static display_mask_t parse_display_mask(const char *text)
 {
-	display_mask_t dm = 0;
+	display_mask_t dm;
 	const char *c = text;
 	
Index: uspace/drv/isa/isa.c
===================================================================
--- uspace/drv/isa/isa.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/isa/isa.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -53,5 +53,4 @@
 
 #include <ddf/driver.h>
-#include <ddf/log.h>
 #include <ops/hw_res.h>
 
@@ -83,5 +82,5 @@
 static bool isa_enable_fun_interrupt(ddf_fun_t *fnode)
 {
-	/* TODO */
+	// TODO
 
 	return false;
@@ -135,5 +134,5 @@
 	fd = open(conf_path, O_RDONLY);
 	if (fd < 0) {
-		ddf_msg(LVL_ERROR, "Unable to open %s", conf_path);
+		printf(NAME ": unable to open %s\n", conf_path);
 		goto cleanup;
 	}
@@ -142,8 +141,8 @@
 
 	len = lseek(fd, 0, SEEK_END);
-	lseek(fd, 0, SEEK_SET);
+	lseek(fd, 0, SEEK_SET);	
 	if (len == 0) {
-		ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.",
-		    conf_path);
+		printf(NAME ": fun_conf_read error: configuration file '%s' "
+		    "is empty.\n", conf_path);
 		goto cleanup;
 	}
@@ -151,10 +150,11 @@
 	buf = malloc(len + 1);
 	if (buf == NULL) {
-		ddf_msg(LVL_ERROR, "Memory allocation failed.");
+		printf(NAME ": fun_conf_read error: memory allocation failed.\n");
 		goto cleanup;
 	}
 
 	if (0 >= read(fd, buf, len)) {
-		ddf_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path);
+		printf(NAME ": fun_conf_read error: unable to read file '%s'.\n",
+		    conf_path);
 		goto cleanup;
 	}
@@ -252,5 +252,5 @@
 		fun->hw_resources.count++;
 
-		ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s", irq,
+		printf(NAME ": added irq 0x%x to function %s\n", irq,
 		    fun->fnode->name);
 	}
@@ -270,6 +270,6 @@
 		fun->hw_resources.count++;
 
-		ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to "
-		    "function %s", (unsigned int) addr, (unsigned int) len,
+		printf(NAME ": added io range (addr=0x%x, size=0x%x) to "
+		    "function %s\n", (unsigned int) addr, (unsigned int) len,
 		    fun->fnode->name);
 	}
@@ -331,6 +331,6 @@
 	score = (int)strtol(val, &end, 10);
 	if (val == end) {
-		ddf_msg(LVL_ERROR, "Cannot read match score for function "
-		    "%s.", fun->fnode->name);
+		printf(NAME " : error - could not read match score for "
+		    "function %s.\n", fun->fnode->name);
 		return;
 	}
@@ -339,17 +339,15 @@
 	get_match_id(&id, val);
 	if (id == NULL) {
-		ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.",
-		    fun->fnode->name);
+		printf(NAME " : error - could not read match id for "
+		    "function %s.\n", fun->fnode->name);
 		return;
 	}
 
-	ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to "
-	    "function %s", id, score, fun->fnode->name);
+	printf(NAME ": adding match id '%s' with score %d to function %s\n", id,
+	    score, fun->fnode->name);
 
 	rc = ddf_fun_add_match_id(fun->fnode, id, score);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
-		    str_error(rc));
-	}
+	if (rc != EOK)
+		printf(NAME ": error adding match ID: %s\n", str_error(rc));
 }
 
@@ -377,8 +375,8 @@
 	if (!prop_parse(fun, line, "io_range", &fun_parse_io_range) &&
 	    !prop_parse(fun, line, "irq", &fun_parse_irq) &&
-	    !prop_parse(fun, line, "match", &fun_parse_match_id)) {
-
-		ddf_msg(LVL_ERROR, "Undefined device property at line '%s'",
-		    line);
+	    !prop_parse(fun, line, "match", &fun_parse_match_id))
+	{
+	    printf(NAME " error undefined device property at line '%s'\n",
+		line);
 	}
 }
@@ -441,5 +439,5 @@
 	fun->fnode->ops = &isa_fun_ops;
 
-	ddf_msg(LVL_DEBUG, "Binding function %s.", fun->fnode->name);
+	printf(NAME ": Binding function %s.\n", fun->fnode->name);
 
 	/* XXX Handle error */
@@ -469,18 +467,18 @@
 static int isa_add_device(ddf_dev_t *dev)
 {
-	ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d",
+	printf(NAME ": isa_add_device, device handle = %d\n",
 	    (int) dev->handle);
 
 	/* Make the bus device more visible. Does not do anything. */
-	ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
+	printf(NAME ": adding a 'ctl' function\n");
 
 	ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");
 	if (ctl == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating control function.");
+		printf(NAME ": Error creating control function.\n");
 		return EXDEV;
 	}
 
 	if (ddf_fun_bind(ctl) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding control function.");
+		printf(NAME ": Error binding control function.\n");
 		return EXDEV;
 	}
@@ -488,5 +486,5 @@
 	/* Add functions as specified in the configuration file. */
 	isa_functions_add(dev);
-	ddf_msg(LVL_NOTE, "Finished enumerating legacy functions");
+	printf(NAME ": finished the enumeration of legacy functions\n");
 
 	return EOK;
@@ -495,5 +493,4 @@
 static void isa_init() 
 {
-	ddf_log_init(NAME, LVL_ERROR);
 	isa_fun_ops.interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops;
 }
Index: uspace/drv/ns8250/ns8250.c
===================================================================
--- uspace/drv/ns8250/ns8250.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/ns8250/ns8250.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -55,5 +55,4 @@
 #include <ddf/driver.h>
 #include <ddf/interrupt.h>
-#include <ddf/log.h>
 #include <ops/char_dev.h>
 
@@ -276,11 +275,11 @@
 static bool ns8250_pio_enable(ns8250_t *ns)
 {
-	ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s", ns->dev->name);
+	printf(NAME ": ns8250_pio_enable %s\n", ns->dev->name);
 	
 	/* Gain control over port's registers. */
 	if (pio_enable((void *)(uintptr_t) ns->io_addr, REG_COUNT,
 	    (void **) &ns->port)) {
-		ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32
-		    " for device %s.", ns->io_addr, ns->dev->name);
+		printf(NAME ": error - cannot gain the port %#" PRIx32 " for device "
+		    "%s.\n", ns->io_addr, ns->dev->name);
 		return false;
 	}
@@ -296,5 +295,5 @@
 static bool ns8250_dev_probe(ns8250_t *ns)
 {
-	ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ns->dev->name);
+	printf(NAME ": ns8250_dev_probe %s\n", ns->dev->name);
 	
 	ioport8_t *port_addr = ns->port;
@@ -314,8 +313,6 @@
 	pio_write_8(port_addr + 4, olddata);
 	
-	if (!res) {
-		ddf_msg(LVL_DEBUG, "Device %s is not present.",
-		    ns->dev->name);
-	}
+	if (!res)
+		printf(NAME ": device %s is not present.\n", ns->dev->name);
 	
 	return res;
@@ -329,5 +326,5 @@
 static int ns8250_dev_initialize(ns8250_t *ns)
 {
-	ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ns->dev->name);
+	printf(NAME ": ns8250_dev_initialize %s\n", ns->dev->name);
 	
 	int ret = EOK;
@@ -340,6 +337,6 @@
 	    IPC_FLAG_BLOCKING);
 	if (ns->dev->parent_phone < 0) {
-		ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "
-		    "device %s.", ns->dev->name);
+		printf(NAME ": failed to connect to the parent driver of the "
+		    "device %s.\n", ns->dev->name);
 		ret = ns->dev->parent_phone;
 		goto failed;
@@ -349,6 +346,6 @@
 	ret = hw_res_get_resource_list(ns->dev->parent_phone, &hw_resources);
 	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to get HW resources for device "
-		    "%s.", ns->dev->name);
+		printf(NAME ": failed to get hw resources for the device "
+		    "%s.\n", ns->dev->name);
 		goto failed;
 	}
@@ -365,5 +362,5 @@
 			ns->irq = res->res.interrupt.irq;
 			irq = true;
-			ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x.",
+			printf(NAME ": the %s device was asigned irq = 0x%x.\n",
 			    ns->dev->name, ns->irq);
 			break;
@@ -372,13 +369,13 @@
 			ns->io_addr = res->res.io_range.address;
 			if (res->res.io_range.size < REG_COUNT) {
-				ddf_msg(LVL_ERROR, "I/O range assigned to "
-				    "device %s is too small.", ns->dev->name);
+				printf(NAME ": i/o range assigned to the device "
+				    "%s is too small.\n", ns->dev->name);
 				ret = ELIMIT;
 				goto failed;
 			}
 			ioport = true;
-			ddf_msg(LVL_NOTE, "Device %s was asigned I/O address = "
-			    "0x%x.", ns->dev->name, ns->io_addr);
-    			break;
+			printf(NAME ": the %s device was asigned i/o address = "
+			    "0x%x.\n", ns->dev->name, ns->io_addr);
+			break;
 			
 		default:
@@ -388,5 +385,5 @@
 	
 	if (!irq || !ioport) {
-		ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s.",
+		printf(NAME ": missing hw resource(s) for the device %s.\n",
 		    ns->dev->name);
 		ret = ENOENT;
@@ -473,6 +470,6 @@
 	
 	if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) {
-		ddf_msg(LVL_ERROR, "Invalid baud rate %d requested.",
-		    baud_rate);
+		printf(NAME ": error - somebody tried to set invalid baud rate "
+		    "%d\n", baud_rate);
 		return EINVAL;
 	}
@@ -657,9 +654,9 @@
 			if (ns->client_connected) {
 				if (!buf_push_back(&ns->input_buffer, val)) {
-					ddf_msg(LVL_WARN, "Buffer overflow on "
-					    "%s.", ns->dev->name);
+					printf(NAME ": buffer overflow on "
+					    "%s.\n", ns->dev->name);
 				} else {
-					ddf_msg(LVL_DEBUG2, "Character %c saved "
-					    "to the buffer of %s.",
+					printf(NAME ": the character %c saved "
+					    "to the buffer of %s.\n",
 					    val, ns->dev->name);
 				}
@@ -717,5 +714,5 @@
 	int rc;
 	
-	ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d)",
+	printf(NAME ": ns8250_add_device %s (handle = %d)\n",
 	    dev->name, (int) dev->handle);
 	
@@ -752,5 +749,5 @@
 	/* Register interrupt handler. */
 	if (ns8250_register_interrupt_handler(ns) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
+		printf(NAME ": failed to register interrupt handler.\n");
 		rc = EADDRNOTAVAIL;
 		goto fail;
@@ -760,6 +757,6 @@
 	rc = ns8250_interrupt_enable(ns);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
-		    "%d.", rc);
+		printf(NAME ": failed to enable the interrupt. Error code = "
+		    "%d.\n", rc);
 		goto fail;
 	}
@@ -767,5 +764,5 @@
 	fun = ddf_fun_create(dev, fun_exposed, "a");
 	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function.");
+		printf(NAME ": error creating function.\n");
 		goto fail;
 	}
@@ -775,5 +772,5 @@
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function.");
+		printf(NAME ": error binding function.\n");
 		goto fail;
 	}
@@ -783,5 +780,5 @@
 	ddf_fun_add_to_class(fun, "serial");
 	
-	ddf_msg(LVL_NOTE, "Device %s successfully initialized.",
+	printf(NAME ": the %s device has been successfully initialized.\n",
 	    dev->name);
 	
@@ -865,6 +862,6 @@
 	fibril_mutex_unlock(&data->mutex);
 	
-	ddf_msg(LVL_DEBUG, "ns8250_get_props: baud rate %d, parity 0x%x, word "
-	    "length %d, stop bits %d", *baud_rate, *parity, *word_length,
+	printf(NAME ": ns8250_get_props: baud rate %d, parity 0x%x, word "
+	    "length %d, stop bits %d\n", *baud_rate, *parity, *word_length,
 	    *stop_bits);
 }
@@ -882,6 +879,6 @@
     unsigned int parity, unsigned int word_length, unsigned int stop_bits)
 {
-	ddf_msg(LVL_DEBUG, "ns8250_set_props: baud rate %d, parity 0x%x, word "
-	    "length %d, stop bits %d", baud_rate, parity, word_length,
+	printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word "
+	    "length %d, stop bits %d\n", baud_rate, parity, word_length,
 	    stop_bits);
 	
@@ -943,6 +940,4 @@
 static void ns8250_init(void)
 {
-	ddf_log_init(NAME, LVL_ERROR);
-	
 	ns8250_dev_ops.open = &ns8250_open;
 	ns8250_dev_ops.close = &ns8250_close;
Index: uspace/drv/pciintel/pci.c
===================================================================
--- uspace/drv/pciintel/pci.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/pciintel/pci.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -48,5 +48,4 @@
 
 #include <ddf/driver.h>
-#include <ddf/log.h>
 #include <devman.h>
 #include <ipc/devman.h>
@@ -226,5 +225,5 @@
 
 	if (match_id_str == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory creating match ID.");
+		printf(NAME ": out of memory creating match ID.\n");
 		return;
 	}
@@ -232,5 +231,5 @@
 	rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
+		printf(NAME ": error adding match ID: %s\n",
 		    str_error(rc));
 	}
@@ -324,7 +323,7 @@
 	
 	if (range_addr != 0) {
-		ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64
-		    ", size = %x", fun->fnode->name, range_addr,
-		    (unsigned int) range_size);
+		printf(NAME ": function %s : ", fun->fnode->name);
+		printf("address = %" PRIx64, range_addr);
+		printf(", size = %x\n", (unsigned int) range_size);
 	}
 	
@@ -351,5 +350,5 @@
 	hw_res_list->count++;
 	
-	ddf_msg(LVL_NOTE, "Function %s uses irq %x.", fun->fnode->name, irq);
+	printf(NAME ": function %s uses irq %x.\n", fun->fnode->name, irq);
 }
 
@@ -407,5 +406,5 @@
 			char *fun_name = pci_fun_create_name(fun);
 			if (fun_name == NULL) {
-				ddf_msg(LVL_ERROR, "Out of memory.");
+				printf(NAME ": out of memory.\n");
 				return;
 			}
@@ -413,5 +412,5 @@
 			fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name);
 			if (fnode == NULL) {
-				ddf_msg(LVL_ERROR, "Failed creating function.");
+				printf(NAME ": error creating function.\n");
 				return;
 			}
@@ -427,5 +426,5 @@
 			fnode->driver_data = fun;
 			
-			ddf_msg(LVL_DEBUG, "Adding new function %s.",
+			printf(NAME ": adding new function %s.\n",
 			    fnode->name);
 			
@@ -444,7 +443,6 @@
 				child_bus = pci_conf_read_8(fun,
 				    PCI_BRIDGE_SEC_BUS_NUM);
-				ddf_msg(LVL_DEBUG, "Device is pci-to-pci "
-				    "bridge, secondary bus number = %d.",
-				    bus_num);
+				printf(NAME ": device is pci-to-pci bridge, "
+				    "secondary bus number = %d.\n", bus_num);
 				if (child_bus > bus_num)
 					pci_bus_scan(bus, child_bus);
@@ -468,10 +466,10 @@
 	int rc;
 	
-	ddf_msg(LVL_DEBUG, "pci_add_device");
+	printf(NAME ": pci_add_device\n");
 	dnode->parent_phone = -1;
 	
 	bus = pci_bus_new();
 	if (bus == NULL) {
-		ddf_msg(LVL_ERROR, "pci_add_device allocation failed.");
+		printf(NAME ": pci_add_device allocation failed.\n");
 		rc = ENOMEM;
 		goto fail;
@@ -483,6 +481,6 @@
 	    IPC_FLAG_BLOCKING);
 	if (dnode->parent_phone < 0) {
-		ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the "
-		    "parent's driver.");
+		printf(NAME ": pci_add_device failed to connect to the "
+		    "parent's driver.\n");
 		rc = dnode->parent_phone;
 		goto fail;
@@ -493,11 +491,11 @@
 	rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources "
-		    "for the device.");
+		printf(NAME ": pci_add_device failed to get hw resources for "
+		    "the device.\n");
 		goto fail;
 	}
 	got_res = true;
 	
-	ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
+	printf(NAME ": conf_addr = %" PRIx64 ".\n",
 	    hw_resources.resources[0].res.io_range.address);
 	
@@ -511,5 +509,5 @@
 	if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8,
 	    &bus->conf_addr_port)) {
-		ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
+		printf(NAME ": failed to enable configuration ports.\n");
 		rc = EADDRNOTAVAIL;
 		goto fail;
@@ -518,9 +516,9 @@
 	
 	/* Make the bus device more visible. It has no use yet. */
-	ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
+	printf(NAME ": adding a 'ctl' function\n");
 	
 	ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl");
 	if (ctl == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating control function.");
+		printf(NAME ": error creating control function.\n");
 		rc = ENOMEM;
 		goto fail;
@@ -529,10 +527,10 @@
 	rc = ddf_fun_bind(ctl);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding control function.");
+		printf(NAME ": error binding control function.\n");
 		goto fail;
 	}
 	
 	/* Enumerate functions. */
-	ddf_msg(LVL_DEBUG, "Scanning the bus");
+	printf(NAME ": scanning the bus\n");
 	pci_bus_scan(bus, 0);
 	
@@ -556,5 +554,4 @@
 static void pciintel_init(void)
 {
-	ddf_log_init(NAME, LVL_ERROR);
 	pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;
 }
@@ -634,5 +631,5 @@
 int main(int argc, char *argv[])
 {
-	printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n");
+	printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
 	pciintel_init();
 	return ddf_driver_main(&pci_driver);
Index: uspace/drv/root/root.c
===================================================================
--- uspace/drv/root/root.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/root/root.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -52,5 +52,4 @@
 
 #include <ddf/driver.h>
-#include <ddf/log.h>
 #include <devman.h>
 #include <ipc/devman.h>
@@ -90,11 +89,11 @@
 	int rc;
 
-	ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. "
-	    "Function node is `%s' (%d %s)", name,
+	printf(NAME ": adding new function for virtual devices.\n");
+	printf(NAME ":   function node is `%s' (%d %s)\n", name,
 	    VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID);
 
 	fun = ddf_fun_create(dev, fun_inner, name);
 	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", name);
+		printf(NAME ": error creating function %s\n", name);
 		return ENOMEM;
 	}
@@ -103,6 +102,5 @@
 	    VIRTUAL_FUN_MATCH_SCORE);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
+		printf(NAME ": error adding match IDs to function %s\n", name);
 		ddf_fun_destroy(fun);
 		return rc;
@@ -111,5 +109,5 @@
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
+		printf(NAME ": error binding function %s: %s\n", name,
 		    str_error(rc));
 		ddf_fun_destroy(fun);
@@ -138,5 +136,5 @@
 	platform = sysinfo_get_data("platform", &platform_size);
 	if (platform == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to obtain platform name.");
+		printf(NAME ": Failed to obtain platform name.\n");
 		return ENOENT;
 	}
@@ -145,5 +143,5 @@
 	platform = realloc(platform, platform_size + 1);
 	if (platform == NULL) {
-		ddf_msg(LVL_ERROR, "Memory allocation failed.");
+		printf(NAME ": Memory allocation failed.\n");
 		return ENOMEM;
 	}
@@ -153,16 +151,16 @@
 	/* Construct match ID. */
 	if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) {
-		ddf_msg(LVL_ERROR, "Memory allocation failed.");
+		printf(NAME ": Memory allocation failed.\n");
 		return ENOMEM;
 	}
 
 	/* Add function. */
-	ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' "
-	    " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE,
-	    match_id);
+	printf(NAME ": adding platform function\n");
+	printf(NAME ":   function node is `%s' (%d %s)\n", PLATFORM_FUN_NAME,
+	    PLATFORM_FUN_MATCH_SCORE, match_id);
 
 	fun = ddf_fun_create(dev, fun_inner, name);
 	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function %s", name);
+		printf(NAME ": error creating function %s\n", name);
 		return ENOMEM;
 	}
@@ -170,6 +168,5 @@
 	rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
+		printf(NAME ": error adding match IDs to function %s\n", name);
 		ddf_fun_destroy(fun);
 		return rc;
@@ -178,5 +175,5 @@
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
+		printf(NAME ": error binding function %s: %s\n", name,
 		    str_error(rc));
 		ddf_fun_destroy(fun);
@@ -194,5 +191,5 @@
 static int root_add_device(ddf_dev_t *dev)
 {
-	ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun,
+	printf(NAME ": root_add_device, device handle=%" PRIun "\n",
 	    dev->handle);
 
@@ -207,5 +204,5 @@
 	int res = add_platform_fun(dev);
 	if (EOK != res)
-		ddf_msg(LVL_ERROR, "Failed adding child device for platform.");
+		printf(NAME ": failed to add child device for platform.\n");
 
 	return res;
@@ -215,6 +212,4 @@
 {
 	printf(NAME ": HelenOS root device driver\n");
-
-	ddf_log_init(NAME, LVL_ERROR);
 	return ddf_driver_main(&root_driver);
 }
Index: uspace/drv/rootpc/rootpc.c
===================================================================
--- uspace/drv/rootpc/rootpc.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/rootpc/rootpc.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -47,5 +47,4 @@
 
 #include <ddf/driver.h>
-#include <ddf/log.h>
 #include <devman.h>
 #include <ipc/devman.h>
@@ -120,5 +119,5 @@
     rootpc_fun_t *fun)
 {
-	ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
+	printf(NAME ": adding new function '%s'.\n", name);
 	
 	ddf_fun_t *fnode = NULL;
@@ -146,5 +145,5 @@
 	/* Register function. */
 	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
+		printf(NAME ": error binding function %s.\n", name);
 		goto failure;
 	}
@@ -159,5 +158,5 @@
 		ddf_fun_destroy(fnode);
 	
-	ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
+	printf(NAME ": failed to add function '%s'.\n", name);
 	
 	return false;
@@ -177,10 +176,10 @@
 static int rootpc_add_device(ddf_dev_t *dev)
 {
-	ddf_msg(LVL_DEBUG, "rootpc_add_device, device handle = %d",
+	printf(NAME ": rootpc_add_device, device handle = %d\n",
 	    (int)dev->handle);
 	
 	/* Register functions. */
 	if (!rootpc_add_functions(dev)) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for PC platform.");
+		printf(NAME ": failed to add functions for PC platform.\n");
 	}
 	
@@ -190,5 +189,4 @@
 static void root_pc_init(void)
 {
-	ddf_log_init(NAME, LVL_ERROR);
 	rootpc_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
 }
Index: uspace/drv/rootvirt/rootvirt.c
===================================================================
--- uspace/drv/rootvirt/rootvirt.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/rootvirt/rootvirt.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -40,5 +40,4 @@
 #include <str_error.h>
 #include <ddf/driver.h>
-#include <ddf/log.h>
 
 #define NAME "rootvirt"
@@ -84,10 +83,10 @@
 	int rc;
 
-	ddf_msg(LVL_DEBUG, "Registering function `%s' (match \"%s\")",
+	printf(NAME ": registering function `%s' (match \"%s\")\n",
 	    vfun->name, vfun->match_id);
 
 	fun = ddf_fun_create(vdev, fun_inner, vfun->name);
 	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", vfun->name);
+		printf(NAME ": error creating function %s\n", vfun->name);
 		return ENOMEM;
 	}
@@ -95,5 +94,5 @@
 	rc = ddf_fun_add_match_id(fun, vfun->match_id, 10);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
+		printf(NAME ": error adding match IDs to function %s\n",
 		    vfun->name);
 		ddf_fun_destroy(fun);
@@ -103,11 +102,11 @@
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s",
-		    vfun->name, str_error(rc));
+		printf(NAME ": error binding function %s: %s\n", vfun->name,
+		    str_error(rc));
 		ddf_fun_destroy(fun);
 		return rc;
 	}
 
-	ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name);
+	printf(NAME ": registered child device `%s'\n", vfun->name);
 	return EOK;
 }
@@ -125,5 +124,5 @@
 	}
 
-	ddf_msg(LVL_DEBUG, "add_device(handle=%d)", (int)dev->handle);
+	printf(NAME ": add_device(handle=%d)\n", (int)dev->handle);
 
 	/*
@@ -143,6 +142,4 @@
 {
 	printf(NAME ": HelenOS virtual devices root driver\n");
-
-	ddf_log_init(NAME, LVL_ERROR);
 	return ddf_driver_main(&rootvirt_driver);
 }
Index: uspace/drv/test1/test1.c
===================================================================
--- uspace/drv/test1/test1.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/test1/test1.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -35,5 +35,4 @@
 #include <str_error.h>
 #include <ddf/driver.h>
-#include <ddf/log.h>
 
 #include "test1.h"
@@ -59,49 +58,34 @@
  */
 static int register_fun_verbose(ddf_dev_t *parent, const char *message,
-    const char *name, const char *match_id, int match_score,
-    int expected_rc)
+    const char *name, const char *match_id, int match_score)
 {
-	ddf_fun_t *fun = NULL;
+	ddf_fun_t *fun;
 	int rc;
 
-	ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
+	printf(NAME ": registering function `%s': %s.\n", name, message);
 
 	fun = ddf_fun_create(parent, fun_inner, name);
 	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", name);
-		rc = ENOMEM;
-		goto leave;
+		printf(NAME ": error creating function %s\n", name);
+		return ENOMEM;
 	}
 
-	rc = ddf_fun_add_match_id(fun, str_dup(match_id), match_score);
+	rc = ddf_fun_add_match_id(fun, match_id, match_score);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
-		goto leave;
+		printf(NAME ": error adding match IDs to function %s\n", name);
+		ddf_fun_destroy(fun);
+		return rc;
 	}
 
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
+		printf(NAME ": error binding function %s: %s\n", name,
 		    str_error(rc));
-		goto leave;
+		ddf_fun_destroy(fun);
+		return rc;
 	}
 
-	ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
-	rc = EOK;
-
-leave:
-	if (rc != expected_rc) {
-		fprintf(stderr,
-		    NAME ": Unexpected error registering function `%s'.\n" 
-		    NAME ":     Expected \"%s\" but got \"%s\".\n",
-		    name, str_error(expected_rc), str_error(rc));
-	}
-
-	if ((rc != EOK) && (fun != NULL)) {
-		ddf_fun_destroy(fun);
-	}
-
-	return rc;
+	printf(NAME ": registered child device `%s'\n", name);
+	return EOK;
 }
 
@@ -128,10 +112,10 @@
 	int rc;
 
-	ddf_msg(LVL_DEBUG, "add_device(name=\"%s\", handle=%d)",
+	printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
 	    dev->name, (int) dev->handle);
 
 	fun_a = ddf_fun_create(dev, fun_exposed, "a");
 	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
+		printf(NAME ": error creating function 'a'.\n");
 		return ENOMEM;
 	}
@@ -139,5 +123,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
+		printf(NAME ": error binding function 'a'.\n");
 		return rc;
 	}
@@ -149,17 +133,12 @@
 		ddf_fun_add_to_class(fun_a, "virt-null");
 	} else if (str_cmp(dev->name, "test1") == 0) {
-		(void) register_fun_verbose(dev,
-		    "cloning myself ;-)", "clone",
-		    "virtual&test1", 10, EOK);
-		(void) register_fun_verbose(dev,
-		    "cloning myself twice ;-)", "clone",
-		    "virtual&test1", 10, EEXISTS);
+		(void) register_fun_verbose(dev, "cloning myself ;-)", "clone",
+		    "virtual&test1", 10);
 	} else if (str_cmp(dev->name, "clone") == 0) {
-		(void) register_fun_verbose(dev,
-		    "run by the same task", "child",
-		    "virtual&test1&child", 10, EOK);
+		(void) register_fun_verbose(dev, "run by the same task", "child",
+		    "virtual&test1&child", 10);
 	}
 
-	ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev->name);
+	printf(NAME ": device `%s' accepted.\n", dev->name);
 
 	return EOK;
@@ -169,5 +148,4 @@
 {
 	printf(NAME ": HelenOS test1 virtual device driver\n");
-	ddf_log_init(NAME, LVL_ERROR);
 	return ddf_driver_main(&test1_driver);
 }
Index: uspace/drv/test2/test2.c
===================================================================
--- uspace/drv/test2/test2.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/drv/test2/test2.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -36,5 +36,4 @@
 #include <str_error.h>
 #include <ddf/driver.h>
-#include <ddf/log.h>
 
 #define NAME "test2"
@@ -65,9 +64,9 @@
 	int rc;
 
-	ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
+	printf(NAME ": registering function `%s': %s.\n", name, message);
 
 	fun = ddf_fun_create(parent, fun_inner, name);
 	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", name);
+		printf(NAME ": error creating function %s\n", name);
 		return ENOMEM;
 	}
@@ -75,6 +74,5 @@
 	rc = ddf_fun_add_match_id(fun, match_id, match_score);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
+		printf(NAME ": error adding match IDs to function %s\n", name);
 		ddf_fun_destroy(fun);
 		return rc;
@@ -83,5 +81,5 @@
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
+		printf(NAME ": error binding function %s: %s\n", name,
 		    str_error(rc));
 		ddf_fun_destroy(fun);
@@ -89,5 +87,5 @@
 	}
 
-	ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
+	printf(NAME ": registered child device `%s'\n", name);
 	return EOK;
 }
@@ -113,5 +111,5 @@
 	fun_a = ddf_fun_create(dev, fun_exposed, "a");
 	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
+		printf(NAME ": error creating function 'a'.\n");
 		return ENOMEM;
 	}
@@ -119,5 +117,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
+		printf(NAME ": error binding function 'a'.\n");
 		return rc;
 	}
@@ -130,5 +128,5 @@
 static int test2_add_device(ddf_dev_t *dev)
 {
-	ddf_msg(LVL_DEBUG, "test2_add_device(name=\"%s\", handle=%d)",
+	printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n",
 	    dev->name, (int) dev->handle);
 
@@ -136,5 +134,5 @@
 		fid_t postpone = fibril_create(postponed_birth, dev);
 		if (postpone == 0) {
-			ddf_msg(LVL_ERROR, "fibril_create() failed.");
+			printf(NAME ": fibril_create() error\n");
 			return ENOMEM;
 		}
@@ -151,5 +149,4 @@
 {
 	printf(NAME ": HelenOS test2 virtual device driver\n");
-	ddf_log_init(NAME, LVL_ERROR);
 	return ddf_driver_main(&test2_driver);
 }
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/Makefile	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -84,5 +84,4 @@
 	generic/io/io.c \
 	generic/io/printf.c \
-	generic/io/log.c \
 	generic/io/klog.c \
 	generic/io/snprintf.c \
Index: uspace/lib/c/arch/abs32le/_link.ld.in
===================================================================
--- uspace/lib/c/arch/abs32le/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/abs32le/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -11,6 +11,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/arch/amd64/_link.ld.in
===================================================================
--- uspace/lib/c/arch/amd64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/amd64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -16,6 +16,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/arch/arm32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/arm32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/arm32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/arch/ia32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ia32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/ia32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -16,6 +16,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/arch/ia64/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ia64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/ia64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
@@ -23,5 +23,5 @@
 	.got : {
 		_gp = .;
-		*(.got .got.*);
+		*(.got*);
 	} :data
 	
Index: uspace/lib/c/arch/mips32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/mips32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/mips32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/arch/ppc32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ppc32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/ppc32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/arch/sparc64/_link.ld.in
===================================================================
--- uspace/lib/c/arch/sparc64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/arch/sparc64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/lib/c/generic/adt/measured_strings.c
===================================================================
--- uspace/lib/c/generic/adt/measured_strings.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/generic/adt/measured_strings.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -74,5 +74,5 @@
 	new->length = length;
 	new->value = ((uint8_t *) new) + sizeof(measured_string_t);
-	/* Append terminating zero explicitly - to be safe */
+	// append terminating zero explicitly - to be safe
 	memcpy(new->value, string, new->length);
 	new->value[new->length] = '\0';
Index: uspace/lib/c/generic/devman.c
===================================================================
--- uspace/lib/c/generic/devman.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/generic/devman.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -147,4 +147,6 @@
 		ret = devman_send_match_id(phone, match_id);
 		if (ret != EOK) {
+			printf("Driver failed to send match id, error %d\n",
+			    ret);
 			return ret;
 		}
@@ -193,5 +195,5 @@
 	}
 	
-	int match_ids_rc = devman_send_match_ids(phone, match_ids);
+	devman_send_match_ids(phone, match_ids);
 	
 	async_wait_for(req, &retval);
@@ -199,9 +201,4 @@
 	async_serialize_end();
 	
-	/* Prefer the answer to DEVMAN_ADD_FUNCTION in case of errors. */
-	if ((match_ids_rc != EOK) && (retval == EOK)) {
-		retval = match_ids_rc;
-	}
-
 	if (retval == EOK)
 		fun_handle = (int) IPC_GET_ARG1(answer);
@@ -329,49 +326,4 @@
 }
 
-int devman_device_get_handle_by_class(const char *classname,
-    const char *devname, devman_handle_t *handle, unsigned int flags)
-{
-	int phone = devman_get_phone(DEVMAN_CLIENT, flags);
-
-	if (phone < 0)
-		return phone;
-
-	async_serialize_start();
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(phone, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
-	    flags, &answer);
-
-	sysarg_t retval = async_data_write_start(phone, classname,
-	    str_size(classname));
-	if (retval != EOK) {
-		async_wait_for(req, NULL);
-		async_serialize_end();
-		return retval;
-	}
-	retval = async_data_write_start(phone, devname,
-	    str_size(devname));
-	if (retval != EOK) {
-		async_wait_for(req, NULL);
-		async_serialize_end();
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	async_serialize_end();
-
-	if (retval != EOK) {
-		if (handle != NULL)
-			*handle = (devman_handle_t) -1;
-		return retval;
-	}
-
-	if (handle != NULL)
-		*handle = (devman_handle_t) IPC_GET_ARG1(answer);
-
-	return retval;
-}
-
 
 /** @}
Index: pace/lib/c/generic/io/log.c
===================================================================
--- uspace/lib/c/generic/io/log.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * 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 libc
- * @{
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <io/log.h>
-
-/** Serialization mutex for logging functions. */
-static FIBRIL_MUTEX_INITIALIZE(log_serializer);
-
-/** Current log level. */
-static log_level_t log_level;
-
-static FILE *log_stream;
-
-static const char *log_prog_name;
-
-/** Prefixes for individual logging levels. */
-static const char *log_level_names[] = {
-	[LVL_FATAL] = "Fatal error",
-	[LVL_ERROR] = "Error",
-	[LVL_WARN] = "Warning",
-	[LVL_NOTE] = "Note",
-	[LVL_DEBUG] = "Debug",
-	[LVL_DEBUG2] = "Debug2"
-};
-
-/** Initialize the logging system.
- *
- * @param prog_name	Program name, will be printed as part of message
- * @param level		Minimum message level to print
- */
-int log_init(const char *prog_name, log_level_t level)
-{
-	assert(level < LVL_LIMIT);
-	log_level = level;
-
-	log_stream = stdout;
-	log_prog_name = str_dup(prog_name);
-	if (log_prog_name == NULL)
-		return ENOMEM;
-
-	return EOK;
-}
-
-/** Write an entry to the log.
- *
- * @param level		Message verbosity level. Message is only printed
- *			if verbosity is less than or equal to current
- *			reporting level.
- * @param fmt		Format string (no traling newline).
- */
-void log_msg(log_level_t level, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	log_msgv(level, fmt, args);
-	va_end(args);
-}
-
-/** Write an entry to the log (va_list variant).
- *
- * @param level		Message verbosity level. Message is only printed
- *			if verbosity is less than or equal to current
- *			reporting level.
- * @param fmt		Format string (no trailing newline)
- */
-void log_msgv(log_level_t level, const char *fmt, va_list args)
-{
-	assert(level < LVL_LIMIT);
-
-	/* Higher number means higher verbosity. */
-	if (level <= log_level) {
-		fibril_mutex_lock(&log_serializer);
-
-		fprintf(log_stream, "%s: %s: ", log_prog_name,
-		    log_level_names[level]);
-		vfprintf(log_stream, fmt, args);
-		fputc('\n', log_stream);
-		fflush(log_stream);
-
-		fibril_mutex_unlock(&log_serializer);
-	}
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/net/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/generic/net/packet.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -190,5 +190,5 @@
 		}
 	}
-	gpm_destroy(&pm_globals.packet_map, free);
+	gpm_destroy(&pm_globals.packet_map);
 	/* leave locked */
 }
Index: uspace/lib/c/generic/net/socket_client.c
===================================================================
--- uspace/lib/c/generic/net/socket_client.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/generic/net/socket_client.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -749,5 +749,5 @@
 	dyn_fifo_destroy(&socket->received);
 	dyn_fifo_destroy(&socket->accepted);
-	sockets_exclude(socket_get_sockets(), socket->socket_id, free);
+	sockets_exclude(socket_get_sockets(), socket->socket_id);
 }
 
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -756,9 +756,8 @@
 {
 	struct stat stat;
-	
-	int rc = fstat(fildes, &stat);
-	if (rc != 0)
-		return rc;
-	
+	int rc;
+
+	rc = fstat(fildes, &stat);
+
 	if (!stat.device)
 		return -1;
Index: uspace/lib/c/include/adt/generic_char_map.h
===================================================================
--- uspace/lib/c/include/adt/generic_char_map.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/include/adt/generic_char_map.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -47,8 +47,4 @@
 #define GENERIC_CHAR_MAP_MAGIC_VALUE	0x12345622
 
-/** Generic destructor function pointer. */
-#define DTOR_T(identifier) \
-	void (*identifier)(const void *)
-
 /** Character string to generic type map declaration.
  *  @param[in] name	Name of the map.
@@ -68,6 +64,6 @@
 	int name##_add(name##_t *, const uint8_t *, const size_t, type *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *, DTOR_T()); \
-	void name##_exclude(name##_t *, const uint8_t *, const size_t, DTOR_T()); \
+	void name##_destroy(name##_t *); \
+	void name##_exclude(name##_t *, const uint8_t *, const size_t); \
 	type *name##_find(name##_t *, const uint8_t *, const size_t); \
 	int name##_initialize(name##_t *); \
@@ -88,4 +84,5 @@
 	     type *value) \
 	{ \
+		int rc; \
 		int index; \
 		if (!name##_is_valid(map)) \
@@ -94,5 +91,10 @@
 		if (index < 0) \
 			return index; \
-		return char_map_add(&map->names, name, length, index); \
+		rc = char_map_add(&map->names, name, length, index); \
+		if (rc != EOK) { \
+			name##_items_exclude_index(&map->values, index); \
+			return rc; \
+		} \
+		return EOK; \
 	} \
 	\
@@ -103,14 +105,14 @@
 	} \
 	\
-	void name##_destroy(name##_t *map, DTOR_T(dtor)) \
+	void name##_destroy(name##_t *map) \
 	{ \
 		if (name##_is_valid(map)) { \
 			char_map_destroy(&map->names); \
-			name##_items_destroy(&map->values, dtor); \
+			name##_items_destroy(&map->values); \
 		} \
 	} \
 	\
 	void name##_exclude(name##_t *map, const uint8_t *name, \
-	    const size_t length, DTOR_T(dtor)) \
+	    const size_t length) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -119,5 +121,5 @@
 			if (index != CHAR_MAP_NULL) \
 				name##_items_exclude_index(&map->values, \
-				     index, dtor); \
+				     index); \
 		} \
 	} \
Index: uspace/lib/c/include/adt/generic_field.h
===================================================================
--- uspace/lib/c/include/adt/generic_field.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/include/adt/generic_field.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -46,8 +46,4 @@
 #define GENERIC_FIELD_MAGIC_VALUE		0x55667788
 
-/** Generic destructor function pointer. */
-#define DTOR_T(identifier) \
-	void (*identifier)(const void *)
-
 /** Generic type field declaration.
  *
@@ -67,6 +63,6 @@
 	int name##_add(name##_t *, type *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *, DTOR_T()); \
-	void name##_exclude_index(name##_t *, int, DTOR_T()); \
+	void name##_destroy(name##_t *); \
+	void name##_exclude_index(name##_t *, int); \
 	type **name##_get_field(name##_t *); \
 	type *name##_get_index(name##_t *, int); \
@@ -107,14 +103,12 @@
 	} \
 	\
-	void name##_destroy(name##_t *field, DTOR_T(dtor)) \
+	void name##_destroy(name##_t *field) \
 	{ \
 		if (name##_is_valid(field)) { \
 			int index; \
 			field->magic = 0; \
-			if (dtor) { \
-				for (index = 0; index < field->next; index++) { \
-					if (field->items[index]) \
-						dtor(field->items[index]); \
-				} \
+			for (index = 0; index < field->next; index++) { \
+				if (field->items[index]) \
+					free(field->items[index]); \
 			} \
 			free(field->items); \
@@ -122,10 +116,9 @@
 	} \
 	 \
-	void name##_exclude_index(name##_t *field, int index, DTOR_T(dtor)) \
+	void name##_exclude_index(name##_t *field, int index) \
 	{ \
 		if (name##_is_valid(field) && (index >= 0) && \
 		    (index < field->next) && (field->items[index])) { \
-			if (dtor) \
-				dtor(field->items[index]); \
+			free(field->items[index]); \
 			field->items[index] = NULL; \
 		} \
Index: uspace/lib/c/include/adt/int_map.h
===================================================================
--- uspace/lib/c/include/adt/int_map.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/include/adt/int_map.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -49,8 +49,4 @@
 #define INT_MAP_ITEM_MAGIC_VALUE	0x55667788
 
-/** Generic destructor function pointer. */
-#define DTOR_T(identifier) \
-	void (*identifier)(const void *)
-
 /** Integer to generic type map declaration.
  *
@@ -76,9 +72,9 @@
 	\
 	int name##_add(name##_t *, int, type *); \
-	void name##_clear(name##_t *, DTOR_T()); \
+	void name##_clear(name##_t *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *, DTOR_T()); \
-	void name##_exclude(name##_t *, int, DTOR_T()); \
-	void name##_exclude_index(name##_t *, int, DTOR_T()); \
+	void name##_destroy(name##_t *); \
+	void name##_exclude(name##_t *, int); \
+	void name##_exclude_index(name##_t *, int); \
 	type *name##_find(name##_t *, int); \
 	int name##_update(name##_t *, int, int); \
@@ -86,5 +82,5 @@
 	int name##_initialize(name##_t *); \
 	int name##_is_valid(name##_t *); \
-	void name##_item_destroy(name##_item_t *, DTOR_T()); \
+	void name##_item_destroy(name##_item_t *); \
 	int name##_item_is_valid(name##_item_t *);
 
@@ -119,5 +115,5 @@
 	} \
 	\
-	void name##_clear(name##_t *map, DTOR_T(dtor)) \
+	void name##_clear(name##_t *map) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -126,5 +122,5 @@
 				if (name##_item_is_valid(&map->items[index])) { \
 					name##_item_destroy( \
-					    &map->items[index], dtor); \
+					    &map->items[index]); \
 				} \
 			} \
@@ -139,5 +135,5 @@
 	} \
 	\
-	void name##_destroy(name##_t *map, DTOR_T(dtor)) \
+	void name##_destroy(name##_t *map) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -147,5 +143,5 @@
 				if (name##_item_is_valid(&map->items[index])) { \
 					name##_item_destroy( \
-					    &map->items[index], dtor); \
+					    &map->items[index]); \
 				} \
 			} \
@@ -154,5 +150,5 @@
 	} \
 	\
-	void name##_exclude(name##_t *map, int key, DTOR_T(dtor)) \
+	void name##_exclude(name##_t *map, int key) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -162,16 +158,16 @@
 				    (map->items[index].key == key)) { \
 					name##_item_destroy( \
-					    &map->items[index], dtor); \
-				} \
-			} \
-		} \
-	} \
-	\
-	void name##_exclude_index(name##_t *map, int index, DTOR_T(dtor)) \
+					    &map->items[index]); \
+				} \
+			} \
+		} \
+	} \
+	\
+	void name##_exclude_index(name##_t *map, int index) \
 	{ \
 		if (name##_is_valid(map) && (index >= 0) && \
 		    (index < map->next) && \
 		    name##_item_is_valid(&map->items[index])) { \
-			name##_item_destroy(&map->items[index], dtor); \
+			name##_item_destroy(&map->items[index]); \
 		} \
 	} \
@@ -240,11 +236,10 @@
 	} \
 	\
-	void name##_item_destroy(name##_item_t *item, DTOR_T(dtor)) \
+	void name##_item_destroy(name##_item_t *item) \
 	{ \
 		if (name##_item_is_valid(item)) { \
 			item->magic = 0; \
 			if (item->value) { \
-				if (dtor) \
-					dtor(item->value); \
+				free(item->value); \
 				item->value = NULL; \
 			} \
Index: uspace/lib/c/include/devman.h
===================================================================
--- uspace/lib/c/include/devman.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/include/devman.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -53,6 +53,4 @@
 extern int devman_device_get_handle(const char *, devman_handle_t *,
     unsigned int);
-extern int devman_device_get_handle_by_class(const char *, const char *,
-    devman_handle_t *, unsigned int);
 
 extern int devman_add_device_to_class(devman_handle_t, const char *);
Index: pace/lib/c/include/io/log.h
===================================================================
--- uspace/lib/c/include/io/log.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * 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 libc
- * @{
- */
-
-#ifndef LIBC_IO_LOG_H_
-#define LIBC_IO_LOG_H_
-
-#include <stdarg.h>
-
-typedef enum {
-	LVL_FATAL,
-	LVL_ERROR,
-	LVL_WARN,
-	LVL_NOTE,
-	LVL_DEBUG,
-	LVL_DEBUG2,
-
-	/** For checking range of values */
-	LVL_LIMIT
-} log_level_t;
-
-extern int log_init(const char *, log_level_t);
-extern void log_msg(log_level_t, const char *, ...);
-extern void log_msgv(log_level_t, const char *, va_list);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/devman.h
===================================================================
--- uspace/lib/c/include/ipc/devman.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/include/ipc/devman.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -148,6 +148,5 @@
 
 typedef enum {
-	DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
-	DEVMAN_DEVICE_GET_HANDLE_BY_CLASS
+	DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD
 } client_to_devman_t;
 
Index: uspace/lib/c/include/ipc/services.h
===================================================================
--- uspace/lib/c/include/ipc/services.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/c/include/ipc/services.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -47,5 +47,8 @@
 	SERVICE_DEVMAP,
 	SERVICE_DEVMAN,
-	SERVICE_IRC,
+	SERVICE_FHC,
+	SERVICE_OBIO,
+	SERVICE_APIC,
+	SERVICE_I8259,
 	SERVICE_CLIPBOARD,
 	SERVICE_NETWORKING,
Index: uspace/lib/drv/Makefile
===================================================================
--- uspace/lib/drv/Makefile	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/drv/Makefile	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -35,5 +35,4 @@
 	generic/driver.c \
 	generic/dev_iface.c \
-	generic/log.c \
 	generic/remote_hw_res.c \
 	generic/remote_char_dev.c
Index: uspace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/drv/generic/driver.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -273,6 +273,12 @@
 	
 	res = driver->driver_ops->add_device(dev);
-	if (res != EOK)
+	if (res == EOK) {
+		printf("%s: new device with handle=%" PRIun " was added.\n",
+		    driver->name, dev_handle);
+	} else {
+		printf("%s: failed to add a new device with handle = %" PRIun ".\n",
+		    driver->name, dev_handle);
 		delete_device(dev);
+	}
 	
 	async_answer_0(iid, res);
@@ -402,5 +408,5 @@
 			    get_remote_method(rem_iface, iface_method_idx);
 			if (iface_method_ptr == NULL) {
-				/* The interface has not such method */
+				// the interface has not such method
 				printf("%s: driver_connection_gen error - "
 				    "invalid interface method.", driver->name);
Index: pace/lib/drv/generic/log.c
===================================================================
--- uspace/lib/drv/generic/log.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * 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 libdrv
- * @{
- */
-
-#include <io/log.h>
-#include <stdarg.h>
-
-#include <ddf/log.h>
-
-/** Initialize the logging system.
- *
- * @param drv_name	Driver name, will be printed as part of message
- * @param level		Minimum message level to print
- */
-int ddf_log_init(const char *drv_name, log_level_t level)
-{
-	return log_init(drv_name, level);
-}
-
-/** Log a driver message.
- *
- * @param level		Message verbosity level. Message is only printed
- *			if verbosity is less than or equal to current
- *			reporting level.
- * @param fmt		Format string (no trailing newline)
- */
-void ddf_msg(log_level_t level, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	log_msgv(level, fmt, args);
-	va_end(args);
-}
-
-/** @}
- */
Index: pace/lib/drv/include/ddf/log.h
===================================================================
--- uspace/lib/drv/include/ddf/log.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * 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 libdrv
- * @{
- */
-
-#ifndef DDF_LOG_H_
-#define DDF_LOG_H_
-
-#include <io/log.h>
-
-extern int ddf_log_init(const char *, log_level_t);
-extern void ddf_msg(log_level_t, const char *, ...);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/fs/libfs.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -391,6 +391,4 @@
 						if (lflag & L_CREATE)
 							(void) ops->destroy(fn);
-						else
-							(void) ops->node_put(fn);
 						async_answer_0(rid, rc);
 					} else {
@@ -475,6 +473,4 @@
 					if (lflag & L_CREATE)
 						(void) ops->destroy(fn);
-					else
-						(void) ops->node_put(fn);
 					async_answer_0(rid, rc);
 				} else {
Index: uspace/lib/net/generic/generic.c
===================================================================
--- uspace/lib/net/generic/generic.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/generic/generic.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -106,5 +106,5 @@
 		return EBADMEM;
 
-	/* Request the address */
+	// request the address
 	message_id = async_send_1(phone, (sysarg_t) message,
 	    (sysarg_t) device_id, NULL);
@@ -112,7 +112,7 @@
 	async_wait_for(message_id, &result);
 
-	/* If not successful */
+	// if not successful
 	if ((string == EOK) && (result != EOK)) {
-		/* Clear the data */
+		// clear the data
 		free(*address);
 		free(*data);
@@ -242,5 +242,5 @@
 		return EBADMEM;
 
-	/* Request the translation */
+	// request the translation
 	message_id = async_send_3(phone, (sysarg_t) message,
 	    (sysarg_t) device_id, (sysarg_t) count, (sysarg_t) service, NULL);
@@ -249,7 +249,7 @@
 	async_wait_for(message_id, &result);
 
-	/* If not successful */
+	// if not successful
 	if ((string == EOK) && (result != EOK)) {
-		/* Clear the data */
+		// clear the data
 		free(*translation);
 		free(*data);
Index: uspace/lib/net/generic/net_checksum.c
===================================================================
--- uspace/lib/net/generic/net_checksum.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/generic/net_checksum.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -52,5 +52,5 @@
 uint16_t compact_checksum(uint32_t sum)
 {
-	/* Shorten to the 16 bits */
+	// shorten to the 16 bits
 	while (sum >> 16)
 		sum = (sum & 0xffff) + (sum >> 16);
@@ -72,9 +72,9 @@
 	size_t index;
 
-	/* Sum all the 16 bit fields */
+	// sum all the 16 bit fields
 	for (index = 0; index + 1 < length; index += 2)
 		seed += (data[index] << 8) + data[index + 1];
 
-	/* Last odd byte with zero padding */
+	// last odd byte with zero padding
 	if (index + 1 == length)
 		seed += data[index] << 8;
@@ -94,39 +94,39 @@
 	size_t index;
 
-	/* Process full bytes */
+	// process full bytes
 	while (length >= 8) {
-		/* Add the data */
+		// add the data
 		seed ^= (*data) << 24;
 		
-		/* For each added bit */
+		// for each added bit
 		for (index = 0; index < 8; ++index) {
-			/* If the first bit is set */
+			// if the first bit is set
 			if (seed & 0x80000000) {
-				/* Shift and divide the checksum */
+				// shift and divide the checksum
 				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
 			} else {
-				/* shift otherwise */
+				// shift otherwise
 				seed <<= 1;
 			}
 		}
 		
-		/* Move to the next byte */
+		// move to the next byte
 		++data;
 		length -= 8;
 	}
 
-	/* Process the odd bits */
+	// process the odd bits
 	if (length > 0) {
-		/* Add the data with zero padding */
+		// add the data with zero padding
 		seed ^= ((*data) & (0xff << (8 - length))) << 24;
 		
-		/* For each added bit */
+		// for each added bit
 		for (index = 0; index < length; ++index) {
-			/* If the first bit is set */
+			// if the first bit is set
 			if (seed & 0x80000000) {
-				/* Shift and divide the checksum */
+				// shift and divide the checksum
 				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
 			} else {
-				/* Shift otherwise */
+				// shift otherwise
 				seed <<= 1;
 			}
@@ -148,38 +148,38 @@
 	size_t index;
 
-	/* Process full bytes */
+	// process full bytes
 	while (length >= 8) {
-		/* Add the data */
+		// add the data
 		seed ^= (*data);
 		
-		/* For each added bit */
+		// for each added bit
 		for (index = 0; index < 8; ++index) {
-			/* If the last bit is set */
+			// if the last bit is set
 			if (seed & 1) {
-				/* Shift and divide the checksum */
+				// shift and divide the checksum
 				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
 			} else {
-				/* Shift otherwise */
+				// shift otherwise
 				seed >>= 1;
 			}
 		}
 		
-		/* Move to the next byte */
+		// move to the next byte
 		++data;
 		length -= 8;
 	}
 
-	/* Process the odd bits */
+	// process the odd bits
 	if (length > 0) {
-		/* Add the data with zero padding */
+		// add the data with zero padding
 		seed ^= (*data) >> (8 - length);
 		
 		for (index = 0; index < length; ++index) {
-			/* If the last bit is set */
+			// if the last bit is set
 			if (seed & 1) {
-				/* Shift and divide the checksum */
+				// shift and divide the checksum
 				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
 			} else {
-				/* Shift otherwise */
+				// shift otherwise
 				seed >>= 1;
 			}
@@ -198,5 +198,5 @@
 uint16_t flip_checksum(uint16_t checksum)
 {
-	/* Flip, zero is returned as 0xFFFF (not flipped) */
+	// flip, zero is returned as 0xFFFF (not flipped)
 	checksum = ~checksum;
 	return checksum ? checksum : IP_CHECKSUM_ZERO;
@@ -216,5 +216,5 @@
 uint16_t ip_checksum(uint8_t *data, size_t length)
 {
-	/* Compute, compact and flip the data checksum */
+	// compute, compact and flip the data checksum
 	return flip_checksum(compact_checksum(compute_checksum(0, data,
 	    length)));
Index: uspace/lib/net/generic/packet_client.c
===================================================================
--- uspace/lib/net/generic/packet_client.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/generic/packet_client.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -267,5 +267,5 @@
 		return NULL;
 
-	/* Get a new packet */
+	// get a new packet
 	copy = packet_get_4_remote(phone, PACKET_DATA_LENGTH(packet),
 	    PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix,
@@ -274,10 +274,10 @@
 		return NULL;
 
-	/* Get addresses */
+	// get addresses
 	addrlen = packet_get_addr(packet, &src, &dest);
-	/* Copy data */
+	// copy data
 	if ((packet_copy_data(copy, packet_get_data(packet),
 	    PACKET_DATA_LENGTH(packet)) == EOK) &&
-	    /* Copy addresses if present */
+	    // copy addresses if present
 	    ((addrlen <= 0) ||
 	    (packet_set_addr(copy, src, dest, addrlen) == EOK))) {
Index: uspace/lib/net/il/ip_client.c
===================================================================
--- uspace/lib/net/il/ip_client.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/il/ip_client.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -123,5 +123,5 @@
 		return EOK;
 
-	/* TODO IPv6 */
+	// TODO IPv6
 /*	case AF_INET6:
 		if (addrlen != sizeof(struct sockaddr_in6))
@@ -159,8 +159,6 @@
 	size_t padding;
 
-	/*
-	 * Compute the padding if IP options are set
-	 * multiple of 4 bytes
-	 */
+	// compute the padding if IP options are set
+	// multiple of 4 bytes
 	padding =  ipopt_length % 4;
 	if (padding) {
@@ -169,14 +167,14 @@
 	}
 
-	/* Prefix the header */
+	// prefix the header
 	data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
 	if (!data)
 		return ENOMEM;
 
-	/* Add the padding */
+	// add the padding
 	while (padding--)
 		data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
 
-	/* Set the header */
+	// set the header
 	header = (ip_header_t *) data;
 	header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) +
@@ -258,5 +256,5 @@
 		header_in->data_length = htons(data_length);
 		return EOK;
-	/* TODO IPv6 */
+	// TODO IPv6
 	} else {
 		return EINVAL;
Index: uspace/lib/net/include/ip_client.h
===================================================================
--- uspace/lib/net/include/ip_client.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/include/ip_client.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -54,5 +54,5 @@
     socklen_t, struct sockaddr *, socklen_t, size_t, void **, size_t *);
 
-/* TODO ipopt manipulation */
+// TODO ipopt manipulation
 
 #endif
Index: uspace/lib/net/tl/icmp_client.c
===================================================================
--- uspace/lib/net/tl/icmp_client.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/tl/icmp_client.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -81,5 +81,5 @@
 		*mtu = header->un.frag.mtu;
 
-	/* Remove debug dump */
+	// remove debug dump
 #ifdef CONFIG_DEBUG
 	printf("ICMP error %d (%d) in packet %d\n", header->type, header->code,
Index: uspace/lib/net/tl/socket_core.c
===================================================================
--- uspace/lib/net/tl/socket_core.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/tl/socket_core.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -91,11 +91,11 @@
 	int packet_id;
 
-	/* If bound */
+	// if bound
 	if (socket->port) {
-		/* Release the port */
+		// release the port
 		socket_port_release(global_sockets, socket);
 	}
 	
-	/* Release all received packets */
+	// release all received packets
 	while ((packet_id = dyn_fifo_pop(&socket->received)) >= 0)
 		pq_release_remote(packet_phone, packet_id);
@@ -107,5 +107,5 @@
 		socket_release(socket);
 
-	socket_cores_exclude(local_sockets, socket->socket_id, free);
+	socket_cores_exclude(local_sockets, socket->socket_id);
 }
 
@@ -166,5 +166,5 @@
 	int rc;
 
-	/* Create a wrapper */
+	// create a wrapper
 	socket_ref = malloc(sizeof(*socket_ref));
 	if (!socket_ref)
@@ -172,5 +172,5 @@
 
 	*socket_ref = socket;
-	/* Add the wrapper */
+	// add the wrapper
 	rc = socket_port_map_add(&socket_port->map, key, key_length,
 	    socket_ref);
@@ -206,5 +206,5 @@
 	int rc;
 
-	/* Create a wrapper */
+	// create a wrapper
 	socket_port = malloc(sizeof(*socket_port));
 	if (!socket_port)
@@ -221,5 +221,5 @@
 		goto fail;
 	
-	/* Register the incoming port */
+	// register the incomming port
 	rc = socket_ports_add(global_sockets, port, socket_port);
 	if (rc < 0)
@@ -230,5 +230,5 @@
 
 fail:
-	socket_port_map_destroy(&socket_port->map, free);
+	socket_port_map_destroy(&socket_port->map);
 	free(socket_port);
 	return rc;
@@ -277,25 +277,25 @@
 		
 		address_in = (struct sockaddr_in *) addr;
-		/* Find the socket */
+		// find the socket
 		socket = socket_cores_find(local_sockets, socket_id);
 		if (!socket)
 			return ENOTSOCK;
 		
-		/* Bind a free port? */
+		// bind a free port?
 		if (address_in->sin_port <= 0)
 			return socket_bind_free_port(global_sockets, socket,
 			     free_ports_start, free_ports_end, last_used_port);
 		
-		/* Try to find the port */
+		// try to find the port
 		socket_port = socket_ports_find(global_sockets,
 		    ntohs(address_in->sin_port));
 		if (socket_port) {
-			/* Already used */
+			// already used
 			return EADDRINUSE;
 		}
 		
-		/* If bound */
+		// if bound
 		if (socket->port) {
-			/* Release the port */
+			// release the port
 			socket_port_release(global_sockets, socket);
 		}
@@ -306,5 +306,5 @@
 		
 	case AF_INET6:
-		/* TODO IPv6 */
+		// TODO IPv6
 		break;
 	}
@@ -333,5 +333,5 @@
 	int index;
 
-	/* From the last used one */
+	// from the last used one
 	index = last_used_port;
 	
@@ -339,18 +339,18 @@
 		++index;
 		
-		/* Till the range end */
+		// til the range end
 		if (index >= free_ports_end) {
-			/* Start from the range beginning */
+			// start from the range beginning
 			index = free_ports_start - 1;
 			do {
 				++index;
-				/* Till the last used one */
+				// til the last used one
 				if (index >= last_used_port) {
-					/* None found */
+					// none found
 					return ENOTCONN;
 				}
 			} while (socket_ports_find(global_sockets, index));
 			
-			/* Found, break immediately */
+			// found, break immediately
 			break;
 		}
@@ -384,5 +384,5 @@
 			socket_id = 1;
 			++count;
-		/* Only this branch for last_id */
+		// only this branch for last_id
 		} else {
 			if (socket_id < INT_MAX) {
@@ -425,5 +425,5 @@
 		return EINVAL;
 	
-	/* Store the socket */
+	// store the socket
 	if (*socket_id <= 0) {
 		positive = (*socket_id == 0);
@@ -441,5 +441,5 @@
 		return ENOMEM;
 	
-	/* Initialize */
+	// initialize
 	socket->phone = app_phone;
 	socket->port = -1;
@@ -493,10 +493,10 @@
 	int accepted_id;
 
-	/* Find the socket */
+	// find the socket
 	socket = socket_cores_find(local_sockets, socket_id);
 	if (!socket)
 		return ENOTSOCK;
 	
-	/* Destroy all accepted sockets */
+	// destroy all accepted sockets
 	while ((accepted_id = dyn_fifo_pop(&socket->accepted)) >= 0)
 		socket_destroy(packet_phone, accepted_id, local_sockets,
@@ -535,13 +535,13 @@
 	next_packet = pq_next(packet);
 	if (!next_packet) {
-		/* Write all if only one fragment */
+		// write all if only one fragment
 		rc = data_reply(packet_get_data(packet),
 		    packet_get_data_length(packet));
 		if (rc != EOK)
 			return rc;
-		/* Store the total length */
+		// store the total length
 		*length = packet_get_data_length(packet);
 	} else {
-		/* Count the packet fragments */
+		// count the packet fragments
 		fragments = 1;
 		next_packet = pq_next(packet);
@@ -549,5 +549,5 @@
 			++fragments;
 		
-		/* Compute and store the fragment lengths */
+		// compute and store the fragment lengths
 		lengths = (size_t *) malloc(sizeof(size_t) * fragments +
 		    sizeof(size_t));
@@ -565,5 +565,5 @@
 		}
 		
-		/* Write the fragment lengths */
+		// write the fragment lengths
 		rc = data_reply(lengths, sizeof(int) * (fragments + 1));
 		if (rc != EOK) {
@@ -573,5 +573,5 @@
 		next_packet = packet;
 		
-		/* Write the fragments */
+		// write the fragments
 		for (index = 0; index < fragments; ++index) {
 			rc = data_reply(packet_get_data(next_packet),
@@ -584,5 +584,5 @@
 		}
 		
-		/* Store the total length */
+		// store the total length
 		*length = lengths[fragments];
 		free(lengths);
@@ -636,8 +636,8 @@
 		return;
 	
-	/* Find ports */
+	// find ports
 	socket_port = socket_ports_find(global_sockets, socket->port);
 	if (socket_port) {
-		/* Find the socket */
+		// find the socket
 		socket_ref = socket_port_map_find(&socket_port->map,
 		    socket->key, socket->key_length);
@@ -646,15 +646,15 @@
 			--socket_port->count;
 			
-			/* Release if empty */
+			// release if empty
 			if (socket_port->count <= 0) {
-				/* Destroy the map */
-				socket_port_map_destroy(&socket_port->map, free);
-				/* Release the port */
+				// destroy the map
+				socket_port_map_destroy(&socket_port->map);
+				// release the port
 				socket_ports_exclude(global_sockets,
-				    socket->port, free);
+				    socket->port);
 			} else {
-				/* Remove */
+				// remove
 				socket_port_map_exclude(&socket_port->map,
-				    socket->key, socket->key_length, free);
+				    socket->key, socket->key_length);
 			}
 		}
@@ -685,10 +685,10 @@
 	int rc;
 
-	/* Find ports */
+	// find ports
 	socket_port = socket_ports_find(global_sockets, port);
 	if (!socket_port)
 		return ENOENT;
 	
-	/* Add the socket */
+	// add the socket
 	rc = socket_port_add_core(socket_port, socket, key, key_length);
 	if (rc != EOK)
Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/net/tl/tl_common.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -182,5 +182,5 @@
 			else
 				packet_dimensions_exclude(packet_dimensions,
-				    DEVICE_INVALID_ID, free);
+				    DEVICE_INVALID_ID);
 		}
 	}
@@ -255,5 +255,5 @@
 	int length;
 
-	/* Detach the first packet and release the others */
+	// detach the first packet and release the others
 	next = pq_detach(packet);
 	if (next)
@@ -262,8 +262,6 @@
 	length = packet_get_addr(packet, &src, NULL);
 	if ((length > 0) && (!error) && (icmp_phone >= 0) &&
-	    /*
-	     * Set both addresses to the source one (avoids the source address
-	     * deletion before setting the destination one)
-	     */
+	    // set both addresses to the source one (avoids the source address
+	    // deletion before setting the destination one)
 	    (packet_set_addr(packet, src, src, (size_t) length) == EOK)) {
 		return EOK;
@@ -301,9 +299,9 @@
 		return EINVAL;
 
-	/* Get the data length */
+	// get the data length
 	if (!async_data_write_receive(&callid, &length))
 		return EINVAL;
 
-	/* Get a new packet */
+	// get a new packet
 	*packet = packet_get_4_remote(packet_phone, length, dimension->addr_len,
 	    prefix + dimension->prefix, dimension->suffix);
@@ -311,5 +309,5 @@
 		return ENOMEM;
 
-	/* Allocate space in the packet */
+	// allocate space in the packet
 	data = packet_suffix(*packet, length);
 	if (!data) {
@@ -318,5 +316,5 @@
 	}
 
-	/* Read the data into the packet */
+	// read the data into the packet
 	rc = async_data_write_finalize(callid, data, length);
 	if (rc != EOK) {
@@ -325,5 +323,5 @@
 	}
 	
-	/* Set the packet destination address */
+	// set the packet destination address
 	rc = packet_set_addr(*packet, NULL, (uint8_t *) addr, addrlen);
 	if (rc != EOK) {
Index: uspace/lib/packet/generic/packet_server.c
===================================================================
--- uspace/lib/packet/generic/packet_server.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/packet/generic/packet_server.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -112,9 +112,9 @@
     size_t max_content, size_t max_suffix)
 {
-	/* Clear the packet content */
+	// clear the packet content
 	bzero(((void *) packet) + sizeof(packet_t),
 	    packet->length - sizeof(packet_t));
 	
-	/* Clear the packet header */
+	// clear the packet header
 	packet->order = 0;
 	packet->metric = 0;
@@ -151,5 +151,5 @@
 	assert(fibril_mutex_is_locked(&ps_globals.lock));
 
-	/* Already locked */
+	// already locked
 	packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE,
 	    MAP_SHARED | MAP_ANONYMOUS, 0, 0);
Index: uspace/lib/softint/generic/multiplication.c
===================================================================
--- uspace/lib/softint/generic/multiplication.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/lib/softint/generic/multiplication.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -109,5 +109,5 @@
 	 * result does not fit in signed one */
 	if (SOFTINT_CHECK_OF && ((t2 < t1) || (t2 & (1ull << 63)))) {
-		/* Error, overflow */
+		// error, overflow
 		return (neg ? INT64_MIN : INT64_MAX);
 	}
Index: uspace/srv/bd/ata_bd/ata_bd.c
===================================================================
--- uspace/srv/bd/ata_bd/ata_bd.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/bd/ata_bd/ata_bd.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -372,5 +372,4 @@
 	uint16_t w;
 	uint8_t c;
-	uint16_t bc;
 	size_t pos, len;
 	int rc;
@@ -388,24 +387,11 @@
 	} else if (rc == EIO) {
 		/*
-		 * There is something, but not a register device. Check to see
-		 * whether the IDENTIFY command left the packet signature in
-		 * the registers in case this is a packet device.
-		 *
-		 * According to the ATA specification, the LBA low and
-		 * interrupt reason registers should be set to 0x01. However,
-		 * there are many devices that do not follow this and only set
-		 * the byte count registers. So, only check these.
+		 * There is something, but not a register device.
+		 * It could be a packet device.
 		 */
-		bc = ((uint16_t)pio_read_8(&cmd->cylinder_high) << 8) |
-		    pio_read_8(&cmd->cylinder_low);
-
-		if (bc == PDEV_SIGNATURE_BC) {
-			rc = identify_pkt_dev(disk_id, &idata);
-			if (rc == EOK) {
-				/* We have a packet device. */
-				d->dev_type = ata_pkt_dev;
-			} else {
-				return EIO;
-			}
+		rc = identify_pkt_dev(disk_id, &idata);
+		if (rc == EOK) {
+			/* We have a packet device. */
+			d->dev_type = ata_pkt_dev;
 		} else {
 			/* Nope. Something's there, but not recognized. */
@@ -417,4 +403,5 @@
 	}
 
+	printf("device caps: 0x%04x\n", idata.caps);
 	if (d->dev_type == ata_pkt_dev) {
 		/* Packet device */
@@ -579,9 +566,8 @@
 
 	/*
-	 * Do not wait for DRDY to be set in case this is a packet device.
-	 * We determine whether the device is present by waiting for DRQ to be
-	 * set after issuing the command.
+	 * This is where we would most likely expect a non-existing device to
+	 * show up by not setting SR_DRDY.
 	 */
-	if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
+	if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
 		return ETIMEOUT;
 
@@ -591,20 +577,15 @@
 		return ETIMEOUT;
 
-	/*
-	 * If ERR is set, this may be a packet device, so return EIO to cause
-	 * the caller to check for one.
-	 */
+	/* Read data from the disk buffer. */
+
+	if ((status & SR_DRQ) != 0) {
+		for (i = 0; i < identify_data_size / 2; i++) {
+			data = pio_read_16(&cmd->data_port);
+			((uint16_t *) buf)[i] = data;
+		}
+	}
+
 	if ((status & SR_ERR) != 0) {
 		return EIO;
-	}
-
-	if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_PROBE) != EOK)
-		return ETIMEOUT;
-
-	/* Read data from the disk buffer. */
-
-	for (i = 0; i < identify_data_size / 2; i++) {
-		data = pio_read_16(&cmd->data_port);
-		((uint16_t *) buf)[i] = data;
 	}
 
Index: uspace/srv/bd/ata_bd/ata_hw.h
===================================================================
--- uspace/srv/bd/ata_bd/ata_hw.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/bd/ata_bd/ata_hw.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -293,12 +293,4 @@
 };
 
-enum ata_pdev_signature {
-	/**
-	 * Signature put by a packet device in byte count register
-	 * in response to Identify command.
-	 */
-	PDEV_SIGNATURE_BC	= 0xEB14
-};
-
 #endif
 
Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/devman/devman.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -34,5 +34,4 @@
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <io/log.h>
 #include <ipc/driver.h>
 #include <ipc/devman.h>
@@ -147,6 +146,6 @@
 	fibril_mutex_unlock(&drivers_list->drivers_mutex);
 
-	log_msg(LVL_NOTE, "Driver `%s' was added to the list of available "
-	    "drivers.", drv->name);
+	printf(NAME": the '%s' driver was added to the list of available "
+	    "drivers.\n", drv->name);
 }
 
@@ -238,5 +237,5 @@
 bool read_match_ids(const char *conf_path, match_id_list_t *ids)
 {
-	log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
+	printf(NAME ": read_match_ids conf_path = %s.\n", conf_path);
 	
 	bool suc = false;
@@ -248,6 +247,5 @@
 	fd = open(conf_path, O_RDONLY);
 	if (fd < 0) {
-		log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.",
-		    conf_path, str_error(fd));
+		printf(NAME ": unable to open %s\n", conf_path);
 		goto cleanup;
 	}
@@ -257,6 +255,5 @@
 	lseek(fd, 0, SEEK_SET);
 	if (len == 0) {
-		log_msg(LVL_ERROR, "Configuration file '%s' is empty.",
-		    conf_path);
+		printf(NAME ": configuration file '%s' is empty.\n", conf_path);
 		goto cleanup;
 	}
@@ -264,15 +261,14 @@
 	buf = malloc(len + 1);
 	if (buf == NULL) {
-		log_msg(LVL_ERROR, "Memory allocation failed when parsing file "
-		    "'%s'.", conf_path);
+		printf(NAME ": memory allocation failed when parsing file "
+		    "'%s'.\n", conf_path);
 		goto cleanup;
 	}
 	
-	ssize_t read_bytes = safe_read(fd, buf, len);
-	if (read_bytes <= 0) {
-		log_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path);
+	if (read(fd, buf, len) <= 0) {
+		printf(NAME ": unable to read file '%s'.\n", conf_path);
 		goto cleanup;
 	}
-	buf[read_bytes] = 0;
+	buf[len] = 0;
 	
 	suc = parse_match_ids(buf, ids);
@@ -309,5 +305,5 @@
 bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
 {
-	log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
+	printf(NAME ": get_driver_info base_path = %s, name = %s.\n",
 	    base_path, name);
 	
@@ -341,6 +337,5 @@
 	struct stat s;
 	if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */
-		log_msg(LVL_ERROR, "Driver not found at path `%s'.",
-		    drv->binary_path);
+		printf(NAME ": driver not found at path %s.", drv->binary_path);
 		goto cleanup;
 	}
@@ -369,5 +364,5 @@
 int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
 {
-	log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
+	printf(NAME ": lookup_available_drivers, dir = %s \n", dir_path);
 	
 	int drv_cnt = 0;
@@ -403,5 +398,5 @@
 	dev_node_t *dev;
 	
-	log_msg(LVL_DEBUG, "create_root_nodes()");
+	printf(NAME ": create_root_nodes\n");
 	
 	fibril_rwlock_write_lock(&tree->rwlock);
@@ -488,6 +483,6 @@
 void attach_driver(dev_node_t *dev, driver_t *drv)
 {
-	log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
-	    dev->pfun->pathname, drv->name);
+	printf(NAME ": attach_driver %s to device %s\n",
+	    drv->name, dev->pfun->pathname);
 	
 	fibril_mutex_lock(&drv->driver_mutex);
@@ -511,10 +506,10 @@
 	assert(fibril_mutex_is_locked(&drv->driver_mutex));
 	
-	log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
+	printf(NAME ": start_driver '%s'\n", drv->name);
 	
 	rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL);
 	if (rc != EOK) {
-		log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
-		    drv->name, drv->binary_path, str_error(rc));
+		printf(NAME ": error spawning %s (%s)\n",
+		    drv->name, str_error(rc));
 		return false;
 	}
@@ -578,6 +573,5 @@
 	int phone;
 
-	log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
-	    driver->name);
+	printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name);
 
 	fibril_mutex_lock(&driver->driver_mutex);
@@ -646,5 +640,5 @@
 	 * immediately and possibly started here as well.
 	 */
-	log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
+	printf(NAME ": driver %s goes into running state.\n", driver->name);
 	driver->state = DRIVER_RUNNING;
 
@@ -663,6 +657,5 @@
 void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
 {
-	log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
-	    driver->name);
+	printf(NAME ": initialize_running_driver (`%s')\n", driver->name);
 	
 	/*
@@ -754,6 +747,6 @@
 	 * access any structures that would affect driver_t.
 	 */
-	log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
-	    drv->name, dev->pfun->name);
+	printf(NAME ": add_device (driver `%s', device `%s')\n", drv->name,
+	    dev->pfun->name);
 	
 	sysarg_t rc;
@@ -816,5 +809,5 @@
 	driver_t *drv = find_best_match_driver(drivers_list, dev);
 	if (drv == NULL) {
-		log_msg(LVL_ERROR, "No driver found for device `%s'.",
+		printf(NAME ": no driver found for device '%s'.\n",
 		    dev->pfun->pathname);
 		return false;
@@ -854,5 +847,5 @@
 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
 {
-	log_msg(LVL_DEBUG, "init_device_tree()");
+	printf(NAME ": init_device_tree.\n");
 	
 	tree->current_handle = 0;
@@ -1033,5 +1026,5 @@
 	fun->pathname = (char *) malloc(pathsize);
 	if (fun->pathname == NULL) {
-		log_msg(LVL_ERROR, "Failed to allocate device path.");
+		printf(NAME ": failed to allocate device path.\n");
 		return false;
 	}
@@ -1064,7 +1057,4 @@
 	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
 	
-	log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
-	    dev, pfun, pfun->pathname);
-
 	/* Add the node to the handle-to-node map. */
 	dev->handle = ++tree->current_handle;
@@ -1073,4 +1063,5 @@
 
 	/* Add the node to the list of its parent's children. */
+	printf("insert_dev_node: dev=%p, dev->pfun := %p\n", dev, pfun);
 	dev->pfun = pfun;
 	pfun->child = dev;
@@ -1132,11 +1123,4 @@
 fun_node_t *find_fun_node_by_path(dev_tree_t *tree, char *path)
 {
-	assert(path != NULL);
-
-	bool is_absolute = path[0] == '/';
-	if (!is_absolute) {
-		return NULL;
-	}
-
 	fibril_rwlock_read_lock(&tree->rwlock);
 	
@@ -1148,5 +1132,5 @@
 	char *rel_path = path;
 	char *next_path_elem = NULL;
-	bool cont = true;
+	bool cont = (rel_path[0] == '/');
 	
 	while (cont && fun != NULL) {
@@ -1173,63 +1157,4 @@
 }
 
-/** Find function with a specified name belonging to given device.
- *
- * Device tree rwlock should be held at least for reading.
- *
- * @param dev Device the function belongs to.
- * @param name Function name (not path).
- * @return Function node.
- * @retval NULL No function with given name.
- */
-fun_node_t *find_fun_node_in_device(dev_node_t *dev, const char *name)
-{
-	assert(dev != NULL);
-	assert(name != NULL);
-
-	fun_node_t *fun;
-	link_t *link;
-
-	for (link = dev->functions.next;
-	    link != &dev->functions;
-	    link = link->next) {
-		fun = list_get_instance(link, fun_node_t, dev_functions);
-
-		if (str_cmp(name, fun->name) == 0)
-			return fun;
-	}
-
-	return NULL;
-}
-
-/** Find function node by its class name and index. */
-fun_node_t *find_fun_node_by_class(class_list_t *class_list,
-    const char *class_name, const char *dev_name)
-{
-	assert(class_list != NULL);
-	assert(class_name != NULL);
-	assert(dev_name != NULL);
-
-	fibril_rwlock_read_lock(&class_list->rwlock);
-
-	dev_class_t *cl = find_dev_class_no_lock(class_list, class_name);
-	if (cl == NULL) {
-		fibril_rwlock_read_unlock(&class_list->rwlock);
-		return NULL;
-	}
-
-	dev_class_info_t *dev = find_dev_in_class(cl, dev_name);
-	if (dev == NULL) {
-		fibril_rwlock_read_unlock(&class_list->rwlock);
-		return NULL;
-	}
-
-	fun_node_t *fun = dev->fun;
-
-	fibril_rwlock_read_unlock(&class_list->rwlock);
-
-	return fun;
-}
-
-
 /** Find child function node with a specified name.
  *
@@ -1242,5 +1167,19 @@
 fun_node_t *find_node_child(fun_node_t *pfun, const char *name)
 {
-	return find_fun_node_in_device(pfun->child, name);
+	fun_node_t *fun;
+	link_t *link;
+	
+	link = pfun->child->functions.next;
+	
+	while (link != &pfun->child->functions) {
+		fun = list_get_instance(link, fun_node_t, dev_functions);
+		
+		if (str_cmp(name, fun->name) == 0)
+			return fun;
+		
+		link = link->next;
+	}
+	
+	return NULL;
 }
 
@@ -1404,24 +1343,4 @@
 }
 
-dev_class_info_t *find_dev_in_class(dev_class_t *dev_class, const char *dev_name)
-{
-	assert(dev_class != NULL);
-	assert(dev_name != NULL);
-
-	link_t *link;
-	for (link = dev_class->devices.next;
-	    link != &dev_class->devices;
-	    link = link->next) {
-		dev_class_info_t *dev = list_get_instance(link,
-		    dev_class_info_t, link);
-
-		if (str_cmp(dev->dev_name, dev_name) == 0) {
-			return dev;
-		}
-	}
-
-	return NULL;
-}
-
 void init_class_list(class_list_t *class_list)
 {
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/devman/devman.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -338,6 +338,4 @@
 extern fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle);
 extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *);
-extern fun_node_t *find_fun_node_in_device(dev_node_t *, const char *);
-extern fun_node_t *find_fun_node_by_class(class_list_t *, const char *, const char *);
 
 /* Device tree */
@@ -361,5 +359,4 @@
 extern dev_class_t *get_dev_class(class_list_t *, char *);
 extern dev_class_t *find_dev_class_no_lock(class_list_t *, const char *);
-extern dev_class_info_t *find_dev_in_class(dev_class_t *, const char *);
 extern void add_dev_class_no_lock(class_list_t *, dev_class_t *);
 
Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/devman/main.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -43,5 +43,4 @@
 #include <stdio.h>
 #include <errno.h>
-#include <str_error.h>
 #include <bool.h>
 #include <fibril_synch.h>
@@ -52,5 +51,4 @@
 #include <sys/stat.h>
 #include <ctype.h>
-#include <io/log.h>
 #include <ipc/devman.h>
 #include <ipc/driver.h>
@@ -73,5 +71,5 @@
 	driver_t *driver = NULL;
 
-	log_msg(LVL_DEBUG, "devman_driver_register");
+	printf(NAME ": devman_driver_register \n");
 	
 	iid = async_get_call(&icall);
@@ -90,5 +88,5 @@
 	}
 
-	log_msg(LVL_DEBUG, "The `%s' driver is trying to register.",
+	printf(NAME ": the %s driver is trying to register by the service.\n",
 	    drv_name);
 	
@@ -97,5 +95,5 @@
 	
 	if (driver == NULL) {
-		log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name);
+		printf(NAME ": no driver named %s was found.\n", drv_name);
 		free(drv_name);
 		drv_name = NULL;
@@ -108,6 +106,5 @@
 	
 	/* Create connection to the driver. */
-	log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.",
-	    driver->name);
+	printf(NAME ":  creating connection to the %s driver.\n", driver->name);
 	ipc_call_t call;
 	ipc_callid_t callid = async_get_call(&call);
@@ -121,6 +118,5 @@
 	set_driver_phone(driver, IPC_GET_ARG5(call));
 	
-	log_msg(LVL_NOTE, 
-	    "The `%s' driver was successfully registered as running.",
+	printf(NAME ": the %s driver was successfully registered as running.\n",
 	    driver->name);
 	
@@ -146,6 +142,6 @@
 	callid = async_get_call(&call);
 	if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
-		log_msg(LVL_ERROR, 
-		    "Invalid protocol when trying to receive match id.");
+		printf(NAME ": ERROR: devman_receive_match_id - invalid "
+		    "protocol.\n");
 		async_answer_0(callid, EINVAL); 
 		delete_match_id(match_id);
@@ -154,5 +150,6 @@
 	
 	if (match_id == NULL) {
-		log_msg(LVL_ERROR, "Failed to allocate match id.");
+		printf(NAME ": ERROR: devman_receive_match_id - failed to "
+		    "allocate match id.\n");
 		async_answer_0(callid, ENOMEM);
 		return ENOMEM;
@@ -168,6 +165,6 @@
 	if (rc != EOK) {
 		delete_match_id(match_id);
-		log_msg(LVL_ERROR, "Failed to receive match id string: %s.",
-		    str_error(rc));
+		printf(NAME ": devman_receive_match_id - failed to receive "
+		    "match id string.\n");
 		return rc;
 	}
@@ -175,5 +172,5 @@
 	list_append(&match_id->link, &match_ids->ids);
 	
-	log_msg(LVL_DEBUG, "Received match id `%s', score %d.",
+	printf(NAME ": received match id '%s', score = %d \n",
 	    match_id->id, match_id->score);
 	return rc;
@@ -231,7 +228,5 @@
 	if (ftype != fun_inner && ftype != fun_exposed) {
 		/* Unknown function type */
-		log_msg(LVL_ERROR, 
-		    "Unknown function type %d provided by driver.",
-		    (int) ftype);
+		printf(NAME ": Error, unknown function type provided by driver!\n");
 
 		fibril_rwlock_write_unlock(&tree->rwlock);
@@ -248,14 +243,4 @@
 	}
 	
-	/* Check that function with same name is not there already. */
-	if (find_fun_node_in_device(pdev, fun_name) != NULL) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		async_answer_0(callid, EEXISTS);
-		printf(NAME ": Warning, driver tried to register `%s' twice.\n",
-		    fun_name);
-		free(fun_name);
-		return;
-	}
-
 	fun_node_t *fun = create_fun_node();
 	if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) {
@@ -280,5 +265,5 @@
 	fibril_rwlock_write_unlock(&tree->rwlock);
 	
-	log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
+	printf(NAME ": devman_add_function %s\n", fun->pathname);
 	
 	devman_receive_match_ids(match_count, &fun->match_ids);
@@ -362,6 +347,6 @@
 	devmap_register_class_dev(class_info);
 	
-	log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.",
-	    fun->pathname, class_name, class_info->dev_name);
+	printf(NAME ": function'%s' added to class '%s', class name '%s' was "
+	    "asigned to it\n", fun->pathname, class_name, class_info->dev_name);
 
 	async_answer_0(callid, EOK);
@@ -378,5 +363,5 @@
 	
 	initialize_running_driver(driver, &device_tree);
-	log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.",
+	printf(NAME ": the %s driver was successfully initialized. \n",
 	    driver->name);
 	return 0;
@@ -400,6 +385,6 @@
 	fid_t fid = fibril_create(init_running_drv, driver);
 	if (fid == 0) {
-		log_msg(LVL_ERROR, "Failed to create initialization fibril " \
-		    "for driver `%s'.", driver->name);
+		printf(NAME ": Error creating fibril for the initialization of "
+		    "the newly registered running driver.\n");
 		return;
 	}
@@ -453,38 +438,4 @@
 }
 
-/** Find handle for the device instance identified by device class name. */
-static void devman_function_get_handle_by_class(ipc_callid_t iid,
-    ipc_call_t *icall)
-{
-	char *classname;
-	char *devname;
-
-	int rc = async_data_write_accept((void **) &classname, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		async_answer_0(iid, rc);
-		return;
-	}
-	rc = async_data_write_accept((void **) &devname, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		free(classname);
-		async_answer_0(iid, rc);
-		return;
-	}
-
-
-	fun_node_t *fun = find_fun_node_by_class(&class_list,
-	    classname, devname);
-
-	free(classname);
-	free(devname);
-
-	if (fun == NULL) {
-		async_answer_0(iid, ENOENT);
-		return;
-	}
-
-	async_answer_1(iid, EOK, fun->handle);
-}
-
 
 /** Function for handling connections from a client to the device manager. */
@@ -506,7 +457,4 @@
 			devman_function_get_handle(callid, &call);
 			break;
-		case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS:
-			devman_function_get_handle_by_class(callid, &call);
-			break;
 		default:
 			async_answer_0(callid, ENOENT);
@@ -529,13 +477,7 @@
 		dev = fun->dev;
 
-	/*
-	 * For a valid function to connect to we need a device. The root
-	 * function, for example, has no device and cannot be connected to.
-	 * This means @c dev needs to be valid regardless whether we are
-	 * connecting to a device or to a function.
-	 */
-	if (dev == NULL) {
-		log_msg(LVL_ERROR, "IPC forwarding failed - no device or "
-		    "function with handle %" PRIun " was found.", handle);
+	if (fun == NULL && dev == NULL) {
+		printf(NAME ": devman_forward error - no device or function with "
+		    "handle %" PRIun " was found.\n", handle);
 		async_answer_0(iid, ENOENT);
 		return;
@@ -543,7 +485,6 @@
 
 	if (fun == NULL && !drv_to_parent) {
-		log_msg(LVL_ERROR, NAME ": devman_forward error - cannot "
-		    "connect to handle %" PRIun ", refers to a device.",
-		    handle);
+		printf(NAME ": devman_forward error - cannot connect to "
+		    "handle %" PRIun ", refers to a device.\n", handle);
 		async_answer_0(iid, ENOENT);
 		return;
@@ -566,6 +507,6 @@
 	
 	if (driver == NULL) {
-		log_msg(LVL_ERROR, "IPC forwarding refused - " \
-		    "the device %" PRIun " is not in usable state.", handle);
+		printf(NAME ": devman_forward error - the device is not in %" PRIun
+		    " usable state.\n", handle);
 		async_answer_0(iid, ENOENT);
 		return;
@@ -579,7 +520,7 @@
 	
 	if (driver->phone <= 0) {
-		log_msg(LVL_ERROR, 
-		    "Could not forward to driver `%s' (phone is %d).",
-		    driver->name, (int) driver->phone);
+		printf(NAME ": devman_forward: cound not forward to driver %s ",
+		    driver->name);
+		printf("the driver's phone is %" PRIun ").\n", driver->phone);
 		async_answer_0(iid, EINVAL);
 		return;
@@ -587,11 +528,9 @@
 
 	if (fun != NULL) {
-		log_msg(LVL_DEBUG, 
-		    "Forwarding request for `%s' function to driver `%s'.",
-		    fun->pathname, driver->name);
+		printf(NAME ": devman_forward: forward connection to function %s to "
+		    "driver %s.\n", fun->pathname, driver->name);
 	} else {
-		log_msg(LVL_DEBUG, 
-		    "Forwarding request for `%s' device to driver `%s'.",
-		    dev->pfun->pathname, driver->name);
+		printf(NAME ": devman_forward: forward connection to device %s to "
+		    "driver %s.\n", dev->pfun->pathname, driver->name);
 	}
 
@@ -625,7 +564,6 @@
 	async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, fun->handle, 0,
 	    IPC_FF_NONE);
-	log_msg(LVL_DEBUG, 
-	    "Forwarding devmapper request for `%s' function to driver `%s'.",
-	    fun->pathname, dev->drv->name);
+	printf(NAME ": devman_connection_devmapper: forwarded connection to "
+	    "device %s to driver %s.\n", fun->pathname, dev->drv->name);
 }
 
@@ -662,5 +600,5 @@
 static bool devman_init(void)
 {
-	log_msg(LVL_DEBUG, "devman_init - looking for available drivers.");
+	printf(NAME ": devman_init - looking for available drivers.\n");
 	
 	/* Initialize list of available drivers. */
@@ -668,13 +606,13 @@
 	if (lookup_available_drivers(&drivers_list,
 	    DRIVER_DEFAULT_STORE) == 0) {
-		log_msg(LVL_FATAL, "No drivers found.");
+		printf(NAME " no drivers found.");
 		return false;
 	}
 
-	log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");
+	printf(NAME ": devman_init  - list of drivers has been initialized.\n");
 
 	/* Create root device node. */
 	if (!init_device_tree(&device_tree, &drivers_list)) {
-		log_msg(LVL_FATAL, "Failed to initialize device tree.");
+		printf(NAME " failed to initialize device tree.");
 		return false;
 	}
@@ -697,11 +635,6 @@
 	printf(NAME ": HelenOS Device Manager\n");
 
-	if (log_init(NAME, LVL_ERROR) != EOK) {
-		printf(NAME ": Error initializing logging subsystem.\n");
-		return -1;
-	}
-
 	if (!devman_init()) {
-		log_msg(LVL_ERROR, "Error while initializing service.");
+		printf(NAME ": Error while initializing service\n");
 		return -1;
 	}
@@ -711,10 +644,8 @@
 
 	/* Register device manager at naming service. */
-	if (service_register(SERVICE_DEVMAN) != EOK) {
-		log_msg(LVL_ERROR, "Failed registering as a service.");
+	if (service_register(SERVICE_DEVMAN) != EOK)
 		return -1;
-	}
-
-	printf(NAME ": Accepting connections.\n");
+
+	printf(NAME ": Accepting connections\n");
 	async_manager();
 
Index: uspace/srv/devman/util.c
===================================================================
--- uspace/srv/devman/util.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/devman/util.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -111,31 +111,4 @@
 }
 
-ssize_t safe_read(int fd, void *buffer, size_t size)
-{
-	if (size == 0) {
-		return 0;
-	}
-
-	uint8_t *buf_ptr = (uint8_t *) buffer;
-
-	size_t total_read = 0;
-	while (total_read < size) {
-		ssize_t bytes_read = read(fd, buf_ptr, size - total_read);
-		if (bytes_read < 0) {
-			/* Error. */
-			return bytes_read;
-		} else if (bytes_read == 0) {
-			/* Possibly end of file. */
-			break;
-		} else {
-			/* Read at least something. */
-			buf_ptr += bytes_read;
-			total_read += bytes_read;
-		}
-	}
-
-	return (ssize_t) total_read;
-}
-
 /** @}
  */
Index: uspace/srv/devman/util.h
===================================================================
--- uspace/srv/devman/util.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/devman/util.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -47,6 +47,4 @@
 extern void replace_char(char *, char, char);
 
-extern ssize_t safe_read(int, void *, size_t);
-
 #endif
 
Index: uspace/srv/devmap/devmap.c
===================================================================
--- uspace/srv/devmap/devmap.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/devmap/devmap.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -551,5 +551,5 @@
 	if (devmap_device_find_name(namespace->name, device->name) != NULL) {
 		printf("%s: Device '%s/%s' already registered\n", NAME,
-		    namespace->name, device->name);
+		    device->namespace->name, device->name);
 		devmap_namespace_destroy(namespace);
 		fibril_mutex_unlock(&devices_list_mutex);
Index: uspace/srv/hid/kbd/Makefile
===================================================================
--- uspace/srv/hid/kbd/Makefile	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hid/kbd/Makefile	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -78,5 +78,5 @@
 		SOURCES += \
 			port/pl050.c \
-			ctl/pc.c
+			ctl/pl050.c
 	endif
 endif
Index: uspace/srv/hid/kbd/ctl/pl050.c
===================================================================
--- uspace/srv/hid/kbd/ctl/pl050.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
+++ uspace/srv/hid/kbd/ctl/pl050.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -0,0 +1,267 @@
+/*
+ * 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 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hid/kbd/generic/kbd.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -67,6 +67,6 @@
 static unsigned lock_keys;
 
-bool irc_service = false;
-int irc_phone = -1;
+int cir_service = 0;
+int cir_phone = -1;
 
 #define NUM_LAYOUTS 3
@@ -216,11 +216,12 @@
 	sysarg_t obio;
 	
-	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);
+	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);
 	}
 	
Index: uspace/srv/hid/kbd/include/kbd.h
===================================================================
--- uspace/srv/hid/kbd/include/kbd.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hid/kbd/include/kbd.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -38,8 +38,6 @@
 #define KBD_KBD_H_
 
-#include <bool.h>
-
-extern bool irc_service;
-extern int irc_phone;
+extern int cir_service;
+extern int cir_phone;
 
 extern void kbd_push_scancode(int);
Index: uspace/srv/hid/kbd/port/ns16550.c
===================================================================
--- uspace/srv/hid/kbd/port/ns16550.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hid/kbd/port/ns16550.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -120,6 +120,6 @@
 	kbd_push_scancode(scan_code);
 	
-	if (irc_service)
-		async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
+	if (cir_service)
+		async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
 		    IPC_GET_IMETHOD(*call));
 }
Index: uspace/srv/hid/kbd/port/z8530.c
===================================================================
--- uspace/srv/hid/kbd/port/z8530.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hid/kbd/port/z8530.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -108,6 +108,6 @@
 	kbd_push_scancode(scan_code);
 	
-	if (irc_service)
-		async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
+	if (cir_service)
+		async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
 		    IPC_GET_IMETHOD(*call));
 }
Index: uspace/srv/hw/bus/cuda_adb/cuda_adb.c
===================================================================
--- uspace/srv/hw/bus/cuda_adb/cuda_adb.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/bus/cuda_adb/cuda_adb.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -367,9 +367,9 @@
 static void cuda_irq_rcv_end(void *buf, size_t *len)
 {
-	uint8_t b;
-	
+	uint8_t data, b;
+
 	b = pio_read_8(&dev->b);
-	pio_read_8(&dev->sr);
-	
+	data = pio_read_8(&dev->sr);
+
 	if ((b & TREQ) == 0) {
 		instance->xstate = cx_receive;
@@ -379,7 +379,7 @@
 		cuda_send_start();
 	}
-	
-	memcpy(buf, instance->rcv_buf, instance->bidx);
-	*len = instance->bidx;
+
+        memcpy(buf, instance->rcv_buf, instance->bidx);
+        *len = instance->bidx;
 	instance->bidx = 0;
 }
Index: uspace/srv/hw/irc/apic/apic.c
===================================================================
--- uspace/srv/hw/irc/apic/apic.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/irc/apic/apic.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -56,5 +56,5 @@
 static int apic_enable_irq(sysarg_t irq)
 {
-	/* FIXME: TODO */
+	// FIXME: TODO
 	return ENOTSUP;
 }
@@ -107,5 +107,5 @@
 	
 	async_set_client_connection(apic_connection);
-	service_register(SERVICE_IRC);
+	service_register(SERVICE_APIC);
 	
 	return true;
Index: uspace/srv/hw/irc/fhc/fhc.c
===================================================================
--- uspace/srv/hw/irc/fhc/fhc.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/irc/fhc/fhc.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -136,5 +136,5 @@
 	
 	async_set_client_connection(fhc_connection);
-	service_register(SERVICE_IRC);
+	service_register(SERVICE_FHC);
 	
 	return true;
Index: uspace/srv/hw/irc/i8259/i8259.c
===================================================================
--- uspace/srv/hw/irc/i8259/i8259.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/irc/i8259/i8259.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -149,5 +149,5 @@
 	
 	async_set_client_connection(i8259_connection);
-	service_register(SERVICE_IRC);
+	service_register(SERVICE_I8259);
 	
 	return true;
Index: uspace/srv/hw/irc/obio/obio.c
===================================================================
--- uspace/srv/hw/irc/obio/obio.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/irc/obio/obio.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -137,5 +137,5 @@
 	
 	async_set_client_connection(obio_connection);
-	service_register(SERVICE_IRC);
+	service_register(SERVICE_OBIO);
 	
 	return true;
Index: uspace/srv/hw/netif/ne2000/dp8390.c
===================================================================
--- uspace/srv/hw/netif/ne2000/dp8390.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/netif/ne2000/dp8390.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -391,5 +391,4 @@
 	
 	if ((size < ETH_MIN_PACK_SIZE) || (size > ETH_MAX_PACK_SIZE_TAGGED)) {
-		fibril_mutex_unlock(&ne2k->sq_mutex);
 		fprintf(stderr, "%s: Frame dropped (invalid size %zu bytes)\n",
 		    NAME, size);
Index: uspace/srv/hw/netif/ne2000/ne2000.c
===================================================================
--- uspace/srv/hw/netif/ne2000/ne2000.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/hw/netif/ne2000/ne2000.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -75,5 +75,5 @@
 #define IRQ_GET_TSR(call)  ((int) IPC_GET_ARG3(call))
 
-static bool irc_service = false;
+static int irc_service = 0;
 static int irc_phone = -1;
 
@@ -383,11 +383,12 @@
 	sysarg_t i8259;
 	
-	if (((sysinfo_get_value("apic", &apic) == EOK) && (apic))
-	    || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)))
-		irc_service = true;
+	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) {
 		while (irc_phone < 0)
-			irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
+			irc_phone = service_connect_blocking(irc_service, 0, 0);
 	}
 	
Index: uspace/srv/loader/arch/abs32le/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/abs32le/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/abs32le/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -21,6 +21,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/arch/amd64/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/amd64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/amd64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -27,6 +27,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/arch/arm32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/arm32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/arm32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -25,6 +25,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/arch/ia32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/ia32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/ia32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -26,6 +26,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/arch/ia64/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/ia64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/ia64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -21,6 +21,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
@@ -29,5 +29,5 @@
 	.got : {
 		_gp = .;
-		*(.got .got.*);
+		*(.got*);
 	} :data
 	
Index: uspace/srv/loader/arch/mips32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/mips32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/mips32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -25,6 +25,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/arch/ppc32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/ppc32/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/ppc32/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -25,6 +25,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/arch/sparc64/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/sparc64/_link.ld.in	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/arch/sparc64/_link.ld.in	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -20,6 +20,6 @@
 	
 	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
+		*(.text);
+		*(.rodata*);
 	} :text
 	
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/loader/main.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -415,10 +415,12 @@
 			/* Not reached */
 		default:
-			retval = EINVAL;
+			retval = ENOENT;
 			break;
 		}
-		
-		if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP)
-			async_answer_0(callid, retval);
+		if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP) {
+			DPRINTF("Responding EINVAL to method %d.\n",
+			    IPC_GET_IMETHOD(call));
+			async_answer_0(callid, EINVAL);
+		}
 	}
 }
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/il/arp/arp.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -157,9 +157,9 @@
 			
 			arp_clear_addr(&proto->addresses);
-			arp_addr_destroy(&proto->addresses, free);
-		}
-	}
-	
-	arp_protos_clear(&device->protos, free);
+			arp_addr_destroy(&proto->addresses);
+		}
+	}
+	
+	arp_protos_clear(&device->protos);
 }
 
@@ -184,5 +184,5 @@
 	}
 	
-	arp_cache_clear(&arp_globals.cache, free);
+	arp_cache_clear(&arp_globals.cache);
 	fibril_mutex_unlock(&arp_globals.lock);
 	
@@ -212,5 +212,5 @@
 		arp_clear_trans(trans);
 	
-	arp_addr_exclude(&proto->addresses, address->value, address->length, free);
+	arp_addr_exclude(&proto->addresses, address->value, address->length);
 	
 	fibril_mutex_unlock(&arp_globals.lock);
@@ -345,5 +345,5 @@
 			    header->protocol_length, trans);
 			if (rc != EOK) {
-				free(trans);
+				/* The generic char map has already freed trans! */
 				return rc;
 			}
@@ -556,5 +556,5 @@
 		if (index < 0) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos, free);
+			arp_protos_destroy(&device->protos);
 			free(device);
 			return index;
@@ -569,5 +569,5 @@
 		if (device->phone < 0) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos, free);
+			arp_protos_destroy(&device->protos);
 			free(device);
 			return EREFUSED;
@@ -579,5 +579,5 @@
 		if (rc != EOK) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos, free);
+			arp_protos_destroy(&device->protos);
 			free(device);
 			return rc;
@@ -589,5 +589,5 @@
 		if (rc != EOK) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos, free);
+			arp_protos_destroy(&device->protos);
 			free(device);
 			return rc;
@@ -601,5 +601,5 @@
 			free(device->addr);
 			free(device->addr_data);
-			arp_protos_destroy(&device->protos, free);
+			arp_protos_destroy(&device->protos);
 			free(device);
 			return rc;
@@ -614,5 +614,5 @@
 			free(device->broadcast_addr);
 			free(device->broadcast_data);
-			arp_protos_destroy(&device->protos, free);
+			arp_protos_destroy(&device->protos);
 			free(device);
 			return rc;
@@ -746,5 +746,5 @@
 			arp_clear_trans(trans);
 			arp_addr_exclude(&proto->addresses, target->value,
-			    target->length, free);
+			    target->length);
 			return EAGAIN;
 		}
@@ -794,5 +794,5 @@
 	    trans);
 	if (rc != EOK) {
-		free(trans);
+		/* The generic char map has already freed trans! */
 		return rc;
 	}
@@ -807,5 +807,5 @@
 		arp_clear_trans(trans);
 		arp_addr_exclude(&proto->addresses, target->value,
-		    target->length, free);
+		    target->length);
 		return ENOENT;
 	}
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/il/ip/ip.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -176,5 +176,5 @@
 	socklen_t addrlen;
 
-	/* Detach the first packet and release the others */
+	// detach the first packet and release the others
 	next = pq_detach(packet);
 	if (next)
@@ -185,5 +185,5 @@
 			return ENOMEM;
 
-		/* Get header */
+		// get header
 		header = (ip_header_t *) packet_get_data(packet);
 		if (!header)
@@ -192,13 +192,13 @@
 	}
 
-	/* Only for the first fragment */
+	// only for the first fragment
 	if (IP_FRAGMENT_OFFSET(header))
 		return EINVAL;
 
-	/* Not for the ICMP protocol */
+	// not for the ICMP protocol
 	if (header->protocol == IPPROTO_ICMP)
 		return EPERM;
 
-	/* Set the destination address */
+	// set the destination address
 	switch (header->version) {
 	case IPVERSION:
@@ -351,5 +351,5 @@
 	configuration = &names[0];
 
-	/* Get configuration */
+	// get configuration
 	rc = net_get_device_conf_req(ip_globals.net_phone, ip_netif->device_id,
 	    &configuration, count, &data);
@@ -365,5 +365,5 @@
 		
 		if (ip_netif->dhcp) {
-			/* TODO dhcp */
+			// TODO dhcp
 			net_free_settings(configuration, data);
 			return ENOTSUP;
@@ -398,5 +398,5 @@
 			}
 		} else {
-			/* TODO ipv6 in separate module */
+			// TODO ipv6 in separate module
 			net_free_settings(configuration, data);
 			return ENOTSUP;
@@ -419,5 +419,5 @@
 	}
 
-	/* Bind netif service which also initializes the device */
+	// binds the netif service which also initializes the device
 	ip_netif->phone = nil_bind_service(ip_netif->service,
 	    (sysarg_t) ip_netif->device_id, SERVICE_IP,
@@ -429,5 +429,5 @@
 	}
 
-	/* Has to be after the device netif module initialization */
+	// has to be after the device netif module initialization
 	if (ip_netif->arp) {
 		if (route) {
@@ -445,5 +445,5 @@
 	}
 
-	/* Get packet dimensions */
+	// get packet dimensions
 	rc = nil_packet_size_req(ip_netif->phone, ip_netif->device_id,
 	    &ip_netif->packet_dimension);
@@ -463,5 +463,5 @@
 	
 	if (gateway.s_addr) {
-		/* The default gateway */
+		// the default gateway
 		ip_globals.gateway.address.s_addr = 0;
 		ip_globals.gateway.netmask.s_addr = 0;
@@ -505,5 +505,5 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
-		ip_routes_destroy(&ip_netif->routes, free);
+		ip_routes_destroy(&ip_netif->routes);
 		free(ip_netif);
 		return rc;
@@ -512,10 +512,10 @@
 		ip_netif->arp->usage++;
 
-	/* Print the settings */
+	// print the settings
 	printf("%s: Device registered (id: %d, phone: %d, ipv: %d, conf: %s)\n",
 	    NAME, ip_netif->device_id, ip_netif->phone, ip_netif->ipv,
 	    ip_netif->dhcp ? "dhcp" : "static");
 	
-	/* TODO ipv6 addresses */
+	// TODO ipv6 addresses
 	
 	char address[INET_ADDRSTRLEN];
@@ -587,5 +587,5 @@
 	ip_netif_t *netif;
 
-	/* Start with the last netif - the newest one */
+	// start with the last netif - the newest one
 	index = ip_netifs_count(&ip_globals.netifs) - 1;
 	while (index >= 0) {
@@ -629,18 +629,18 @@
 	size_t length;
 
-	/* Copy first itself */
+	// copy first itself
 	memcpy(last, first, sizeof(ip_header_t));
 	length = sizeof(ip_header_t);
 	next = sizeof(ip_header_t);
 
-	/* Process all IP options */
+	// process all ip options
 	while (next < first->header_length) {
 		option = (ip_option_t *) (((uint8_t *) first) + next);
-		/* Skip end or noop */
+		// skip end or noop
 		if ((option->type == IPOPT_END) ||
 		    (option->type == IPOPT_NOOP)) {
 			next++;
 		} else {
-			/* Copy if told so or skip */
+			// copy if told so or skip
 			if (IPOPT_COPIED(option->type)) {
 				memcpy(((uint8_t *) last) + length,
@@ -648,10 +648,10 @@
 				length += option->length;
 			}
-			/* Next option */
+			// next option
 			next += option->length;
 		}
 	}
 
-	/* Align 4 byte boundary */
+	// align 4 byte boundary
 	if (length % 4) {
 		bzero(((uint8_t *) last) + length, 4 - (length % 4));
@@ -789,5 +789,5 @@
 
 	header->total_length = htons(length);
-	/* Unnecessary for all protocols */
+	// unnecessary for all protocols
 	header->header_checksum = IP_HEADER_CHECKSUM(header);
 
@@ -916,14 +916,14 @@
 		return ENOMEM;
 
-	/* Get header */
+	// get header
 	header = (ip_header_t *) packet_get_data(packet);
 	if (!header)
 		return EINVAL;
 
-	/* Fragmentation forbidden? */
+	// fragmentation forbidden?
 	if(header->flags & IPFLAG_DONT_FRAGMENT)
 		return EPERM;
 
-	/* Create the last fragment */
+	// create the last fragment
 	new_packet = packet_get_4_remote(ip_globals.net_phone, prefix, length,
 	    suffix, ((addrlen > addr_len) ? addrlen : addr_len));
@@ -931,5 +931,5 @@
 		return ENOMEM;
 
-	/* Allocate as much as originally */
+	// allocate as much as originally
 	last_header = (ip_header_t *) packet_suffix(new_packet,
 	    IP_HEADER_LENGTH(header));
@@ -939,5 +939,5 @@
 	ip_create_last_header(last_header, header);
 
-	/* Trim the unused space */
+	// trim the unused space
 	rc = packet_trim(new_packet, 0,
 	    IP_HEADER_LENGTH(header) - IP_HEADER_LENGTH(last_header));
@@ -945,6 +945,6 @@
 		return ip_release_and_return(packet, rc);
 
-	/* Greatest multiple of 8 lower than content */
-	/* TODO even fragmentation? */
+	// biggest multiple of 8 lower than content
+	// TODO even fragmentation?
 	length = length & ~0x7;
 	
@@ -957,8 +957,8 @@
 		return ip_release_and_return(packet, rc);
 
-	/* Mark the first as fragmented */
+	// mark the first as fragmented
 	header->flags |= IPFLAG_MORE_FRAGMENTS;
 
-	/* Create middle fragments */
+	// create middle framgents
 	while (IP_TOTAL_LENGTH(header) > length) {
 		new_packet = packet_get_4_remote(ip_globals.net_phone, prefix,
@@ -981,5 +981,5 @@
 	}
 
-	/* Finish the first fragment */
+	// finish the first fragment
 	header->header_checksum = IP_HEADER_CHECKSUM(header);
 
@@ -1012,5 +1012,5 @@
 
 	next = packet;
-	/* Check all packets */
+	// check all packets
 	while (next) {
 		length = packet_get_data_length(next);
@@ -1021,5 +1021,5 @@
 		}
 
-		/* Too long */
+		// too long
 		result = ip_fragment_packet(next, content, prefix,
 		    suffix, addr_len);
@@ -1027,13 +1027,13 @@
 			new_packet = pq_detach(next);
 			if (next == packet) {
-				/* The new first packet of the queue */
+				// the new first packet of the queue
 				packet = new_packet;
 			}
-			/* Fragmentation needed? */
+			// fragmentation needed?
 			if (result == EPERM) {
 				phone = ip_prepare_icmp_and_get_phone(
 				    error, next, NULL);
 				if (phone >= 0) {
-					/* Fragmentation necessary ICMP */
+					// fragmentation necessary ICMP
 					icmp_destination_unreachable_msg(phone,
 					    ICMP_FRAG_NEEDED, content, next);
@@ -1080,5 +1080,5 @@
 	int rc;
 
-	/* Get destination hardware address */
+	// get destination hardware address
 	if (netif->arp && (route->address.s_addr != dest.s_addr)) {
 		destination.value = route->gateway.s_addr ?
@@ -1102,5 +1102,5 @@
 			    NULL);
 			if (phone >= 0) {
-				/* Unreachable ICMP if no routing */
+				// unreachable ICMP if no routing
 				icmp_destination_unreachable_msg(phone,
 				    ICMP_HOST_UNREACH, 0, packet);
@@ -1148,8 +1148,6 @@
 	int rc;
 
-	/*
-	 * Addresses in the host byte order
-	 * Should be the next hop address or the target destination address
-	 */
+	// addresses in the host byte order
+	// should be the next hop address or the target destination address
 	addrlen = packet_get_addr(packet, NULL, (uint8_t **) &addr);
 	if (addrlen < 0)
@@ -1176,5 +1174,5 @@
 	fibril_rwlock_read_lock(&ip_globals.netifs_lock);
 
-	/* Device specified? */
+	// device specified?
 	if (device_id > 0) {
 		netif = ip_netifs_find(&ip_globals.netifs, device_id);
@@ -1192,5 +1190,5 @@
 		phone = ip_prepare_icmp_and_get_phone(error, packet, NULL);
 		if (phone >= 0) {
-			/* Unreachable ICMP if no routing */
+			// unreachable ICMP if no routing
 			icmp_destination_unreachable_msg(phone,
 			    ICMP_NET_UNREACH, 0, packet);
@@ -1200,8 +1198,6 @@
 
 	if (error) {
-		/*
-		 * Do not send for broadcast, anycast packets or network
-		 * broadcast.
-		 */
+		// do not send for broadcast, anycast packets or network
+		// broadcast
 		if (!dest->s_addr || !(~dest->s_addr) ||
 		    !(~((dest->s_addr & ~route->netmask.s_addr) |
@@ -1212,8 +1208,8 @@
 	}
 	
-	/* Ff the local host is the destination */
+	// if the local host is the destination
 	if ((route->address.s_addr == dest->s_addr) &&
 	    (dest->s_addr != IPV4_LOCALHOST_ADDRESS)) {
-		/* Find the loopback device to deliver */
+		// find the loopback device to deliver
 		dest->s_addr = IPV4_LOCALHOST_ADDRESS;
 		route = ip_find_route(*dest);
@@ -1224,5 +1220,5 @@
 			    NULL);
 			if (phone >= 0) {
-				/* Unreachable ICMP if no routing */
+				// unreachable ICMP if no routing
 				icmp_destination_unreachable_msg(phone,
 				    ICMP_HOST_UNREACH, 0, packet);
@@ -1256,5 +1252,5 @@
 
 	fibril_rwlock_write_lock(&ip_globals.netifs_lock);
-	/* Find the device */
+	// find the device
 	netif = ip_netifs_find(&ip_globals.netifs, device_id);
 	if (!netif) {
@@ -1279,5 +1275,5 @@
 	in_addr_t destination;
 
-	/* TODO search set ipopt route? */
+	// TODO search set ipopt route?
 	destination.s_addr = header->destination_address;
 	return destination;
@@ -1321,5 +1317,5 @@
 	if ((header->flags & IPFLAG_MORE_FRAGMENTS) ||
 	    IP_FRAGMENT_OFFSET(header)) {
-		/* TODO fragmented */
+		// TODO fragmented
 		return ENOTSUP;
 	}
@@ -1348,5 +1344,5 @@
 		return ip_release_and_return(packet, rc);
 
-	/* Trim padding if present */
+	// trim padding if present
 	if (!error &&
 	    (IP_TOTAL_LENGTH(header) < packet_get_data_length(packet))) {
@@ -1364,5 +1360,5 @@
 		phone = ip_prepare_icmp_and_get_phone(error, packet, header);
 		if (phone >= 0) {
-			/* Unreachable ICMP */
+			// unreachable ICMP
 			icmp_destination_unreachable_msg(phone,
 			    ICMP_PROT_UNREACH, 0, packet);
@@ -1421,10 +1417,10 @@
 		return ip_release_and_return(packet, ENOMEM);
 
-	/* Checksum */
+	// checksum
 	if ((header->header_checksum) &&
 	    (IP_HEADER_CHECKSUM(header) != IP_CHECKSUM_ZERO)) {
 		phone = ip_prepare_icmp_and_get_phone(0, packet, header);
 		if (phone >= 0) {
-			/* Checksum error ICMP */
+			// checksum error ICMP
 			icmp_parameter_problem_msg(phone, ICMP_PARAM_POINTER,
 			    ((size_t) ((void *) &header->header_checksum)) -
@@ -1437,5 +1433,5 @@
 		phone = ip_prepare_icmp_and_get_phone(0, packet, header);
 		if (phone >= 0) {
-			/* ttl exceeded ICMP */
+			// ttl exceeded ICMP
 			icmp_time_exceeded_msg(phone, ICMP_EXC_TTL, packet);
 		}
@@ -1443,8 +1439,8 @@
 	}
 	
-	/* Process ipopt and get destination */
+	// process ipopt and get destination
 	dest = ip_get_destination(header);
 
-	/* Set the destination address */
+	// set the addrination address
 	switch (header->version) {
 	case IPVERSION:
@@ -1468,5 +1464,5 @@
 		phone = ip_prepare_icmp_and_get_phone(0, packet, header);
 		if (phone >= 0) {
-			/* Unreachable ICMP */
+			// unreachable ICMP
 			icmp_destination_unreachable_msg(phone,
 			    ICMP_HOST_UNREACH, 0, packet);
@@ -1476,5 +1472,5 @@
 
 	if (route->address.s_addr == dest.s_addr) {
-		/* Local delivery */
+		// local delivery
 		return ip_deliver_local(device_id, packet, header, 0);
 	}
@@ -1488,5 +1484,5 @@
 	phone = ip_prepare_icmp_and_get_phone(0, packet, header);
 	if (phone >= 0) {
-		/* Unreachable ICMP if no routing */
+		// unreachable ICMP if no routing
 		icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0,
 		    packet);
@@ -1774,8 +1770,8 @@
 		header = (ip_header_t *)(data + offset);
 
-		/* Destination host unreachable? */
+		// destination host unreachable?
 		if ((type != ICMP_DEST_UNREACH) ||
 		    (code != ICMP_HOST_UNREACH)) {
-		    	/* No, something else */
+		    	// no, something else
 			break;
 		}
@@ -1791,8 +1787,8 @@
 		route = ip_routes_get_index(&netif->routes, 0);
 
-		/* From the same network? */
+		// from the same network?
 		if (route && ((route->address.s_addr & route->netmask.s_addr) ==
 		    (header->destination_address & route->netmask.s_addr))) {
-			/* Clear the ARP mapping if any */
+			// clear the ARP mapping if any
 			address.value = (uint8_t *) &header->destination_address;
 			address.length = sizeof(header->destination_address);
@@ -1848,8 +1844,8 @@
 	fibril_rwlock_read_lock(&ip_globals.lock);
 	route = ip_find_route(*dest);
-	/* If the local host is the destination */
+	// if the local host is the destination
 	if (route && (route->address.s_addr == dest->s_addr) &&
 	    (dest->s_addr != IPV4_LOCALHOST_ADDRESS)) {
-		/* Find the loopback device to deliver */
+		// find the loopback device to deliver
 		dest->s_addr = IPV4_LOCALHOST_ADDRESS;
 		route = ip_find_route(*dest);
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/net/net.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -289,15 +289,12 @@
 	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);
@@ -555,5 +552,5 @@
 		rc = read_netif_configuration(conf_files[i], netif);
 		if (rc != EOK) {
-			measured_strings_destroy(&netif->configuration, free);
+			measured_strings_destroy(&netif->configuration);
 			free(netif);
 			return rc;
@@ -565,5 +562,5 @@
 		if (!setting) {
 			fprintf(stderr, "%s: Network interface name is missing\n", NAME);
-			measured_strings_destroy(&netif->configuration, free);
+			measured_strings_destroy(&netif->configuration);
 			free(netif);
 			return EINVAL;
@@ -574,5 +571,5 @@
 		int index = netifs_add(&net_globals.netifs, netif->id, netif);
 		if (index < 0) {
-			measured_strings_destroy(&netif->configuration, free);
+			measured_strings_destroy(&netif->configuration);
 			free(netif);
 			return index;
@@ -586,6 +583,6 @@
 		    index);
 		if (rc != EOK) {
-			measured_strings_destroy(&netif->configuration, free);
-			netifs_exclude_index(&net_globals.netifs, index, free);
+			measured_strings_destroy(&netif->configuration);
+			netifs_exclude_index(&net_globals.netifs, index);
 			return rc;
 		}
@@ -593,9 +590,10 @@
 		rc = start_device(netif);
 		if (rc != EOK) {
-			printf("%s: Ignoring failed interface %s (%s)\n", NAME,
+			printf("%s: Error starting interface %s (%s)\n", NAME,
 			    netif->name, str_error(rc));
-			measured_strings_destroy(&netif->configuration, free);
-			netifs_exclude_index(&net_globals.netifs, index, free);
-			continue;
+			measured_strings_destroy(&netif->configuration);
+			netifs_exclude_index(&net_globals.netifs, index);
+			
+			return rc;
 		}
 		
Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/nil/eth/eth.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -214,5 +214,5 @@
 	if (rc != EOK) {
 		free(eth_globals.broadcast_addr);
-		eth_devices_destroy(&eth_globals.devices, free);
+		eth_devices_destroy(&eth_globals.devices);
 	}
 out:
@@ -531,5 +531,5 @@
 			    proto->service);
 		} else {
-			/* Drop invalid/unknown */
+			// drop invalid/unknown
 			pq_release_remote(eth_globals.net_phone,
 			    packet_get_id(packet));
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -299,8 +299,7 @@
 		return tcp_release_and_return(packet, NO_DATA);
 
-#if 0
-	printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header),
-	    ntohs(header->destination_port));
-#endif
+//      printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header),
+//	    ntohs(header->destination_port));
+
 	result = packet_get_addr(packet, (uint8_t **) &src, (uint8_t **) &dest);
 	if (result <= 0)
@@ -1063,5 +1062,5 @@
 	tcp_process_acknowledgement(socket, socket_data, header);
 
-	socket_data->next_incoming = ntohl(header->sequence_number); /* + 1; */
+	socket_data->next_incoming = ntohl(header->sequence_number);	// + 1;
 	pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	socket_data->state = TCP_SOCKET_ESTABLISHED;
@@ -1708,5 +1707,5 @@
 		if (socket->port > 0) {
 			socket_ports_exclude(&tcp_globals.sockets,
-			    socket->port, free);
+			    socket->port);
 			socket->port = 0;
 		}
@@ -2493,5 +2492,5 @@
 	rc = packet_dimensions_initialize(&tcp_globals.dimensions);
 	if (rc != EOK) {
-		socket_ports_destroy(&tcp_globals.sockets, free);
+		socket_ports_destroy(&tcp_globals.sockets);
 		goto out;
 	}
Index: uspace/srv/net/tl/tcp/tcp.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp.h	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/tl/tcp/tcp.h	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -190,4 +190,7 @@
 	int backlog;
 	
+//	/** Segment size. */
+//	size_t segment_size;
+
 	/**
 	 * Parent listening socket identifier.
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/net/tl/udp/udp.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -417,5 +417,5 @@
 	rc = packet_dimensions_initialize(&udp_globals.dimensions);
 	if (rc != EOK) {
-		socket_ports_destroy(&udp_globals.sockets, free);
+		socket_ports_destroy(&udp_globals.sockets);
 		fibril_rwlock_write_unlock(&udp_globals.lock);
 		return rc;
@@ -434,5 +434,5 @@
 	    &data);
 	if (rc != EOK) {
-		socket_ports_destroy(&udp_globals.sockets, free);
+		socket_ports_destroy(&udp_globals.sockets);
 		fibril_rwlock_write_unlock(&udp_globals.lock);
 		return rc;
@@ -499,9 +499,5 @@
 	device_id_t device_id;
 	packet_dimension_t *packet_dimension;
-	size_t size;
 	int rc;
-
-	/* In case of error, do not update the data fragment size. */
-	*data_fragment_size = 0;
 	
 	rc = tl_get_address_port(addr, addrlen, &dest_port);
@@ -543,14 +539,4 @@
 		packet_dimension = &udp_globals.packet_dimension;
 //	}
-
-	/*
-	 * Update the data fragment size based on what the lower layers can
-	 * handle without fragmentation, but not more than the maximum allowed
-	 * for UDP.
-	 */
-	size = MAX_UDP_FRAGMENT_SIZE;
-	if (packet_dimension->content < size)
-	    size = packet_dimension->content;
-	*data_fragment_size = size;
 
 	/* Read the first packet fragment */
@@ -800,12 +786,13 @@
 				break;
 			
-			size = MAX_UDP_FRAGMENT_SIZE;
 			if (tl_get_ip_packet_dimension(udp_globals.ip_phone,
 			    &udp_globals.dimensions, DEVICE_INVALID_ID,
 			    &packet_dimension) == EOK) {
-				if (packet_dimension->content < size)
-					size = packet_dimension->content;
+				SOCKET_SET_DATA_FRAGMENT_SIZE(answer,
+				    packet_dimension->content);
 			}
-			SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
+
+//			SOCKET_SET_DATA_FRAGMENT_SIZE(answer,
+//			    MAX_UDP_FRAGMENT_SIZE);
 			SOCKET_SET_HEADER_SIZE(answer, UDP_HEADER_SIZE);
 			answer_count = 3;
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ uspace/srv/vfs/vfs_ops.c	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -611,5 +611,5 @@
 void vfs_open_node(ipc_callid_t rid, ipc_call_t *request)
 {
-	/* FIXME: check for sanity of the supplied fs, dev and index */
+	// FIXME: check for sanity of the supplied fs, dev and index
 	
 	/*
@@ -1234,5 +1234,4 @@
 	if (!parentc) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
-		vfs_node_put(old_node);
 		async_answer_0(rid, rc);
 		free(old);
@@ -1252,5 +1251,4 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
-		vfs_node_put(old_node);
 		async_answer_0(rid, rc);
 		free(old);
@@ -1263,5 +1261,4 @@
 	    (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);
@@ -1282,5 +1279,4 @@
 		if (!new_node) {
 			fibril_rwlock_write_unlock(&namespace_rwlock);
-			vfs_node_put(old_node);
 			async_answer_0(rid, ENOMEM);
 			free(old);
@@ -1294,5 +1290,4 @@
 	default:
 		fibril_rwlock_write_unlock(&namespace_rwlock);
-		vfs_node_put(old_node);
 		async_answer_0(rid, ENOTEMPTY);
 		free(old);
@@ -1305,5 +1300,4 @@
 	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 8aa2b3bd36816eb9f9e92cc4098498870194aade)
+++ version	(revision 3a3d4ca595a9beb21ff6843f12c73a08d87978e7)
@@ -37,5 +37,5 @@
 VERSION = 0
 PATCHLEVEL = 4
-SUBLEVEL = 3
+SUBLEVEL = 2
 
 ifdef EXTRAVERSION
@@ -45,3 +45,3 @@
 endif
 
-NAME = Sashimi
+NAME = Skewer
