Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ HelenOS.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -545,2 +545,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: Makefile
===================================================================
--- Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -28,4 +28,5 @@
 
 CSCOPE = cscope
+CHECK = tools/check.sh
 CONFIG = tools/config.py
 AUTOTOOL = tools/autotool.py
@@ -41,5 +42,5 @@
 CONFIG_HEADER = config.h
 
-.PHONY: all precheck cscope autotool config_default config distclean clean
+.PHONY: all precheck cscope autotool config_auto config_default config distclean clean check
 
 all: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
@@ -55,4 +56,12 @@
 	find kernel boot uspace -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
 
+# Pre-integration build check
+check: $(CHECK)
+ifdef JOBS 
+	$(CHECK) -j $(JOBS)
+else
+	$(CHECK)
+endif
+
 $(COMMON_MAKEFILE): autotool
 $(COMMON_HEADER): autotool
@@ -66,5 +75,9 @@
 
 config_default: $(CONFIG_RULES)
-	$(CONFIG) $< default
+ifeq ($(HANDS_OFF),y)
+	$(CONFIG) $< hands-off $(PROFILE)
+else
+	$(CONFIG) $< default $(PROFILE)
+endif
 
 config: $(CONFIG_RULES)
Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/Makefile.common	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -100,4 +100,6 @@
 	$(USPACE_PATH)/srv/hw/netif/dp8390/dp8390 \
 	$(USPACE_PATH)/srv/net/netif/lo/lo \
+	$(USPACE_PATH)/srv/net/nil/eth/eth \
+	$(USPACE_PATH)/srv/net/nil/nildummy/nildummy \
 	$(USPACE_PATH)/srv/net/il/arp/arp \
 	$(USPACE_PATH)/srv/net/il/ip/ip \
@@ -109,13 +111,10 @@
 	
 RD_DRVS = \
-	root
+	root \
+	rootvirt \
+	test1 \
+	test2
 
 RD_DRV_CFG = 
-
-ifneq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	RD_SRVS_NON_ESSENTIAL += \
-		$(USPACE_PATH)/srv/net/nil/eth/eth \
-		$(USPACE_PATH)/srv/net/nil/nildummy/nildummy
-endif
 
 RD_APPS_ESSENTIAL = \
@@ -141,5 +140,6 @@
 	$(USPACE_PATH)/app/stats/stats \
 	$(USPACE_PATH)/app/tasks/tasks \
-	$(USPACE_PATH)/app/top/top
+	$(USPACE_PATH)/app/top/top \
+	$(USPACE_PATH)/app/sysinfo/sysinfo
 
 ifneq ($(CONFIG_BAREBONE),y)
Index: boot/arch/amd64/Makefile.inc
===================================================================
--- boot/arch/amd64/Makefile.inc	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/amd64/Makefile.inc	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,5 +37,5 @@
 
 RD_DRVS += \
-	rootia32 \
+	rootpc \
 	pciintel \
 	isa \
Index: boot/arch/arm32/src/main.c
===================================================================
--- boot/arch/arm32/src/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/arm32/src/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -61,5 +61,6 @@
 	printf(" %p|%p: bootstrap page table\n", &boot_pt, &boot_pt);
 	printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo);
-	printf(" %p|%p: kernel entry point\n", PA2KA(BOOT_OFFSET), BOOT_OFFSET);
+	printf(" %p|%p: kernel entry point\n",
+	    (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET);
 	
 	size_t i;
Index: boot/arch/ia64/include/types.h
===================================================================
--- boot/arch/ia64/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/ia64/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,5 +35,5 @@
 
 typedef uint64_t size_t;
-typedef uint64_t unative_t;
+typedef uint64_t sysarg_t;
 typedef uint64_t uintptr_t;
 
@@ -61,5 +61,5 @@
 	unsigned int memmap_items;
 
-	unative_t *sapic;
+	sysarg_t *sapic;
 	unsigned long sys_freq;
 	unsigned long freq_scale;
Index: boot/arch/ia64/src/main.c
===================================================================
--- boot/arch/ia64/src/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/ia64/src/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,10 +62,12 @@
 	
 	printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo);
-	printf(" %p|%p: kernel entry point\n", KERNEL_ADDRESS, KERNEL_ADDRESS);
-	printf(" %p|%p: loader entry point\n", LOADER_ADDRESS, LOADER_ADDRESS);
+	printf(" %p|%p: kernel entry point\n",
+	    (void *) KERNEL_ADDRESS, (void *) KERNEL_ADDRESS);
+	printf(" %p|%p: loader entry point\n",
+	    (void *) LOADER_ADDRESS, (void *) LOADER_ADDRESS);
 	
 	size_t i;
 	for (i = 0; i < COMPONENTS; i++)
-		printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
+		printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
 		    components[i].start, components[i].name,
 		    components[i].inflated, components[i].size);
Index: boot/arch/mips32/include/arch.h
===================================================================
--- boot/arch/mips32/include/arch.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/mips32/include/arch.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,5 +40,5 @@
 
 #define MSIM_VIDEORAM_ADDRESS  0xb0000000
-#define MSIM_DORDER_ADDRESS    0xb0000004
+#define MSIM_DORDER_ADDRESS    0xb0000100
 
 #ifndef __ASM__
Index: boot/arch/mips32/src/main.c
===================================================================
--- boot/arch/mips32/src/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/mips32/src/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,14 +51,19 @@
 	
 	printf("\nMemory statistics\n");
-	printf(" %p|%p: CPU map\n", PA2KA(CPUMAP_OFFSET), CPUMAP_OFFSET);
-	printf(" %p|%p: bootstrap stack\n", PA2KA(STACK_OFFSET), STACK_OFFSET);
-	printf(" %p|%p: boot info structure\n", PA2KA(BOOTINFO_OFFSET), BOOTINFO_OFFSET);
-	printf(" %p|%p: kernel entry point\n", PA2KA(BOOT_OFFSET), BOOT_OFFSET);
-	printf(" %p|%p: bootloader entry point\n", PA2KA(LOADER_OFFSET), LOADER_OFFSET);
+	printf(" %p|%p: CPU map\n", (void *) PA2KA(CPUMAP_OFFSET),
+	    (void *) CPUMAP_OFFSET);
+	printf(" %p|%p: bootstrap stack\n", (void *) PA2KA(STACK_OFFSET),
+	    (void *) STACK_OFFSET);
+	printf(" %p|%p: boot info structure\n",
+	    (void *) PA2KA(BOOTINFO_OFFSET), (void *) BOOTINFO_OFFSET);
+	printf(" %p|%p: kernel entry point\n", (void *) PA2KA(BOOT_OFFSET),
+	    (void *) BOOT_OFFSET);
+	printf(" %p|%p: bootloader entry point\n",
+	    (void *) PA2KA(LOADER_OFFSET), (void *) LOADER_OFFSET);
 	
 	size_t i;
 	for (i = 0; i < COMPONENTS; i++)
-		printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
-		    KSEG2PA(components[i].start), components[i].name,
+		printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
+		    (void *) KSEG2PA(components[i].start), components[i].name,
 		    components[i].inflated, components[i].size);
 	
@@ -91,5 +96,5 @@
 		if (tail >= ((void *) PA2KA(LOADER_OFFSET))) {
 			printf("\n%s: Image too large to fit (%p >= %p), halting.\n",
-			    components[i].name, tail, PA2KA(LOADER_OFFSET));
+			    components[i].name, tail, (void *) PA2KA(LOADER_OFFSET));
 			halt();
 		}
Index: boot/arch/ppc32/include/types.h
===================================================================
--- boot/arch/ppc32/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/ppc32/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,5 +35,5 @@
 typedef uint32_t size_t;
 typedef uint32_t uintptr_t;
-typedef uint32_t unative_t;
+typedef uint32_t sysarg_t;
 typedef int32_t native_t;
 
Index: boot/arch/ppc32/src/main.c
===================================================================
--- boot/arch/ppc32/src/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/ppc32/src/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -68,10 +68,12 @@
 	printf(" %p|%p: real mode trampoline\n", &real_mode, real_mode_pa);
 	printf(" %p|%p: boot info structure\n", &bootinfo, bootinfo_pa);
-	printf(" %p|%p: kernel entry point\n", PA2KA(BOOT_OFFSET), BOOT_OFFSET);
-	printf(" %p|%p: loader entry point\n", LOADER_ADDRESS, loader_address_pa);
+	printf(" %p|%p: kernel entry point\n",
+	    (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET);
+	printf(" %p|%p: loader entry point\n",
+	    (void *) LOADER_ADDRESS, loader_address_pa);
 	
 	size_t i;
 	for (i = 0; i < COMPONENTS; i++)
-		printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
+		printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
 		    ofw_translate(components[i].start), components[i].name,
 		    components[i].inflated, components[i].size);
Index: boot/arch/sparc64/include/types.h
===================================================================
--- boot/arch/sparc64/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/sparc64/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,5 +35,5 @@
 typedef uint64_t size_t;
 typedef uint64_t uintptr_t;
-typedef uint64_t unative_t;
+typedef uint64_t sysarg_t;
 typedef int64_t native_t;
 
Index: boot/arch/sparc64/src/main.c
===================================================================
--- boot/arch/sparc64/src/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/arch/sparc64/src/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -209,13 +209,15 @@
 	void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS);
 	
-	printf("\nMemory statistics (total %llu MB, starting at %p)\n",
-	    bootinfo.memmap.total >> 20, bootinfo.physmem_start);
-	printf(" %p|%p: boot info structure\n", &bootinfo, bootinfo_pa);
-	printf(" %p|%p: kernel entry point\n", KERNEL_ADDRESS, kernel_address_pa);
-	printf(" %p|%p: loader entry point\n", LOADER_ADDRESS, loader_address_pa);
+	printf("\nMemory statistics (total %" PRIu64 " MB, starting at %p)\n",
+	    bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
+	printf(" %p|%p: boot info structure\n", &bootinfo, (void *) bootinfo_pa);
+	printf(" %p|%p: kernel entry point\n",
+	    (void *) KERNEL_ADDRESS, (void *) kernel_address_pa);
+	printf(" %p|%p: loader entry point\n",
+	    (void *) LOADER_ADDRESS, (void *) loader_address_pa);
 	
 	size_t i;
 	for (i = 0; i < COMPONENTS; i++)
-		printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
+		printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
 		    ofw_translate(components[i].start), components[i].name,
 		    components[i].inflated, components[i].size);
Index: boot/genarch/include/ofw.h
===================================================================
--- boot/genarch/include/ofw.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/genarch/include/ofw.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,5 +40,5 @@
 #define OFW_TREE_PROPERTY_MAX_VALUELEN  64
 
-typedef unative_t ofw_arg_t;
+typedef sysarg_t ofw_arg_t;
 typedef native_t ofw_ret_t;
 typedef uint32_t ofw_prop_t;
Index: boot/genarch/src/ofw.c
===================================================================
--- boot/genarch/src/ofw.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/genarch/src/ofw.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -243,5 +243,5 @@
 	void *addr = ofw_claim_virt_internal(virt, len, 0);
 	if (addr != virt) {
-		printf("Error: Unable to claim virtual memory %p (size %u), halting.\n",
+		printf("Error: Unable to claim virtual memory %p (size %zu), halting.\n",
 		    virt, len);
 		halt();
@@ -254,5 +254,5 @@
 	
 	if (addr == NULL) {
-		printf("Error: Unable to claim %u bytes in virtual memory, halting.\n",
+		printf("Error: Unable to claim %zu bytes in virtual memory, halting.\n",
 		    len);
 		halt();
@@ -305,5 +305,5 @@
 	void *addr = ofw_claim_phys_internal(phys, len, 0);
 	if (addr != phys) {
-		printf("Error: Unable to claim physical memory %p (size %u), halting.\n",
+		printf("Error: Unable to claim physical memory %p (size %zu), halting.\n",
 		    phys, len);
 		halt();
@@ -315,5 +315,5 @@
 	void *addr = ofw_claim_phys_internal(NULL, len, alignment);
 	if (addr == NULL) {
-		printf("Error: Unable to claim %u bytes in physical memory, halting.\n",
+		printf("Error: Unable to claim %zu bytes in physical memory, halting.\n",
 		    len);
 		halt();
@@ -343,5 +343,5 @@
 	
 	if (ret != 0) {
-		printf("Error: Unable to map %p to %p (size %u), halting.\n",
+		printf("Error: Unable to map %p to %p (size %zu), halting.\n",
 		    virt, phys, size);
 		halt();
Index: boot/generic/include/printf.h
===================================================================
--- boot/generic/include/printf.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/generic/include/printf.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,8 +36,20 @@
 #include <stdarg.h>
 
+#ifndef NVERIFY_PRINTF
+
+#define PRINTF_ATTRIBUTE(start, end) \
+	__attribute__((format(gnu_printf, start, end)))
+
+#else /* NVERIFY_PRINTF */
+
+#define PRINTF_ATTRIBUTE(start, end)
+
+#endif /* NVERIFY_PRINTF */
+
 #define EOF  (-1)
 
 extern int puts(const char *);
-extern int printf(const char *, ...);
+extern int printf(const char *, ...)
+    PRINTF_ATTRIBUTE(1, 2);
 extern int vprintf(const char *, va_list);
 
Index: boot/generic/include/stdint.h
===================================================================
--- boot/generic/include/stdint.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/generic/include/stdint.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -33,27 +33,27 @@
 #define BOOT_STDINT_H_
 
-#define INT8_MIN  (0x80)
-#define INT8_MAX  (0x7F)
+#define INT8_MIN  INT8_C(0x80)
+#define INT8_MAX  INT8_C(0x7F)
 
-#define UINT8_MIN  (0u)
-#define UINT8_MAX  (0xFFu)
+#define UINT8_MIN  UINT8_C(0)
+#define UINT8_MAX  UINT8_C(0xFF)
 
-#define INT16_MIN  (0x8000)
-#define INT16_MAX  (0x7FFF)
+#define INT16_MIN  INT16_C(0x8000)
+#define INT16_MAX  INT16_C(0x7FFF)
 
-#define UINT16_MIN  (0u)
-#define UINT16_MAX  (0xFFFFu)
+#define UINT16_MIN  UINT16_C(0)
+#define UINT16_MAX  UINT16_C(0xFFFF)
 
-#define INT32_MIN  (0x80000000l)
-#define INT32_MAX  (0x7FFFFFFFl)
+#define INT32_MIN  INT32_C(0x80000000)
+#define INT32_MAX  INT32_C(0x7FFFFFFF)
 
-#define UINT32_MIN  (0ul)
-#define UINT32_MAX  (0xFFFFFFFFul)
+#define UINT32_MIN  UINT32_C(0)
+#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
 
-#define INT64_MIN  (0x8000000000000000ll)
-#define INT64_MAX  (0x7FFFFFFFFFFFFFFFll)
+#define INT64_MIN  INT64_C(0x8000000000000000)
+#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
 
-#define UINT64_MIN  (0ull)
-#define UINT64_MAX  (0xFFFFFFFFFFFFFFFFull)
+#define UINT64_MIN  UINT64_C(0)
+#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
 
 #endif
Index: boot/generic/include/typedefs.h
===================================================================
--- boot/generic/include/typedefs.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/generic/include/typedefs.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,5 +37,5 @@
 #include <arch/types.h>
 
-#define NULL  0
+#define NULL  ((void *) 0)
 
 #define false  0
@@ -43,5 +43,4 @@
 
 typedef uint8_t bool;
-typedef int32_t wchar_t;
 
 #endif
Index: boot/generic/src/printf_core.c
===================================================================
--- boot/generic/src/printf_core.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ boot/generic/src/printf_core.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -79,5 +79,6 @@
 	PrintfQualifierLong,
 	PrintfQualifierLongLong,
-	PrintfQualifierPointer
+	PrintfQualifierPointer,
+	PrintfQualifierSize
 } qualifier_t;
 
@@ -431,6 +432,4 @@
  *  - ""   Signed or unsigned int (default value).@n
  *  - "l"  Signed or unsigned long int.@n
- *         If conversion is "c", the character is wchar_t (wide character).@n
- *         If conversion is "s", the string is wchar_t * (wide string).@n
  *  - "ll" Signed or unsigned long long int.@n
  *
@@ -612,4 +611,9 @@
 				}
 				break;
+			case 'z':
+				qualifier = PrintfQualifierSize;
+				i = nxt;
+				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
+				break;
 			default:
 				/* Default type */
@@ -720,4 +724,8 @@
 				number = (uint64_t) (uintptr_t) va_arg(ap, void *);
 				break;
+			case PrintfQualifierSize:
+				size = sizeof(size_t);
+				number = (uint64_t) va_arg(ap, size_t);
+				break;
 			default:
 				/* Unknown qualifier */
Index: contrib/arch/hadlbppp.py
===================================================================
--- contrib/arch/hadlbppp.py	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/hadlbppp.py	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1151,5 +1151,5 @@
 					continue
 				
-				if ((token == "ipcarg_t") or (token == "unative_t")):
+				if (token == "sysarg_t"):
 					output += "\n%s%s " % (tabs(indent), token)
 					context.add(PROTOTYPE)
Index: contrib/arch/kernel/kernel.adl
===================================================================
--- contrib/arch/kernel/kernel.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/kernel/kernel.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -5,5 +5,5 @@
 interface sys_klog {
 		/* Print using kernel facility */
-		unative_t sys_klog(int fd, const void *buf, size_t size);
+		sysarg_t sys_klog(int fd, const void *buf, size_t size);
 	protocol:
 		?sys_klog*
@@ -12,8 +12,8 @@
 interface sys_console {
 		/* Enable kernel console */
-		unative_t sys_debug_enable_console(void);
+		sysarg_t sys_debug_enable_console(void);
 		
 		/* Disable kernel console */
-		unative_t sys_debug_disable_console(void);
+		sysarg_t sys_debug_disable_console(void);
 	protocol:
 		(
@@ -25,5 +25,5 @@
 interface sys_tls {
 		/* Set thread-local storage pointer (on architectures where kernel mode is required) */
-		unative_t sys_tls_set(unative_t addr);
+		sysarg_t sys_tls_set(sysarg_t addr);
 	protocol:
 		?sys_tls_set*
@@ -32,11 +32,11 @@
 interface sys_thread {
 		/* Create new thread */
-		unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, size_t name_len, thread_id_t *uspace_thread_id);
+		sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, size_t name_len, thread_id_t *uspace_thread_id);
 		
 		/* Terminate current thread */
-		unative_t sys_thread_exit(int uspace_status);
+		sysarg_t sys_thread_exit(int uspace_status);
 		
 		/* Get current thread id */
-		unative_t sys_thread_get_id(thread_id_t *uspace_thread_id);
+		sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id);
 	protocol:
 		(
@@ -49,8 +49,8 @@
 interface sys_task {
 		/* Set name fo the current task */
-		unative_t sys_task_set_name(const char *uspace_name, size_t name_len);
+		sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len);
 		
 		/* Get current task id */
-		unative_t sys_task_get_id(task_id_t *uspace_task_id);
+		sysarg_t sys_task_get_id(task_id_t *uspace_task_id);
 	protocol:
 		(
@@ -62,5 +62,5 @@
 interface sys_program {
 		/* Spawn a new instance of clonable loader service */
-		unative_t sys_program_spawn_loader(char *uspace_name, size_t name_len);
+		sysarg_t sys_program_spawn_loader(char *uspace_name, size_t name_len);
 	protocol:
 		?sys_program_spawn_loader*
@@ -69,8 +69,8 @@
 interface sys_futex {
 		/* Sleep in a futex wait queue */
-		unative_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
+		sysarg_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
 		
 		/* Wakeup one thread waiting in futex wait queue */
-		unative_t sys_futex_wakeup(uintptr_t uaddr);
+		sysarg_t sys_futex_wakeup(uintptr_t uaddr);
 	protocol:
 		(
@@ -82,5 +82,5 @@
 interface sys_smc {
 		/* Enforce self-modifying code cache coherency */
-		unative_t sys_smc_coherence(uintptr_t va, size_t size);
+		sysarg_t sys_smc_coherence(uintptr_t va, size_t size);
 	protocol:
 		?sys_smc_coherence*
@@ -89,14 +89,14 @@
 interface sys_as {
 		/* Create new address space area */
-		unative_t sys_as_area_create(uintptr_t address, size_t size, int flags);
+		sysarg_t sys_as_area_create(uintptr_t address, size_t size, int flags);
 		
 		/* Resize an address space area */
-		unative_t sys_as_area_resize(uinptr_t address, size_t size, int flags);
+		sysarg_t sys_as_area_resize(uinptr_t address, size_t size, int flags);
 		
 		/* Change flags of an address space area */
-		unative_t sys_as_area_change_flags(uintptr_t address, int flags);
+		sysarg_t sys_as_area_change_flags(uintptr_t address, int flags);
 		
 		/* Destroy an address space area */
-		unative_t sys_as_area_destroy(uintptr_t address);
+		sysarg_t sys_as_area_destroy(uintptr_t address);
 	protocol:
 		(
@@ -110,35 +110,35 @@
 interface sys_ipc {
 		/* Fast synchronous IPC call */
-		unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data);
+		sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data);
 		
 		/* Slow synchronous IPC call */
-		unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question, ipc_data_t *answer);
+		sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *question, ipc_data_t *answer);
 		
 		/* Fast asynchronous IPC call */
-		unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method, unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
+		sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
 		
 		/* Slow asynchronous IPC call */
-		unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data);
+		sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data);
 		
 		/* Fast forward a received IPC call to another destination */
-		unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid, unative_t method, unative_t arg1, unative_t arg2, int mode);
+		sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, int mode);
 		
 		/* Slow forward a received IPC call to another destination */
-		unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid, ipc_data_t *data, int mode);
+		sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid, ipc_data_t *data, int mode);
 		
 		/* Fast answer an IPC call */
-		unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
+		sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
 		
 		/* Slow answer an IPC call */
-		unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data);
+		sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data);
 		
 		/* Hang up a phone */
-		unative_t sys_ipc_hangup(int phoneid);
+		sysarg_t sys_ipc_hangup(int phoneid);
 		
 		/* Wait for an incoming IPC call or answer */
-		unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags);
+		sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags);
 		
 		/* Interrupt one thread of the current task from waiting on IPC call */
-		unative_t sys_ipc_poke(void);
+		sysarg_t sys_ipc_poke(void);
 	protocol:
 		(
@@ -159,5 +159,5 @@
 interface sys_event {
 		/* Subscribe to kernel event notifications */
-		unative_t sys_event_subscribe(unative_t evno, unative_t method);
+		sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t method);
 	protocol:
 		?sys_event_subscribe*
@@ -166,8 +166,20 @@
 interface sys_cap {
 		/* Grant capabilities to a task */
-		unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps);
+#ifdef __32_BITS__
+		sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps);
+#endif
+		
+#ifdef __64_BITS__
+		sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps);
+#endif
 		
 		/* Revoke capabilities from a task */
-		unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps);
+#ifdef __32_BITS__
+		sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps);
+#endif
+		
+#ifdef __64_BITS__
+		sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps);
+#endif
 	protocol:
 		(
@@ -179,20 +191,20 @@
 interface sys_ddi {
 		/* Enable access I/O address space for the current task */
-		unative_t sys_enable_iospace(ddi_ioarg_t *uspace_io_arg);
+		sysarg_t sys_enable_iospace(ddi_ioarg_t *uspace_io_arg);
 		
 		/* Map physical memory to the current task's address space */
-		unative_t sys_physmem_map(unative_t phys_base, unative_t virt_base, unative_t pages, unative_t flags);
+		sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base, sysarg_t pages, sysarg_t flags);
 		
 		/* Enable or disable preemption */
-		unative_t sys_preempt_control(int enable);
+		sysarg_t sys_preempt_control(int enable);
 		
 		/* Assign unique device number */
-		unative_t sys_device_assign_devno(void);
+		sysarg_t sys_device_assign_devno(void);
 		
 		/* Connect an IRQ handler to the current task */
-		unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode);
+		sysarg_t sys_ipc_register_irq(inr_t inr, devno_t devno, sysarg_t method, irq_code_t *ucode);
 		
 		/* Disconnect an IRQ handler from the current task */
-		unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
+		sysarg_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
 	protocol:
 		(
@@ -208,8 +220,8 @@
 interface sys_sysinfo {
 		/* Check for sysinfo key validity */
-		unative_t sys_sysinfo_valid(unative_t ptr, unative_t len);
+		sysarg_t sys_sysinfo_valid(sysarg_t ptr, sysarg_t len);
 		
 		/* Get sysinfo key value */
-		unative_t sys_sysinfo_value(unatice_t ptr, unative_t len);
+		sysarg_t sys_sysinfo_value(unatice_t ptr, sysarg_t len);
 	protocol:
 		(
@@ -221,5 +233,11 @@
 interface sys_debug {
 		/* Connect to the kernel debugging answerbox of a given task */
-		unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg);
+#ifdef __32_BITS__
+		sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid);
+#endif
+		
+#ifdef __64_BITS__
+		sysarg_t sys_ipc_connect_kbox(sysarg_t taskid);
+#endif
 	protocol:
 		?sys_ipc_connect_kbox*
Index: contrib/arch/uspace/srv/bd/bd.adl
===================================================================
--- contrib/arch/uspace/srv/bd/bd.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/bd/bd.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,14 +1,14 @@
 interface bd extends service {
 		/* Share out data buffer */
-		ipcarg_t ipc_m_share_out(in ipcarg_t as_area_base, in ipcarg_t as_area_size, in ipcarg_t flags, out ipcarg_t dst_as_area_base);
+		sysarg_t ipc_m_share_out(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t flags, out sysarg_t dst_as_area_base);
 		
 		/* Get block size */
-		ipcarg_t get_block_size(out ipcarg_t block_size);
+		sysarg_t get_block_size(out sysarg_t block_size);
 		
 		/* Read blocks via shared data buffer */
-		ipcarg_t read_blocks(in ipcarg_t index_lower, in ipcarg_t index_upper, in ipcarg_t count);
+		sysarg_t read_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count);
 		
 		/* Write blocks via shared data buffer */
-		ipcarg_t write_blocks(in ipcarg_t index_lower, in ipcarg_t index_upper, in ipcarg_t count);
+		sysarg_t write_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count);
 	protocol:
 		[bd.bp]
Index: contrib/arch/uspace/srv/console/console.adl
===================================================================
--- contrib/arch/uspace/srv/console/console.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/console/console.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,41 +1,41 @@
 interface console extends service {
 		/* Read characters from console */
-		ipcarg_t read(out_copy stream data);
+		sysarg_t read(out_copy stream data);
 		
 		/* Write characters to console */
-		ipcarg_t write(in_copy stream data);
+		sysarg_t write(in_copy stream data);
 		
 		/* Get last event from event queue */
-		ipcarg_t get_event(out ipcarg_t type, out ipcarg_t key, out ipcarg_t mods, out ipcarg_t char);
+		sysarg_t get_event(out sysarg_t type, out sysarg_t key, out sysarg_t mods, out sysarg_t char);
 		
 		/* Flush output buffer */
-		ipcarg_t sync(void);
+		sysarg_t sync(void);
 		
 		/* Clear console */
-		ipcarg_t clear(void);
+		sysarg_t clear(void);
 		
 		/* Move cursor to given position */
-		ipcarg_t goto(in ipcarg_t col, in ipcarg_t row);
+		sysarg_t goto(in sysarg_t col, in sysarg_t row);
 		
 		/* Get console dimensions (in character cells) */
-		ipcarg_t get_size(out ipcarg_t cols, in ipcarg_t rows);
+		sysarg_t get_size(out sysarg_t cols, in sysarg_t rows);
 		
 		/* Get color capabilities */
-		ipcarg_t get_color_cap(void);
+		sysarg_t get_color_cap(void);
 		
 		/* Set abstract text style */
-		ipcarg_t set_style(in ipcarg_t style);
+		sysarg_t set_style(in sysarg_t style);
 		
 		/* Set EGA-based text color */
-		ipcarg_t set_color(in ipcarg_t fb_color, in ipcarg_t bg_color, in ipcarg_t attr);
+		sysarg_t set_color(in sysarg_t fb_color, in sysarg_t bg_color, in sysarg_t attr);
 		
 		/* Set RGB-based text color */
-		ipcarg_t set_rgb_color(in ipcarg_t fb_color, in ipcarg_t bg_color);
+		sysarg_t set_rgb_color(in sysarg_t fb_color, in sysarg_t bg_color);
 		
 		/* Set cursor visibility */
-		ipcarg_t cursor_visibility(in ipcarg_t visible);
+		sysarg_t cursor_visibility(in sysarg_t visible);
 		
 		/* Switch to kernel debugging console (if available) */
-		ipcarg_t kcon_enable(void);
+		sysarg_t kcon_enable(void);
 	protocol:
 		[console.bp]
Index: contrib/arch/uspace/srv/devmap/devmap.adl
===================================================================
--- contrib/arch/uspace/srv/devmap/devmap.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/devmap/devmap.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,26 +1,26 @@
 interface devmap_driver {
 		/* Establish connection (iface is DEVMAP_DRIVER) */
-		ipcarg_t ipc_m_connect_me_to(in ipcarg_t iface);
+		sysarg_t ipc_m_connect_me_to(in sysarg_t iface);
 		
 		/* Register as a new driver */
-		ipcarg_t driver_register(in_copy string name);
+		sysarg_t driver_register(in_copy string name);
 		
 		/* Unregister all devices and the driver itself */
-		ipcarg_t driver_unregister(void);
+		sysarg_t driver_unregister(void);
 		
 		/* Register new device and return handle */
-		ipcarg_t device_register(in_copy string name, out ipcarg_t handle);
+		sysarg_t device_register(in_copy string name, out sysarg_t handle);
 		
 		/* Unregister device */
-		ipcarg_t device_unregister(in ipcarg_t handle);
+		sysarg_t device_unregister(in sysarg_t handle);
 		
 		/* Resolve device name to handle */
-		ipcarg_t device_get_handle(in ipcarg_t flags, in_copy string name);
+		sysarg_t device_get_handle(in sysarg_t flags, in_copy string name);
 		
 		/* Get device name for a given handle */
-		ipcarg_t device_get_name(in ipcarg_t handle);
+		sysarg_t device_get_name(in sysarg_t handle);
 		
 		/* Close connection */
-		ipcarg_t ipc_m_phone_hungup(void);
+		sysarg_t ipc_m_phone_hungup(void);
 	protocol:
 		[devmap_driver.bp]
@@ -29,26 +29,26 @@
 interface devmap_client {
 		/* Establish connection (iface is DEVMAP_CLIENT) or forward to device (iface is DEVMAP_CONNECT_TO_DEVICE) */
-		ipcarg_t ipc_m_connect_me_to(in ipcarg_t iface, in ipcarg_t handle);
+		sysarg_t ipc_m_connect_me_to(in sysarg_t iface, in sysarg_t handle);
 		
 		/* Resolve device name to handle */
-		ipcarg_t device_get_handle(in ipcarg_t flags, in_copy string name);
+		sysarg_t device_get_handle(in sysarg_t flags, in_copy string name);
 		
 		/* Get device name for a given handle */
-		ipcarg_t device_get_name(in ipcarg_t handle);
+		sysarg_t device_get_name(in sysarg_t handle);
 		
 		/* Clone NULL device */
-		ipcarg_t device_null_create(out ipcarg_t index);
+		sysarg_t device_null_create(out sysarg_t index);
 		
 		/* Destroy NULL device */
-		ipcarg_t device_null_destroy(in ipcarg_t index);
+		sysarg_t device_null_destroy(in sysarg_t index);
 		
 		/* Get number of devices */
-		ipcarg_t device_get_count(out ipcarg_t count);
+		sysarg_t device_get_count(out sysarg_t count);
 		
 		/* Get an array of (device_name, handle) pairs */
-		ipcarg_t device_get_devices(out_copy stream data);
+		sysarg_t device_get_devices(out_copy stream data);
 		
 		/* Close connection */
-		ipcarg_t ipc_m_phone_hungup(void);
+		sysarg_t ipc_m_phone_hungup(void);
 	protocol:
 		[devmap_client.bp]
Index: contrib/arch/uspace/srv/fb/fb.adl
===================================================================
--- contrib/arch/uspace/srv/fb/fb.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/fb/fb.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,98 +1,98 @@
 interface fb extends service {
 		/* Get screen resolution */
-		ipcarg_t get_resolution(out ipcarg_t width, out ipcarg_t height);
+		sysarg_t get_resolution(out sysarg_t width, out sysarg_t height);
 		
 		/* Yield screen */
-		ipcarg_t screen_yield(void);
+		sysarg_t screen_yield(void);
 		
 		/* Reclaim screen */
-		ipcarg_t screen_reclaim(void);
+		sysarg_t screen_reclaim(void);
 		
 		/* Set mouse cursor position on screen */
-		ipcarg_t pointer_move(in ipcarg_t x, in ipcarg_t y);
+		sysarg_t pointer_move(in sysarg_t x, in sysarg_t y);
 		
 		/* Create new viewport */
-		ipcarg_t viewport_create(in ipcarg_t origin, in ipcarg_t dimension);
+		sysarg_t viewport_create(in sysarg_t origin, in sysarg_t dimension);
 		
 		/* Get viewport size in character cells */
-		ipcarg_t get_csize(out ipcarg_t width, out ipcarg_t height);
+		sysarg_t get_csize(out sysarg_t width, out sysarg_t height);
 		
 		/* Clear viewport character buffer */
-		ipcarg_t clear(void);
+		sysarg_t clear(void);
 		
 		/* Scroll viewport character buffer */
-		ipcarg_t scroll(in ipcarg_t lines);
+		sysarg_t scroll(in sysarg_t lines);
 		
 		/* Set active viewport */
-		ipcarg_t viewport_switch(in ipcarg_t index);
+		sysarg_t viewport_switch(in sysarg_t index);
 		
 		/* Delete viewport */
-		ipcarg_t viewport_delete(in ipcarg_t index);
+		sysarg_t viewport_delete(in sysarg_t index);
 		
 		/* Get color capabilities of the screen */
-		ipcarg_t get_color_cap(void);
+		sysarg_t get_color_cap(void);
 		
 		/* Set abstract text style */
-		ipcarg_t set_style(in ipcarg_t style);
+		sysarg_t set_style(in sysarg_t style);
 		
 		/* Set EGA-based text color */
-		ipcarg_t set_color(in ipcarg_t fg_color, in ipcarg_t bg_color, in ipcarg_t atrr);
+		sysarg_t set_color(in sysarg_t fg_color, in sysarg_t bg_color, in sysarg_t atrr);
 		
 		/* Set RGB-based text color */
-		ipcarg_t set_rgb_color(in ipcarg_t fg_color, in ipcarg_t bg_color);
+		sysarg_t set_rgb_color(in sysarg_t fg_color, in sysarg_t bg_color);
 		
 		/* Put a character to a given position in viewport character buffer */
-		ipcarg_t putchar(in ipcarg_t char, in ipcarg_t col, in ipcarg_t row);
+		sysarg_t putchar(in sysarg_t char, in sysarg_t col, in sysarg_t row);
 		
 		/* Set character cursor visibility in viewport */
-		ipcarg_t cursor_visibility(in ipcarg_t visible);
+		sysarg_t cursor_visibility(in sysarg_t visible);
 		
 		/* Set character cursor position in viewport */
-		ipcarg_t cursor_goto(in ipcarg_t col, in ipcarg_t row);
+		sysarg_t cursor_goto(in sysarg_t col, in sysarg_t row);
 		
 		/* Prepare memory sharing of bitmaps */
-		ipcarg_t prepare_shm(in ipcarg_t as_area_base);
+		sysarg_t prepare_shm(in sysarg_t as_area_base);
 		
 		/* Share bitmap or text data */
-		ipcarg_t ipc_m_share_out(in ipcarg_t as_area_base, in ipcarg_t as_area_size, out ipcarg_t dst_as_area);
+		sysarg_t ipc_m_share_out(in sysarg_t as_area_base, in sysarg_t as_area_size, out sysarg_t dst_as_area);
 		
 		/* Drop memory sharing */
-		ipcarg_t drop_shm(void);
+		sysarg_t drop_shm(void);
 		
 		/* Draw PPM data from shared memory to viewport */
-		ipcarg_t draw_ppm(in ipcarg_t x, in ipcarg_t y);
+		sysarg_t draw_ppm(in sysarg_t x, in sysarg_t y);
 		
 		/* Put characters from shared memory to viewport */
-		ipcarg_t draw_text_data(in ipcarg_t x, in ipcarg_t y, in ipcarg_t width, in ipcarg_t height);
+		sysarg_t draw_text_data(in sysarg_t x, in sysarg_t y, in sysarg_t width, in sysarg_t height);
 		
 		/* Convert PPM data from shared memory to pixmap */
-		ipcarg_t shm2pixmap(void);
+		sysarg_t shm2pixmap(void);
 		
 		/* Save viewport contents to a pixmap */
-		ipcarg_t vp2pixmap(in ipcarg_t vp_index);
+		sysarg_t vp2pixmap(in sysarg_t vp_index);
 		
 		/* Draw pixmap to viewport */
-		ipcarg_t vp_draw_pixmap(in ipcarg_t vp_index, in ipcarg_t pm_index);
+		sysarg_t vp_draw_pixmap(in sysarg_t vp_index, in sysarg_t pm_index);
 		
 		/* Discard pixmap */
-		ipcarg_t drop_pixmap(in ipcarg_t pm_index);
+		sysarg_t drop_pixmap(in sysarg_t pm_index);
 		
 		/* Create new (empty) animation for a viewport */
-		ipcarg_t anim_create(in ipcarg_t vp_index);
+		sysarg_t anim_create(in sysarg_t vp_index);
 		
 		/* Append a pixmap to an animation */
-		ipcarg_t anim_addpixmap(in ipcarg_t anim_index, in ipcarg_t pm_index);
+		sysarg_t anim_addpixmap(in sysarg_t anim_index, in sysarg_t pm_index);
 		
 		/* Change a viewport associated with an animation */
-		ipcarg_t anim_chgvp(in ipcarg_t anim_index, in ipcarg_t vp_index);
+		sysarg_t anim_chgvp(in sysarg_t anim_index, in sysarg_t vp_index);
 		
 		/* Start animation playback */
-		ipcarg_t anim_start(in ipcarg_t anim_index);
+		sysarg_t anim_start(in sysarg_t anim_index);
 		
 		/* Stop animation playback */
-		ipcarg_t anim_stop(in ipcarg_t anim_index);
+		sysarg_t anim_stop(in sysarg_t anim_index);
 		
 		/* Delete animation */
-		ipcarg_t anim_drop(in ipcarg_t anim_index);
+		sysarg_t anim_drop(in sysarg_t anim_index);
 	protocol:
 		[fb.bp]
Index: contrib/arch/uspace/srv/kbd/kbd.adl
===================================================================
--- contrib/arch/uspace/srv/kbd/kbd.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/kbd/kbd.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,11 +1,11 @@
 interface kbd extends service {
 		/* Callback connection */
-		ipcarg_t ipc_m_connect_to_me(void);
+		sysarg_t ipc_m_connect_to_me(void);
 		
 		/* Yield hardware */
-		ipcarg_t yield(void);
+		sysarg_t yield(void);
 		
 		/* Reclaim hardware */
-		ipcarg_t reclaim(void);
+		sysarg_t reclaim(void);
 	protocol:
 		[kbd.bp]
@@ -14,5 +14,5 @@
 interface event {
 		/* Send keyboard event */
-		ipcarg_t event(in ipcarg_t type, in ipcarg_t key, in ipcarg_t mods, in ipcarg_t char);
+		sysarg_t event(in sysarg_t type, in sysarg_t key, in sysarg_t mods, in sysarg_t char);
 	protocol:
 		[event.bp]
Index: contrib/arch/uspace/srv/loader/loader.adl
===================================================================
--- contrib/arch/uspace/srv/loader/loader.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/loader/loader.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,20 +1,20 @@
 interface loader extends service {
 		/* Set task pathname */
-		ipcarg_t set_pathname(in_copy string pathname);
+		sysarg_t set_pathname(in_copy string pathname);
 		
 		/* Set task arguments */
-		ipcarg_t set_args(in_copy stream args);
+		sysarg_t set_args(in_copy stream args);
 		
 		/* Set task initial files */
-		ipcarg_t set_files(in_copy stream files);
+		sysarg_t set_files(in_copy stream files);
 		
 		/* Get task ID */
-		ipcarg_t get_taskid(out_copy stream id);
+		sysarg_t get_taskid(out_copy stream id);
 		
 		/* Load binary */
-		ipcarg_t load(void);
+		sysarg_t load(void);
 		
 		/* Run binary */
-		ipcarg_t run(void);
+		sysarg_t run(void);
 	protocol:
 		[loader.bp]
Index: contrib/arch/uspace/srv/ns/ns.adl
===================================================================
--- contrib/arch/uspace/srv/ns/ns.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/ns/ns.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,26 +1,26 @@
 interface ns {
 		/* Register a clonable service or a generic service */
-		ipcarg_t ipc_m_connect_to_me(in ipcarg_t service);
+		sysarg_t ipc_m_connect_to_me(in sysarg_t service);
 		
 		/* Connect to a clonable service or a generic service */
-		ipcarg_t ipc_m_connect_me_to(in ipcarg_t service, in ipcarg_t arg2, in ipcarg_t arg3, in ipcarg_t flags);
+		sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags);
 		
 		/* Share real-time clock page or klog page */
-		ipcarg_t ipc_m_share_in(in ipcarg_t as_area_base, in ipcarg_t as_area_size, in ipcarg_t service);
+		sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service);
 		
 		/* For IPC testing purposes */
-		ipcarg_t ping(void);
+		sysarg_t ping(void);
 		
 		/* Wait for task exit and get exit status and return value */
-		ipcarg_t task_wait(in ipcarg_t id_lower, in ipcarg_t id_upper, out ipcarg_t status, out ipcarg_t retval);
+		sysarg_t task_wait(in sysarg_t id_lower, in sysarg_t id_upper, out sysarg_t status, out sysarg_t retval);
 		
 		/* Introduce a new loader task id in such a way it cannot be spoofed */
-		ipcarg_t id_intro(in ipcarg_t id_lower, in ipcarg_t id_upper);
+		sysarg_t id_intro(in sysarg_t id_lower, in sysarg_t id_upper);
 		
 		/* Set task return value */
-		ipcarg_t retval(in ipcarg_t retval);
+		sysarg_t retval(in sysarg_t retval);
 		
 		/* Implicit connection close */
-		ipcarg_t ipc_m_phone_hungup(void);
+		sysarg_t ipc_m_phone_hungup(void);
 	protocol:
 		[ns.bp]
Index: contrib/arch/uspace/srv/ns/service.adl
===================================================================
--- contrib/arch/uspace/srv/ns/service.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/ns/service.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -2,7 +2,7 @@
 		/* Establish connection with the service
 		   (this call is forwarded from Naming Service or Device Mapper) */
-		ipcarg_t ipc_m_connect_me_to(void);
+		sysarg_t ipc_m_connect_me_to(void);
 		
 		/* Close connection */
-		ipcarg_t ipc_m_phone_hungup(void);
+		sysarg_t ipc_m_phone_hungup(void);
 };
Index: contrib/arch/uspace/srv/vfs/vfs.adl
===================================================================
--- contrib/arch/uspace/srv/vfs/vfs.adl	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/arch/uspace/srv/vfs/vfs.adl	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,50 +1,50 @@
 interface vfs extends service {
 		/* Register a filesystem driver */
-		ipcarg_t register(in_copy string name);
+		sysarg_t register(in_copy string name);
 		
 		/* Mount filesystem */
-		ipcarg_t mount(in ipcarg_t device, in ipcarg_t flags, in_copy string point, in_copy string opts, in_copy string fs);
+		sysarg_t mount(in sysarg_t device, in sysarg_t flags, in_copy string point, in_copy string opts, in_copy string fs);
 		
 		/* Open file */
-		ipcarg_t open(in ipcarg_t lflag, in ipcarg_t oflag, in ipcarg_t mode, in_copy string path, out ipcarg_t fd);
+		sysarg_t open(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, in_copy string path, out sysarg_t fd);
 		
 		/* Open file using node */
-		ipcarg_t open_node(in ipcarg_t fs_handle, in ipcarg_t dev_handle, in ipcarg_t index, in ipcarg_t oflag, out ipcarg_t fd);
+		sysarg_t open_node(in sysarg_t fs_handle, in sysarg_t dev_handle, in sysarg_t index, in sysarg_t oflag, out sysarg_t fd);
 		
 		/* Read data from file */
-		ipcarg_t read(in ipcarg_t fd, out_copy stream data);
+		sysarg_t read(in sysarg_t fd, out_copy stream data);
 		
 		/* Write data to file */
-		ipcarg_t write(in ipcarg_t fd, in_copy stream data);
+		sysarg_t write(in sysarg_t fd, in_copy stream data);
 		
 		/* Seek in file */
-		ipcarg_t seek(in ipcarg_t fd, in ipcarg_t offset, in ipcarg_t whence);
+		sysarg_t seek(in sysarg_t fd, in sysarg_t offset, in sysarg_t whence);
 		
 		/* Truncate file */
-		ipcarg_t truncate(in ipcarg_t fd, in ipcarg_t size);
+		sysarg_t truncate(in sysarg_t fd, in sysarg_t size);
 		
 		/* Get file metadata */
-		ipcarg_t fstat(in ipcarg_t fd, out_copy stream stat);
+		sysarg_t fstat(in sysarg_t fd, out_copy stream stat);
 		
 		/* Get directory entry metadata */
-		ipcarg_t stat(in_copy string path, out_copy stream stat);
+		sysarg_t stat(in_copy string path, out_copy stream stat);
 		
 		/* Create directory */
-		ipcarg_t mkdir(in ipcarg_t mode, in_copy string path);
+		sysarg_t mkdir(in sysarg_t mode, in_copy string path);
 		
 		/* Delete directory entry */
-		ipcarg_t unlink(in ipcarg_t lflag, in_copy string path);
+		sysarg_t unlink(in sysarg_t lflag, in_copy string path);
 		
 		/* Rename directory entry */
-		ipcarg_t rename(in_copy string old, in_copy string new);
+		sysarg_t rename(in_copy string old, in_copy string new);
 		
 		/* Flush file buffers */
-		ipcarg_t sync(in ipcarg_t fd);
+		sysarg_t sync(in sysarg_t fd);
 		
 		/* In-protocol status value */
-		ipcarg_t ipc_m_ping(void);
+		sysarg_t ipc_m_ping(void);
 		
 		/* Close connection */
-		ipcarg_t ipc_m_phone_hungup(void);
+		sysarg_t ipc_m_phone_hungup(void);
 	protocol:
 		[vfs.bp]
@@ -53,32 +53,32 @@
 interface fs extends service {
 		/* Notify filesystem that it was mounted */
-		ipcarg_t mounted(in ipcarg_t dev_handle, in_copy string opts);
+		sysarg_t mounted(in sysarg_t dev_handle, in_copy string opts);
 		
 		/* Mount filesystem */
-		ipcarg_t mount(in ipcarg_t device, in ipcarg_t flags, in_copy string point, in_copy string opts, ...);
+		sysarg_t mount(in sysarg_t device, in sysarg_t flags, in_copy string point, in_copy string opts, ...);
 		
 		/* Open file by node */
-		ipcarg_t open_node(in ipcarg_t lflag, in ipcarg_t oflag, in ipcarg_t mode, ...);
+		sysarg_t open_node(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...);
 		
 		/* Lookup file */
-		ipcarg_t lookup(in ipcarg_t lflag, in ipcarg_t oflag, in ipcarg_t mode, ...);
+		sysarg_t lookup(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...);
 		
 		/* Read data from file */
-		ipcarg_t read(in ipcarg_t dev_handle, in ipcarg_t fs_index, in ipcarg_t offset, out_copy stream data);
+		sysarg_t read(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, out_copy stream data);
 		
 		/* Write data to file */
-		ipcarg_t write(in ipcarg_t dev_handle, in ipcarg_t fs_index, in ipcarg_t offset, in_copy stream data);
+		sysarg_t write(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, in_copy stream data);
 		
 		/* Truncate file */
-		ipcarg_t truncate(in ipcarg_t dev_handle, in ipcarg_t fs_index, in ipcarg_t size);
+		sysarg_t truncate(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t size);
 		
 		/* Get directory entry metadata */
-		ipcarg_t stat(in ipcarg_t dev_handle, in ipcarg_t fs_index, out_copy stream stat);
+		sysarg_t stat(in sysarg_t dev_handle, in sysarg_t fs_index, out_copy stream stat);
 		
 		/* Flush file buffers */
-		ipcarg_t sync(in ipcarg_t dev_handle, in ipcarg_t fs_index);
+		sysarg_t sync(in sysarg_t dev_handle, in sysarg_t fs_index);
 		
 		/* Notify on file close */
-		ipcarg_t close(in ipcarg_t dev_handle, in ipcarg_t fs_index);
+		sysarg_t close(in sysarg_t dev_handle, in sysarg_t fs_index);
 };
 
Index: contrib/conf/msim.conf
===================================================================
--- contrib/conf/msim.conf	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/conf/msim.conf	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -16,3 +16,3 @@
 add dprinter printer 0x10000000
 add dkeyboard keyboard 0x10000000 2
-add dorder order 0x10000004 5
+add dorder order 0x10000100 5
Index: contrib/highlight/adl.syntax
===================================================================
--- contrib/highlight/adl.syntax	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ contrib/highlight/adl.syntax	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -17,5 +17,5 @@
 	keyword whole delegate yellow
 	
-	keyword whole ipcarg_t yellow
+	keyword whole sysarg_t yellow
 	keyword whole string yellow
 	keyword whole stream yellow
Index: defaults/amd64/Makefile.config
===================================================================
--- defaults/amd64/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/amd64/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,4 +65,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/arm32/Makefile.config
===================================================================
--- defaults/arm32/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/arm32/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,4 +41,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/ia32/Makefile.config
===================================================================
--- defaults/ia32/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/ia32/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -71,4 +71,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/ia64/Makefile.config
===================================================================
--- defaults/ia64/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/ia64/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -53,4 +53,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/mips32/Makefile.config
===================================================================
--- defaults/mips32/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/mips32/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,4 +47,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/ppc32/Makefile.config
===================================================================
--- defaults/ppc32/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/ppc32/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,4 +47,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/sparc64/Makefile.config
===================================================================
--- defaults/sparc64/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/sparc64/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,4 +62,2 @@
 CONFIG_MOUNT_DATA = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: defaults/special/Makefile.config
===================================================================
--- defaults/special/Makefile.config	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ defaults/special/Makefile.config	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -32,4 +32,2 @@
 CONFIG_START_BD = n
 
-# Bundle netif/nil network layer
-CONFIG_NETIF_NIL_BUNDLE = n
Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -313,4 +313,5 @@
 		test/print/print3.c \
 		test/print/print4.c \
+		test/print/print5.c \
 		test/thread/thread1.c
 	
Index: kernel/arch/abs32le/include/istate.h
===================================================================
--- kernel/arch/abs32le/include/istate.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/abs32le/include/istate.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,13 +37,18 @@
 
 #ifdef KERNEL
+
 #include <typedefs.h>
 #include <verify.h>
 #include <trace.h>
-#else
+
+#else /* KERNEL */
+
 #include <sys/types.h>
+
 #define NO_TRACE
 #define REQUIRES_EXTENT_MUTABLE(arg)
 #define WRITES(arg)
-#endif
+
+#endif /* KERNEL */
 
 /*
@@ -63,5 +68,5 @@
 	   context originated from user space. */
 	
-	return !(istate->ip & 0x80000000);
+	return !(istate->ip & UINT32_C(0x80000000));
 }
 
Index: kernel/arch/abs32le/include/mm/as.h
===================================================================
--- kernel/arch/abs32le/include/mm/as.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/abs32le/include/mm/as.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,8 +38,8 @@
 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
 
-#define KERNEL_ADDRESS_SPACE_START_ARCH  ((unsigned long) 0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    ((unsigned long) 0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    ((unsigned long) 0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH      ((unsigned long) 0x7fffffff)
+#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
+#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
+#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
+#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
 
 #define USTACK_ADDRESS_ARCH  (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
Index: kernel/arch/abs32le/include/mm/page.h
===================================================================
--- kernel/arch/abs32le/include/mm/page.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/abs32le/include/mm/page.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,6 +44,6 @@
 #ifdef KERNEL
 
-#define KA2PA(x)  (((uintptr_t) (x)) - 0x80000000)
-#define PA2KA(x)  (((uintptr_t) (x)) + 0x80000000)
+#define KA2PA(x)  (((uintptr_t) (x)) - UINT32_C(0x80000000))
+#define PA2KA(x)  (((uintptr_t) (x)) + UINT32_C(0x80000000))
 
 /*
@@ -65,8 +65,8 @@
 
 /* Macros calculating indices for each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ff)
+#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ffU)
 #define PTL1_INDEX_ARCH(vaddr)  0
 #define PTL2_INDEX_ARCH(vaddr)  0
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ff)
+#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ffU)
 
 /* Get PTE address accessors for each level. */
Index: kernel/arch/abs32le/include/types.h
===================================================================
--- kernel/arch/abs32le/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/abs32le/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,5 +46,5 @@
 typedef uint32_t ipl_t;
 
-typedef uint32_t unative_t;
+typedef uint32_t sysarg_t;
 typedef int32_t native_t;
 typedef uint32_t atomic_count_t;
@@ -53,24 +53,11 @@
 } fncptr_t;
 
-#define PRIp  "x"  /**< Format for uintptr_t. */
-#define PRIs  "u"  /**< Format for size_t. */
+#define INTN_C(c)   INT32_C(c)
+#define UINTN_C(c)  UINT32_C(c)
 
-#define PRId8   "d"    /**< Format for int8_t. */
-#define PRId16  "d"    /**< Format for int16_t. */
-#define PRId32  "d"    /**< Format for int32_t. */
-#define PRId64  "lld"  /**< Format for int64_t. */
-#define PRIdn   "d"    /**< Format for native_t. */
-
-#define PRIu8   "u"    /**< Format for uint8_t. */
-#define PRIu16  "u"    /**< Format for uint16_t. */
-#define PRIu32  "u"    /**< Format for uint32_t. */
-#define PRIu64  "llu"  /**< Format for uint64_t. */
-#define PRIun   "u"    /**< Format for unative_t. */
-
-#define PRIx8   "x"    /**< Format for hexadecimal (u)int8_t. */
-#define PRIx16  "x"    /**< Format for hexadecimal (u)int16_t. */
-#define PRIx32  "x"    /**< Format for hexadecimal (u)uint32_t. */
-#define PRIx64  "llx"  /**< Format for hexadecimal (u)int64_t. */
-#define PRIxn   "x"    /**< Format for hexadecimal (u)native_t. */
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/abs32le/src/abs32le.c
===================================================================
--- kernel/arch/abs32le/src/abs32le.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/abs32le/src/abs32le.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -86,5 +86,5 @@
 }
 
-unative_t sys_tls_set(unative_t addr)
+sysarg_t sys_tls_set(sysarg_t addr)
 {
 	return EOK;
Index: kernel/arch/amd64/include/asm.h
===================================================================
--- kernel/arch/amd64/include/asm.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/asm.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -304,5 +304,5 @@
 }
 
-NO_TRACE static inline unative_t read_msr(uint32_t msr)
+NO_TRACE static inline sysarg_t read_msr(uint32_t msr)
 {
 	uint32_t ax, dx;
@@ -343,5 +343,5 @@
 	asm volatile (
 		"invlpg %[addr]\n"
-		:: [addr] "m" (*((unative_t *) addr))
+		:: [addr] "m" (*((sysarg_t *) addr))
 	);
 }
@@ -398,7 +398,7 @@
 }
 
-#define GEN_READ_REG(reg) NO_TRACE static inline unative_t read_ ##reg (void) \
+#define GEN_READ_REG(reg) NO_TRACE static inline sysarg_t read_ ##reg (void) \
 	{ \
-		unative_t res; \
+		sysarg_t res; \
 		asm volatile ( \
 			"movq %%" #reg ", %[res]" \
@@ -408,5 +408,5 @@
 	}
 
-#define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (unative_t regn) \
+#define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (sysarg_t regn) \
 	{ \
 		asm volatile ( \
Index: kernel/arch/amd64/include/context.h
===================================================================
--- kernel/arch/amd64/include/context.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/context.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup amd64	
+/** @addtogroup amd64
  * @{
  */
@@ -44,5 +44,5 @@
  * panic sooner or later
  */
-#define SP_DELTA     16
+#define SP_DELTA  16
 
 #define context_set(c, _pc, stack, size) \
Index: kernel/arch/amd64/include/context_offset.h
===================================================================
--- kernel/arch/amd64/include/context_offset.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/context_offset.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,22 +30,22 @@
 #define KERN_amd64_CONTEXT_OFFSET_H_
 
-#define OFFSET_SP  0x0
-#define OFFSET_PC  0x8
-#define OFFSET_RBX 0x10
-#define OFFSET_RBP 0x18
-#define OFFSET_R12 0x20
-#define OFFSET_R13 0x28
-#define OFFSET_R14 0x30
-#define OFFSET_R15 0x38
+#define OFFSET_SP   0x00
+#define OFFSET_PC   0x08
+#define OFFSET_RBX  0x10
+#define OFFSET_RBP  0x18
+#define OFFSET_R12  0x20
+#define OFFSET_R13  0x28
+#define OFFSET_R14  0x30
+#define OFFSET_R15  0x38
 
 #ifdef KERNEL
-# define OFFSET_IPL 0x40
+	#define OFFSET_IPL  0x40
 #else
-# define OFFSET_TLS 0x40
+	#define OFFSET_TLS  0x40
 #endif
 
 #ifdef __ASM__
 
-# ctx: address of the structure with saved context 
+# ctx: address of the structure with saved context
 # pc: return address
 .macro CONTEXT_SAVE_ARCH_CORE ctx:req pc:req
@@ -61,5 +61,5 @@
 .endm
 
-# ctx: address of the structure with saved context 
+# ctx: address of the structure with saved context
 .macro CONTEXT_RESTORE_ARCH_CORE ctx:req pc:req
 	movq OFFSET_R15(\ctx), %r15
@@ -68,5 +68,5 @@
 	movq OFFSET_R12(\ctx), %r12
 	movq OFFSET_RBP(\ctx), %rbp
-	movq OFFSET_RBX(\ctx), %rbx	
+	movq OFFSET_RBX(\ctx), %rbx
 	
 	movq OFFSET_SP(\ctx), %rsp   # ctx->sp -> %rsp
Index: kernel/arch/amd64/include/cpu.h
===================================================================
--- kernel/arch/amd64/include/cpu.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/cpu.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,15 +36,15 @@
 #define KERN_amd64_CPU_H_
 
-#define RFLAGS_CF	(1 << 0)
-#define RFLAGS_PF	(1 << 2)
-#define RFLAGS_AF	(1 << 4)
-#define RFLAGS_ZF	(1 << 6)
-#define RFLAGS_SF	(1 << 7)
-#define RFLAGS_TF	(1 << 8)
-#define RFLAGS_IF	(1 << 9)
-#define RFLAGS_DF	(1 << 10)
-#define RFLAGS_OF	(1 << 11)
-#define RFLAGS_NT	(1 << 14)
-#define RFLAGS_RF	(1 << 16)
+#define RFLAGS_CF  (1 << 0)
+#define RFLAGS_PF  (1 << 2)
+#define RFLAGS_AF  (1 << 4)
+#define RFLAGS_ZF  (1 << 6)
+#define RFLAGS_SF  (1 << 7)
+#define RFLAGS_TF  (1 << 8)
+#define RFLAGS_IF  (1 << 9)
+#define RFLAGS_DF  (1 << 10)
+#define RFLAGS_OF  (1 << 11)
+#define RFLAGS_NT  (1 << 14)
+#define RFLAGS_RF  (1 << 16)
 
 #define EFER_MSR_NUM    0xc0000080
Index: kernel/arch/amd64/include/debugger.h
===================================================================
--- kernel/arch/amd64/include/debugger.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/debugger.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,9 +41,9 @@
 
 /* Flags that are passed to breakpoint_add function */
-#define BKPOINT_INSTR       0x1
-#define BKPOINT_WRITE       0x2
-#define BKPOINT_READ_WRITE  0x4
+#define BKPOINT_INSTR       0x1U
+#define BKPOINT_WRITE       0x2U
+#define BKPOINT_READ_WRITE  0x4U
 
-#define BKPOINT_CHECK_ZERO  0x8
+#define BKPOINT_CHECK_ZERO  0x8U
 
 
Index: kernel/arch/amd64/include/istate.h
===================================================================
--- kernel/arch/amd64/include/istate.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/istate.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,10 +37,15 @@
 
 #ifdef KERNEL
+
 #include <typedefs.h>
 #include <trace.h>
-#else
+
+#else /* KERNEL */
+
 #include <sys/types.h>
+
 #define NO_TRACE
-#endif
+
+#endif /* KERNEL */
 
 /** This is passed to interrupt handlers */
@@ -61,13 +66,13 @@
 	uint64_t r14;
 	uint64_t r15;
-	uint64_t alignment;	/* align rbp_frame on multiple of 16 */
-	uint64_t rbp_frame;	/* imitation of frame pointer linkage */
-	uint64_t rip_frame;	/* imitation of return address linkage */
-	uint64_t error_word;	/* real or fake error word */
+	uint64_t alignment;   /* align rbp_frame on multiple of 16 */
+	uint64_t rbp_frame;   /* imitation of frame pointer linkage */
+	uint64_t rip_frame;   /* imitation of return address linkage */
+	uint64_t error_word;  /* real or fake error word */
 	uint64_t rip;
 	uint64_t cs;
 	uint64_t rflags;
-	uint64_t rsp;		/* only if istate_t is from uspace */
-	uint64_t ss;		/* only if istate_t is from uspace */
+	uint64_t rsp;         /* only if istate_t is from uspace */
+	uint64_t ss;          /* only if istate_t is from uspace */
 } istate_t;
 
@@ -75,5 +80,5 @@
 NO_TRACE static inline int istate_from_uspace(istate_t *istate)
 {
-	return !(istate->rip & 0x8000000000000000);
+	return !(istate->rip & UINT64_C(0x8000000000000000));
 }
 
Index: kernel/arch/amd64/include/mm/as.h
===================================================================
--- kernel/arch/amd64/include/mm/as.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/mm/as.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,14 +36,14 @@
 #define KERN_amd64_AS_H_
 
-#define ADDRESS_SPACE_HOLE_START	0x0000800000000000ULL
-#define ADDRESS_SPACE_HOLE_END		0xffff7fffffffffffULL
+#define ADDRESS_SPACE_HOLE_START  UINT64_C(0x0000800000000000)
+#define ADDRESS_SPACE_HOLE_END    UINT64_C(0xffff7fffffffffff)
 
 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
 
-#define KERNEL_ADDRESS_SPACE_START_ARCH	0xffff800000000000ULL
-#define KERNEL_ADDRESS_SPACE_END_ARCH	0xffffffffffffffffULL
+#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xffff800000000000)
+#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
 
-#define USER_ADDRESS_SPACE_START_ARCH	0x0000000000000000ULL
-#define USER_ADDRESS_SPACE_END_ARCH	0x00007fffffffffffULL
+#define USER_ADDRESS_SPACE_START_ARCH  UINT64_C(0x0000000000000000)
+#define USER_ADDRESS_SPACE_END_ARCH    UINT64_C(0x00007fffffffffff)
 
 #define USTACK_ADDRESS_ARCH  (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
Index: kernel/arch/amd64/include/mm/page.h
===================================================================
--- kernel/arch/amd64/include/mm/page.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/mm/page.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -55,6 +55,6 @@
 #ifndef __ASM__
 
-#define KA2PA(x)  (((uintptr_t) (x)) - 0xffff800000000000)
-#define PA2KA(x)  (((uintptr_t) (x)) + 0xffff800000000000)
+#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
+#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
 
 #else /* __ASM__ */
@@ -78,8 +78,8 @@
 
 /* Macros calculating indices into page tables in each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 39) & 0x1ff)
-#define PTL1_INDEX_ARCH(vaddr)  (((vaddr) >> 30) & 0x1ff)
-#define PTL2_INDEX_ARCH(vaddr)  (((vaddr) >> 21) & 0x1ff)
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x1ff)
+#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 39) & 0x1ffU)
+#define PTL1_INDEX_ARCH(vaddr)  (((vaddr) >> 30) & 0x1ffU)
+#define PTL2_INDEX_ARCH(vaddr)  (((vaddr) >> 21) & 0x1ffU)
+#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x1ffU)
 
 /* Get PTE address accessors for each level. */
@@ -205,5 +205,5 @@
 	pte_t *p = &pt[i];
 	
-	p->addr_12_31 = (a >> 12) & 0xfffff;
+	p->addr_12_31 = (a >> 12) & UINT32_C(0xfffff);
 	p->addr_32_51 = a >> 32;
 }
Index: kernel/arch/amd64/include/pm.h
===================================================================
--- kernel/arch/amd64/include/pm.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/pm.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -75,7 +75,7 @@
 #define AR_WRITABLE   (1 << 1)
 #define AR_READABLE   (1 << 1)
-#define AR_TSS        (0x09)
-#define AR_INTERRUPT  (0x0e)
-#define AR_TRAP       (0x0f)
+#define AR_TSS        (0x09U)
+#define AR_INTERRUPT  (0x0eU)
+#define AR_TRAP       (0x0fU)
 
 #define DPL_KERNEL  (PL_KERNEL << 5)
Index: kernel/arch/amd64/include/proc/thread.h
===================================================================
--- kernel/arch/amd64/include/proc/thread.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/proc/thread.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,5 +41,5 @@
 
 typedef struct {
-	unative_t tls;
+	sysarg_t tls;
 	/** User and kernel RSP for syscalls. */
 	uint64_t syscall_rsp[2];
Index: kernel/arch/amd64/include/types.h
===================================================================
--- kernel/arch/amd64/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,5 +43,5 @@
 typedef uint64_t ipl_t;
 
-typedef uint64_t unative_t;
+typedef uint64_t sysarg_t;
 typedef int64_t native_t;
 typedef uint64_t atomic_count_t;
@@ -50,26 +50,11 @@
 } fncptr_t;
 
-/* Formats for uintptr_t, size_t */
-#define PRIp  "llx"
-#define PRIs  "llu"
+#define INTN_C(c)   INT64_C(c)
+#define UINTN_C(c)  UINT64_C(c)
 
-/* Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */
-#define PRId8   "d"
-#define PRId16  "d"
-#define PRId32  "d"
-#define PRId64  "lld"
-#define PRIdn   "lld"
-
-#define PRIu8   "u"
-#define PRIu16  "u"
-#define PRIu32  "u"
-#define PRIu64  "llu"
-#define PRIun   "llu"
-
-#define PRIx8   "x"
-#define PRIx16  "x"
-#define PRIx32  "x"
-#define PRIx64  "llx"
-#define PRIxn   "llx"
+#define PRIdn  PRId64  /**< Format for native_t. */
+#define PRIun  PRIu64  /**< Format for sysarg_t. */
+#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/amd64/src/amd64.c
===================================================================
--- kernel/arch/amd64/src/amd64.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/amd64.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -199,4 +199,10 @@
 void arch_post_smp_init(void)
 {
+	/* Currently the only supported platform for amd64 is 'pc'. */
+	static const char *platform = "pc";
+
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 #ifdef CONFIG_PC_KBD
 	/*
@@ -256,5 +262,5 @@
  * we need not to go to CPL0 to read it.
  */
-unative_t sys_tls_set(unative_t addr)
+sysarg_t sys_tls_set(sysarg_t addr)
 {
 	THREAD->arch.tls = addr;
Index: kernel/arch/amd64/src/boot/memmap.c
===================================================================
--- kernel/arch/amd64/src/boot/memmap.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/boot/memmap.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,5 +35,5 @@
 #include <arch/boot/memmap.h>
 
-uint8_t e820counter = 0xff;
+uint8_t e820counter = 0xffU;
 e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
 
Index: kernel/arch/amd64/src/cpu/cpu.c
===================================================================
--- kernel/arch/amd64/src/cpu/cpu.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/cpu/cpu.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,12 +47,11 @@
  * Contains only non-MP-Specification specific SMP code.
  */
-#define AMD_CPUID_EBX  0x68747541
-#define AMD_CPUID_ECX  0x444d4163
-#define AMD_CPUID_EDX  0x69746e65
+#define AMD_CPUID_EBX  UINT32_C(0x68747541)
+#define AMD_CPUID_ECX  UINT32_C(0x444d4163)
+#define AMD_CPUID_EDX  UINT32_C(0x69746e65)
 
-#define INTEL_CPUID_EBX  0x756e6547
-#define INTEL_CPUID_ECX  0x6c65746e
-#define INTEL_CPUID_EDX  0x49656e69
-
+#define INTEL_CPUID_EBX  UINT32_C(0x756e6547)
+#define INTEL_CPUID_ECX  UINT32_C(0x6c65746e)
+#define INTEL_CPUID_EDX  UINT32_C(0x49656e69)
 
 enum vendor {
Index: kernel/arch/amd64/src/debugger.c
===================================================================
--- kernel/arch/amd64/src/debugger.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/debugger.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -125,6 +125,6 @@
 	
 	/* Disable breakpoint in DR7 */
-	unative_t dr7 = read_dr7();
-	dr7 &= ~(0x2 << (curidx * 2));
+	sysarg_t dr7 = read_dr7();
+	dr7 &= ~(0x02U << (curidx * 2));
 	
 	/* Setup DR register */
@@ -147,24 +147,24 @@
 		
 		/* Set type to requested breakpoint & length*/
-		dr7 &= ~(0x3 << (16 + 4 * curidx));
-		dr7 &= ~(0x3 << (18 + 4 * curidx));
+		dr7 &= ~(0x03U << (16 + 4 * curidx));
+		dr7 &= ~(0x03U << (18 + 4 * curidx));
 		
 		if (!(flags & BKPOINT_INSTR)) {
 #ifdef __32_BITS__
-			dr7 |= ((unative_t) 0x3) << (18 + 4 * curidx);
+			dr7 |= ((sysarg_t) 0x03U) << (18 + 4 * curidx);
 #endif
 			
 #ifdef __64_BITS__
-			dr7 |= ((unative_t) 0x2) << (18 + 4 * curidx);
+			dr7 |= ((sysarg_t) 0x02U) << (18 + 4 * curidx);
 #endif
 			
 			if ((flags & BKPOINT_WRITE))
-				dr7 |= ((unative_t) 0x1) << (16 + 4 * curidx);
+				dr7 |= ((sysarg_t) 0x01U) << (16 + 4 * curidx);
 			else if ((flags & BKPOINT_READ_WRITE))
-				dr7 |= ((unative_t) 0x3) << (16 + 4 * curidx);
+				dr7 |= ((sysarg_t) 0x03U) << (16 + 4 * curidx);
 		}
 		
 		/* Enable global breakpoint */
-		dr7 |= 0x2 << (curidx * 2);
+		dr7 |= 0x02U << (curidx * 2);
 		
 		write_dr7(dr7);
@@ -227,17 +227,17 @@
 	if (!(breakpoints[slot].flags & BKPOINT_INSTR)) {
 		if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) {
-			if (*((unative_t *) breakpoints[slot].address) != 0)
+			if (*((sysarg_t *) breakpoints[slot].address) != 0)
 				return;
 			
-			printf("*** Found ZERO on address %" PRIp " (slot %d) ***\n",
-			    breakpoints[slot].address, slot);
+			printf("*** Found ZERO on address %p (slot %d) ***\n",
+			    (void *) breakpoints[slot].address, slot);
 		} else {
-			printf("Data watchpoint - new data: %" PRIp "\n",
-			    *((unative_t *) breakpoints[slot].address));
-		}
-	}
-	
-	printf("Reached breakpoint %d:%" PRIp " (%s)\n", slot, getip(istate),
-	    symtab_fmt_name_lookup(getip(istate)));
+			printf("Data watchpoint - new data: %#" PRIxn "\n",
+			    *((sysarg_t *) breakpoints[slot].address));
+		}
+	}
+	
+	printf("Reached breakpoint %d:%p (%s)\n", slot,
+	    (void *) getip(istate), symtab_fmt_name_lookup(getip(istate)));
 	
 #ifdef CONFIG_KCONSOLE
@@ -260,5 +260,5 @@
 	}
 	
-	cur->address = NULL;
+	cur->address = (uintptr_t) NULL;
 	
 	setup_dr(slot);
@@ -279,5 +279,5 @@
 #endif
 	
-	unative_t dr6 = read_dr6();
+	sysarg_t dr6 = read_dr6();
 	
 	unsigned int i;
@@ -313,5 +313,5 @@
 	unsigned int i;
 	for (i = 0; i < BKPOINTS_MAX; i++)
-		breakpoints[i].address = NULL;
+		breakpoints[i].address = (uintptr_t) NULL;
 	
 #ifdef CONFIG_KCONSOLE
@@ -363,12 +363,12 @@
 			
 #ifdef __32_BITS__
-			printf("%-4u %7" PRIs " %p %s\n", i,
-			    breakpoints[i].counter, breakpoints[i].address,
+			printf("%-4u %7zu %p %s\n", i,
+			    breakpoints[i].counter, (void *) breakpoints[i].address,
 			    symbol);
 #endif
 			
 #ifdef __64_BITS__
-			printf("%-4u %7" PRIs " %p %s\n", i,
-			    breakpoints[i].counter, breakpoints[i].address,
+			printf("%-4u %7zu %p %s\n", i,
+			    breakpoints[i].counter, (void *) breakpoints[i].address,
 			    symbol);
 #endif
@@ -384,5 +384,5 @@
 int cmd_del_breakpoint(cmd_arg_t *argv)
 {
-	unative_t bpno = argv->intval;
+	sysarg_t bpno = argv->intval;
 	if (bpno > BKPOINTS_MAX) {
 		printf("Invalid breakpoint number.\n");
@@ -405,7 +405,8 @@
 		flags = BKPOINT_WRITE;
 	
-	printf("Adding breakpoint on address: %p\n", argv->intval);
-	
-	int id = breakpoint_add((void *)argv->intval, flags, -1);
+	printf("Adding breakpoint on address: %p\n",
+	    (void *) argv->intval);
+	
+	int id = breakpoint_add((void *) argv->intval, flags, -1);
 	if (id < 0)
 		printf("Add breakpoint failed.\n");
Index: kernel/arch/amd64/src/interrupt.c
===================================================================
--- kernel/arch/amd64/src/interrupt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/interrupt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,18 +65,28 @@
 void istate_decode(istate_t *istate)
 {
-	printf("cs =%p\trip=%p\trfl=%p\terr=%p\n",
-	    istate->cs, istate->rip, istate->rflags, istate->error_word);
-
+	printf("cs =%#0" PRIx64 "\trip=%p\t"
+	    "rfl=%#0" PRIx64 "\terr=%#0" PRIx64 "\n",
+	    istate->cs, (void *) istate->rip,
+	    istate->rflags, istate->error_word);
+	
 	if (istate_from_uspace(istate))
-		printf("ss =%p\n", istate->ss);
-	
-	printf("rax=%p\trbx=%p\trcx=%p\trdx=%p\n",
+		printf("ss =%#0" PRIx64 "\n", istate->ss);
+	
+	printf("rax=%#0" PRIx64 "\trbx=%#0" PRIx64 "\t"
+	    "rcx=%#0" PRIx64 "\trdx=%#0" PRIx64 "\n",
 	    istate->rax, istate->rbx, istate->rcx, istate->rdx);
+	
 	printf("rsi=%p\trdi=%p\trbp=%p\trsp=%p\n",
-	    istate->rsi, istate->rdi, istate->rbp,
-	    istate_from_uspace(istate) ? istate->rsp : (uintptr_t)&istate->rsp);
-	printf("r8 =%p\tr9 =%p\tr10=%p\tr11=%p\n",
+	    (void *) istate->rsi, (void *) istate->rdi,
+	    (void *) istate->rbp,
+	    istate_from_uspace(istate) ? ((void *) istate->rsp) :
+	    &istate->rsp);
+	
+	printf("r8 =%#0" PRIx64 "\tr9 =%#0" PRIx64 "\t"
+	    "r10=%#0" PRIx64 "\tr11=%#0" PRIx64 "\n",
 	    istate->r8, istate->r9, istate->r10, istate->r11);
-	printf("r12=%p\tr13=%p\tr14=%p\tr15=%p\n",
+	
+	printf("r12=%#0" PRIx64 "\tr13=%#0" PRIx64 "\t"
+	    "r14=%#0" PRIx64 "\tr15=%#0" PRIx64 "\n",
 	    istate->r12, istate->r13, istate->r14, istate->r15);
 }
Index: kernel/arch/amd64/src/mm/page.c
===================================================================
--- kernel/arch/amd64/src/mm/page.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/mm/page.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -89,5 +89,5 @@
 	
 	if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
-		fault_if_from_uspace(istate, "Page fault: %#x.", page);
+		fault_if_from_uspace(istate, "Page fault: %p.", (void *) page);
 		panic_memtrap(istate, access, page, NULL);
 	}
@@ -97,6 +97,6 @@
 {
 	if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
-		panic("Unable to map physical memory %p (%" PRIs " bytes).", physaddr,
-		    size);
+		panic("Unable to map physical memory %p (%zu bytes).",
+		    (void *) physaddr, size);
 	
 	uintptr_t virtaddr = PA2KA(last_frame);
Index: kernel/arch/amd64/src/pm.c
===================================================================
--- kernel/arch/amd64/src/pm.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/amd64/src/pm.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -28,5 +28,5 @@
  */
 
-/** @addtogroup amd64	
+/** @addtogroup amd64
  * @{
  */
@@ -52,57 +52,57 @@
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 	/* KTEXT descriptor */
-	{ .limit_0_15  = 0xffff, 
-	  .base_0_15   = 0, 
-	  .base_16_23  = 0, 
-	  .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 
-	  .limit_16_19 = 0xf, 
-	  .available   = 0, 
-	  .longmode    = 1, 
+	{ .limit_0_15  = 0xffffU,
+	  .base_0_15   = 0,
+	  .base_16_23  = 0,
+	  .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE,
+	  .limit_16_19 = 0x0fU,
+	  .available   = 0,
+	  .longmode    = 1,
 	  .special     = 0,
-	  .granularity = 1, 
+	  .granularity = 1,
 	  .base_24_31  = 0 },
 	/* KDATA descriptor */
-	{ .limit_0_15  = 0xffff, 
-	  .base_0_15   = 0, 
-	  .base_16_23  = 0, 
-	  .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL, 
-	  .limit_16_19 = 0xf, 
-	  .available   = 0, 
-	  .longmode    = 0, 
-	  .special     = 0, 
-	  .granularity = 1, 
+	{ .limit_0_15  = 0xffffU,
+	  .base_0_15   = 0,
+	  .base_16_23  = 0,
+	  .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL,
+	  .limit_16_19 = 0x0fU,
+	  .available   = 0,
+	  .longmode    = 0,
+	  .special     = 0,
+	  .granularity = 1,
 	  .base_24_31  = 0 },
 	/* UDATA descriptor */
-	{ .limit_0_15  = 0xffff, 
-	  .base_0_15   = 0, 
-	  .base_16_23  = 0, 
-	  .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 
-	  .limit_16_19 = 0xf, 
-	  .available   = 0, 
-	  .longmode    = 0, 
-	  .special     = 1, 
-	  .granularity = 1, 
+	{ .limit_0_15  = 0xffffU,
+	  .base_0_15   = 0,
+	  .base_16_23  = 0,
+	  .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER,
+	  .limit_16_19 = 0x0fU,
+	  .available   = 0,
+	  .longmode    = 0,
+	  .special     = 1,
+	  .granularity = 1,
 	  .base_24_31  = 0 },
 	/* UTEXT descriptor */
-	{ .limit_0_15  = 0xffff, 
-	  .base_0_15   = 0, 
-	  .base_16_23  = 0, 
-	  .access      = AR_PRESENT | AR_CODE | DPL_USER, 
-	  .limit_16_19 = 0xf, 
-	  .available   = 0, 
-	  .longmode    = 1, 
-	  .special     = 0, 
-	  .granularity = 1, 
+	{ .limit_0_15  = 0xffffU,
+	  .base_0_15   = 0,
+	  .base_16_23  = 0,
+	  .access      = AR_PRESENT | AR_CODE | DPL_USER,
+	  .limit_16_19 = 0x0fU,
+	  .available   = 0,
+	  .longmode    = 1,
+	  .special     = 0,
+	  .granularity = 1,
 	  .base_24_31  = 0 },
 	/* KTEXT 32-bit protected, for protected mode before long mode */
-	{ .limit_0_15  = 0xffff, 
-	  .base_0_15   = 0, 
-	  .base_16_23  = 0, 
-	  .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 
-	  .limit_16_19 = 0xf, 
-	  .available   = 0, 
-	  .longmode    = 0, 
+	{ .limit_0_15  = 0xffffU,
+	  .base_0_15   = 0,
+	  .base_16_23  = 0,
+	  .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE,
+	  .limit_16_19 = 0x0fU,
+	  .available   = 0,
+	  .longmode    = 0,
 	  .special     = 1,
-	  .granularity = 1, 
+	  .granularity = 1,
 	  .base_24_31  = 0 },
 	/* TSS descriptor - set up will be completed later,
@@ -111,7 +111,8 @@
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 	/* VESA Init descriptor */
-#ifdef CONFIG_FB	
-	{ 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL,
-	  0xf, 0, 0, 0, 0, 0
+#ifdef CONFIG_FB
+	{
+		0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL,
+		    0xf, 0, 0, 0, 0, 0
 	}
 #endif
@@ -129,8 +130,8 @@
 {
 	tss_descriptor_t *td = (tss_descriptor_t *) d;
-
-	td->base_0_15 = base & 0xffff;
-	td->base_16_23 = ((base) >> 16) & 0xff;
-	td->base_24_31 = ((base) >> 24) & 0xff;
+	
+	td->base_0_15 = base & 0xffffU;
+	td->base_16_23 = ((base) >> 16) & 0xffU;
+	td->base_24_31 = ((base) >> 24) & 0xffU;
 	td->base_32_63 = ((base) >> 32);
 }
@@ -140,6 +141,6 @@
 	tss_descriptor_t *td = (tss_descriptor_t *) d;
 	
-	td->limit_0_15 = limit & 0xffff;
-	td->limit_16_19 = (limit >> 16) & 0xf;
+	td->limit_0_15 = limit & 0xffffU;
+	td->limit_16_19 = (limit >> 16) & 0x0fU;
 }
 
@@ -149,6 +150,6 @@
 	 * Offset is a linear address.
 	 */
-	d->offset_0_15 = offset & 0xffff;
-	d->offset_16_31 = offset >> 16 & 0xffff;
+	d->offset_0_15 = offset & 0xffffU;
+	d->offset_16_31 = (offset >> 16) & 0xffffU;
 	d->offset_32_63 = offset >> 32;
 }
@@ -165,16 +166,16 @@
 {
 	idescriptor_t *d;
-	int i;
-
+	unsigned int i;
+	
 	for (i = 0; i < IDT_ITEMS; i++) {
 		d = &idt[i];
-
+		
 		d->unused = 0;
 		d->selector = GDT_SELECTOR(KTEXT_DES);
-
+		
 		d->present = 1;
-		d->type = AR_INTERRUPT;	/* masking interrupt */
+		d->type = AR_INTERRUPT;  /* masking interrupt */
 	}
-
+	
 	d = &idt[0];
 	idt_setoffset(d++, (uintptr_t) &int_0);
Index: kernel/arch/arm32/include/mach/integratorcp/integratorcp.h
===================================================================
--- kernel/arch/arm32/include/mach/integratorcp/integratorcp.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/include/mach/integratorcp/integratorcp.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -106,4 +106,5 @@
 extern void icp_frame_init(void);
 extern size_t icp_get_irq_count(void);
+extern const char *icp_get_platform_name(void);
 
 extern struct arm_machine_ops icp_machine_ops;
Index: kernel/arch/arm32/include/mach/testarm/testarm.h
===================================================================
--- kernel/arch/arm32/include/mach/testarm/testarm.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/include/mach/testarm/testarm.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -74,4 +74,5 @@
 extern void gxemul_frame_init(void);
 extern size_t gxemul_get_irq_count(void);
+extern const char *gxemul_get_platform_name(void);
 
 extern struct arm_machine_ops gxemul_machine_ops;
Index: kernel/arch/arm32/include/machine_func.h
===================================================================
--- kernel/arch/arm32/include/machine_func.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/include/machine_func.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -56,4 +56,5 @@
 	void (*machine_input_init)(void);
 	size_t (*machine_get_irq_count)(void);
+	const char *(*machine_get_platform_name)(void);
 };
 
Index: kernel/arch/arm32/include/types.h
===================================================================
--- kernel/arch/arm32/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -50,5 +50,5 @@
 typedef uint32_t ipl_t;
 
-typedef uint32_t unative_t;
+typedef uint32_t sysarg_t;
 typedef int32_t native_t;
 typedef uint32_t atomic_count_t;
@@ -57,24 +57,11 @@
 } fncptr_t;
 
-#define PRIp "x"  /**< Format for uintptr_t. */
-#define PRIs "u"  /**< Format for size_t. */
+#define INTN_C(c)   INT32_C(c)
+#define UINTN_C(c)  UINT32_C(c)
 
-#define PRId8 "d"     /**< Format for int8_t. */
-#define PRId16 "d"    /**< Format for int16_t. */
-#define PRId32 "d"    /**< Format for int32_t. */
-#define PRId64 "lld"  /**< Format for int64_t. */
-#define PRIdn "d"     /**< Format for native_t. */
-
-#define PRIu8 "u"     /**< Format for uint8_t. */
-#define PRIu16 "u"    /**< Format for uint16_t. */
-#define PRIu32 "u"    /**< Format for uint32_t. */
-#define PRIu64 "llu"  /**< Format for uint64_t. */
-#define PRIun "u"     /**< Format for unative_t. */
-
-#define PRIx8 "x"     /**< Format for hexadecimal (u)int8_t. */
-#define PRIx16 "x"    /**< Format for hexadecimal (u)int16_t. */
-#define PRIx32 "x"    /**< Format for hexadecimal (u)uint32_t. */
-#define PRIx64 "llx"  /**< Format for hexadecimal (u)int64_t. */
-#define PRIxn "x"     /**< Format for hexadecimal (u)native_t. */
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/arm32/src/exception.c
===================================================================
--- kernel/arch/arm32/src/exception.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/src/exception.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -175,12 +175,17 @@
 void istate_decode(istate_t *istate)
 {
-	printf("r0 =%#0.8lx\tr1 =%#0.8lx\tr2 =%#0.8lx\tr3 =%#0.8lx\n",
+	printf("r0 =%#0" PRIx32 "\tr1 =%#0" PRIx32 "\t"
+	    "r2 =%#0" PRIx32 "\tr3 =%#0" PRIx32 "\n",
 	    istate->r0, istate->r1, istate->r2, istate->r3);
-	printf("r4 =%#0.8lx\tr5 =%#0.8lx\tr6 =%#0.8lx\tr7 =%#0.8lx\n",
+	printf("r4 =%#" PRIx32 "\tr5 =%#0" PRIx32 "\t"
+	    "r6 =%#0" PRIx32 "\tr7 =%#0" PRIx32 "\n",
 	    istate->r4, istate->r5, istate->r6, istate->r7);
-	printf("r8 =%#0.8lx\tr9 =%#0.8lx\tr10=%#0.8lx\tfp =%#0.8lx\n",
-	    istate->r8, istate->r9, istate->r10, istate->fp);
-	printf("r12=%#0.8lx\tsp =%#0.8lx\tlr =%#0.8lx\tspsr=%#0.8lx\n",
-	    istate->r12, istate->sp, istate->lr, istate->spsr);
+	printf("r8 =%#0" PRIx32 "\tr9 =%#0" PRIx32 "\t"
+	    "r10=%#0" PRIx32 "\tfp =%p\n",
+	    istate->r8, istate->r9, istate->r10,
+	    (void *) istate->fp);
+	printf("r12=%#0" PRIx32 "\tsp =%p\tlr =%p\tspsr=%p\n",
+	    istate->r12, (void *) istate->sp,
+	    (void *) istate->lr, (void *) istate->spsr);
 }
 
Index: kernel/arch/arm32/src/mach/gta02/gta02.c
===================================================================
--- kernel/arch/arm32/src/mach/gta02/gta02.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/src/mach/gta02/gta02.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -71,4 +71,5 @@
 static void gta02_input_init(void);
 static size_t gta02_get_irq_count(void);
+static const char *gta02_get_platform_name(void);
 
 static void gta02_timer_irq_init(void);
@@ -92,5 +93,6 @@
 	gta02_output_init,
 	gta02_input_init,
-	gta02_get_irq_count
+	gta02_get_irq_count,
+	gta02_get_platform_name
 };
 
@@ -235,4 +237,9 @@
 }
 
+const char *gta02_get_platform_name(void)
+{
+	return "gta02";
+}
+
 static void gta02_timer_irq_init(void)
 {
Index: kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
===================================================================
--- kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,5 +65,6 @@
 	icp_output_init,
 	icp_input_init,
-	icp_get_irq_count
+	icp_get_irq_count,
+	icp_get_platform_name
 };
 
@@ -342,4 +343,9 @@
 }
 
+const char *icp_get_platform_name(void)
+{
+	return "integratorcp";
+}
+
 /** @}
  */
Index: kernel/arch/arm32/src/mach/testarm/testarm.c
===================================================================
--- kernel/arch/arm32/src/mach/testarm/testarm.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/src/mach/testarm/testarm.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,5 +65,6 @@
 	gxemul_output_init,
 	gxemul_input_init,
-	gxemul_get_irq_count
+	gxemul_get_irq_count,
+	gxemul_get_platform_name
 };
 
@@ -123,5 +124,5 @@
 	sysinfo_set_item_val("kbd", NULL, true);
 	sysinfo_set_item_val("kbd.inr", NULL, GXEMUL_KBD_IRQ);
-	sysinfo_set_item_val("kbd.address.virtual", NULL, (unative_t) gxemul_kbd);
+	sysinfo_set_item_val("kbd.address.virtual", NULL, (sysarg_t) gxemul_kbd);
 #endif
 }
@@ -130,4 +131,9 @@
 {
 	return GXEMUL_IRQ_COUNT;
+}
+
+const char *gxemul_get_platform_name(void)
+{
+	return "gxemul";
 }
 
Index: kernel/arch/arm32/src/mm/page.c
===================================================================
--- kernel/arch/arm32/src/mm/page.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/src/mm/page.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -93,5 +93,5 @@
 	    KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) {
 		panic("Unable to map physical memory %p (%d bytes).",
-		    physaddr, size);
+		    (void *) physaddr, size);
 	}
 	
Index: kernel/arch/arm32/src/mm/page_fault.c
===================================================================
--- kernel/arch/arm32/src/mm/page_fault.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/arm32/src/mm/page_fault.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -141,5 +141,6 @@
 	if (instr.condition == 0xf) {
 		panic("page_fault - instruction does not access memory "
-		    "(instr_code: %x, badvaddr:%x).", instr, badvaddr);
+		    "(instr_code: %#0" PRIx32 ", badvaddr:%p).",
+		    instr_union.pc, (void *) badvaddr);
 		return PF_ACCESS_EXEC;
 	}
@@ -160,5 +161,6 @@
 
 	panic("page_fault - instruction doesn't access memory "
-	    "(instr_code: %x, badvaddr:%x).", instr, badvaddr);
+	    "(instr_code: %#0" PRIx32 ", badvaddr:%p).",
+	    instr_union.pc, (void *) badvaddr);
 
 	return PF_ACCESS_EXEC;
Index: kernel/arch/ia32/include/asm.h
===================================================================
--- kernel/arch/ia32/include/asm.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/asm.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -64,7 +64,7 @@
 }
 
-#define GEN_READ_REG(reg) NO_TRACE static inline unative_t read_ ##reg (void) \
+#define GEN_READ_REG(reg) NO_TRACE static inline sysarg_t read_ ##reg (void) \
 	{ \
-		unative_t res; \
+		sysarg_t res; \
 		asm volatile ( \
 			"movl %%" #reg ", %[res]" \
@@ -74,5 +74,5 @@
 	}
 
-#define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (unative_t regn) \
+#define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (sysarg_t regn) \
 	{ \
 		asm volatile ( \
@@ -366,5 +366,5 @@
 	asm volatile (
 		"invlpg %[addr]\n"
-		:: [addr] "m" (*(unative_t *) addr)
+		:: [addr] "m" (*(sysarg_t *) addr)
 	);
 }
Index: kernel/arch/ia32/include/boot/boot.h
===================================================================
--- kernel/arch/ia32/include/boot/boot.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/boot/boot.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,5 +38,5 @@
 #define BOOT_OFFSET      0x108000
 #define AP_BOOT_OFFSET   0x8000
-#define BOOT_STACK_SIZE  0x400
+#define BOOT_STACK_SIZE  0x0400
 
 #define MULTIBOOT_HEADER_MAGIC  0x1BADB002
Index: kernel/arch/ia32/include/boot/memmap.h
===================================================================
--- kernel/arch/ia32/include/boot/memmap.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/boot/memmap.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -70,5 +70,5 @@
 
 extern e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
-extern uint8_t e820counter; 
+extern uint8_t e820counter;
 
 #endif
Index: kernel/arch/ia32/include/context.h
===================================================================
--- kernel/arch/ia32/include/context.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/context.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup ia32	
+/** @addtogroup ia32
  * @{
  */
@@ -40,5 +40,5 @@
 #include <typedefs.h>
 
-#define STACK_ITEM_SIZE	4
+#define STACK_ITEM_SIZE  4
 
 /*
@@ -48,5 +48,5 @@
  * One item is put onto stack to support get_stack_base().
  */
-#define SP_DELTA	(8 + STACK_ITEM_SIZE)
+#define SP_DELTA  (8 + STACK_ITEM_SIZE)
 
 #define context_set(c, _pc, stack, size) \
Index: kernel/arch/ia32/include/context_offset.h
===================================================================
--- kernel/arch/ia32/include/context_offset.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/context_offset.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup ia32	
+/** @addtogroup ia32
  * @{
  */
@@ -36,33 +36,32 @@
 #define KERN_ia32_CONTEXT_OFFSET_H_
 
-#define OFFSET_SP  0x0
-#define OFFSET_PC  0x4
-#define OFFSET_EBX 0x8
-#define OFFSET_ESI 0xC
-#define OFFSET_EDI 0x10
-#define OFFSET_EBP 0x14
+#define OFFSET_SP   0x00
+#define OFFSET_PC   0x04
+#define OFFSET_EBX  0x08
+#define OFFSET_ESI  0x0C
+#define OFFSET_EDI  0x10
+#define OFFSET_EBP  0x14
 
-#ifdef KERNEL 
-# define OFFSET_IPL 0x18
+#ifdef KERNEL
+	#define OFFSET_IPL  0x18
 #else
-# define OFFSET_TLS 0x18
+	#define OFFSET_TLS  0x18
 #endif
 
+#ifdef __ASM__
 
-#ifdef __ASM__ 
-
-# ctx: address of the structure with saved context 
+# ctx: address of the structure with saved context
 # pc: return address
 
 .macro CONTEXT_SAVE_ARCH_CORE ctx:req pc:req
-	movl %esp,OFFSET_SP(\ctx)	# %esp -> ctx->sp	
+	movl %esp,OFFSET_SP(\ctx)	# %esp -> ctx->sp
 	movl \pc,OFFSET_PC(\ctx)	# %eip -> ctx->pc
-	movl %ebx,OFFSET_EBX(\ctx)	# %ebx -> ctx->ebx	
-	movl %esi,OFFSET_ESI(\ctx)	# %esi -> ctx->esi	
-	movl %edi,OFFSET_EDI(\ctx)	# %edi -> ctx->edi	
-	movl %ebp,OFFSET_EBP(\ctx)	# %ebp -> ctx->ebp	
+	movl %ebx,OFFSET_EBX(\ctx)	# %ebx -> ctx->ebx
+	movl %esi,OFFSET_ESI(\ctx)	# %esi -> ctx->esi
+	movl %edi,OFFSET_EDI(\ctx)	# %edi -> ctx->edi
+	movl %ebp,OFFSET_EBP(\ctx)	# %ebp -> ctx->ebp
 .endm
 
-# ctx: address of the structure with saved context 
+# ctx: address of the structure with saved context
 
 .macro CONTEXT_RESTORE_ARCH_CORE ctx:req pc:req
@@ -75,5 +74,5 @@
 .endm
 
-#endif /* __ASM__ */ 
+#endif /* __ASM__ */
 
 #endif
@@ -81,3 +80,2 @@
 /** @}
  */
-
Index: kernel/arch/ia32/include/cpu.h
===================================================================
--- kernel/arch/ia32/include/cpu.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/cpu.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,7 +44,7 @@
 
 /* Support for SYSENTER and SYSEXIT */
-#define IA32_MSR_SYSENTER_CS	0x174
-#define IA32_MSR_SYSENTER_ESP	0x175
-#define IA32_MSR_SYSENTER_EIP	0x176
+#define IA32_MSR_SYSENTER_CS   0x174U
+#define IA32_MSR_SYSENTER_ESP  0x175U
+#define IA32_MSR_SYSENTER_EIP  0x176U
 
 #ifndef __ASM__
Index: kernel/arch/ia32/include/drivers/i8259.h
===================================================================
--- kernel/arch/ia32/include/drivers/i8259.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/drivers/i8259.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,8 +39,8 @@
 #include <arch/interrupt.h>
 
-#define PIC_PIC0PORT1  ((ioport8_t *) 0x20)
-#define PIC_PIC0PORT2  ((ioport8_t *) 0x21)
-#define PIC_PIC1PORT1  ((ioport8_t *) 0xa0)
-#define PIC_PIC1PORT2  ((ioport8_t *) 0xa1)
+#define PIC_PIC0PORT1  ((ioport8_t *) 0x20U)
+#define PIC_PIC0PORT2  ((ioport8_t *) 0x21U)
+#define PIC_PIC1PORT1  ((ioport8_t *) 0xa0U)
+#define PIC_PIC1PORT2  ((ioport8_t *) 0xa1U)
 
 #define PIC_NEEDICW4  (1 << 0)
Index: kernel/arch/ia32/include/istate.h
===================================================================
--- kernel/arch/ia32/include/istate.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/istate.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,10 +37,15 @@
 
 #ifdef KERNEL
+
 #include <typedefs.h>
 #include <trace.h>
-#else
+
+#else /* KERNEL */
+
 #include <sys/types.h>
+
 #define NO_TRACE
-#endif
+
+#endif /* KERNEL */
 
 typedef struct istate {
@@ -77,5 +82,5 @@
 NO_TRACE static inline int istate_from_uspace(istate_t *istate)
 {
-	return !(istate->eip & 0x80000000);
+	return !(istate->eip & UINT32_C(0x80000000));
 }
 
Index: kernel/arch/ia32/include/mm/as.h
===================================================================
--- kernel/arch/ia32/include/mm/as.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/mm/as.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,12 +36,12 @@
 #define KERN_ia32_AS_H_
 
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH	0
+#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
 
-#define KERNEL_ADDRESS_SPACE_START_ARCH		((unsigned long) 0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH		((unsigned long) 0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH		((unsigned long) 0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH		((unsigned long) 0x7fffffff)
+#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
+#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
+#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
+#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
 
-#define USTACK_ADDRESS_ARCH	(USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
+#define USTACK_ADDRESS_ARCH  (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
 
 typedef struct {
@@ -50,7 +50,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)		(as != as)
-#define as_destructor_arch(as)			(as != as)
-#define as_create_arch(as, flags)		(as != as)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 #define as_install_arch(as)
 #define as_deinstall_arch(as)
Index: kernel/arch/ia32/include/mm/page.h
===================================================================
--- kernel/arch/ia32/include/mm/page.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/mm/page.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,16 +39,20 @@
 #include <trace.h>
 
-#define PAGE_WIDTH	FRAME_WIDTH
-#define PAGE_SIZE	FRAME_SIZE
+#define PAGE_WIDTH  FRAME_WIDTH
+#define PAGE_SIZE   FRAME_SIZE
 
 #ifdef KERNEL
 
 #ifndef __ASM__
-#	define KA2PA(x)	(((uintptr_t) (x)) - 0x80000000)
-#	define PA2KA(x)	(((uintptr_t) (x)) + 0x80000000)
-#else
-#	define KA2PA(x)	((x) - 0x80000000)
-#	define PA2KA(x)	((x) + 0x80000000)
-#endif
+
+#define KA2PA(x)  (((uintptr_t) (x)) - UINT32_C(0x80000000))
+#define PA2KA(x)  (((uintptr_t) (x)) + UINT32_C(0x80000000))
+
+#else /* __ASM__ */
+
+#define KA2PA(x)  ((x) - 0x80000000)
+#define PA2KA(x)  ((x) + 0x80000000)
+
+#endif /* __ASM__ */
 
 /*
@@ -58,20 +62,20 @@
 
 /* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH	1024
-#define PTL1_ENTRIES_ARCH	0
-#define PTL2_ENTRIES_ARCH	0
-#define PTL3_ENTRIES_ARCH	1024
+#define PTL0_ENTRIES_ARCH  1024
+#define PTL1_ENTRIES_ARCH  0
+#define PTL2_ENTRIES_ARCH  0
+#define PTL3_ENTRIES_ARCH  1024
 
 /* Page table sizes for each level. */
-#define PTL0_SIZE_ARCH		ONE_FRAME
-#define PTL1_SIZE_ARCH		0
-#define PTL2_SIZE_ARCH		0
-#define PTL3_SIZE_ARCH		ONE_FRAME
+#define PTL0_SIZE_ARCH  ONE_FRAME
+#define PTL1_SIZE_ARCH  0
+#define PTL2_SIZE_ARCH  0
+#define PTL3_SIZE_ARCH  ONE_FRAME
 
 /* Macros calculating indices for each level. */
-#define PTL0_INDEX_ARCH(vaddr)	(((vaddr) >> 22) & 0x3ff)
-#define PTL1_INDEX_ARCH(vaddr)	0
-#define PTL2_INDEX_ARCH(vaddr)	0
-#define PTL3_INDEX_ARCH(vaddr)	(((vaddr) >> 12) & 0x3ff)
+#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ffU)
+#define PTL1_INDEX_ARCH(vaddr)  0
+#define PTL2_INDEX_ARCH(vaddr)  0
+#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ffU)
 
 /* Get PTE address accessors for each level. */
@@ -122,5 +126,5 @@
 #define PTE_WRITABLE_ARCH(p) \
 	((p)->writeable != 0)
-#define PTE_EXECUTABLE_ARCH(p)			1
+#define PTE_EXECUTABLE_ARCH(p)  1
 
 #ifndef __ASM__
@@ -144,5 +148,5 @@
 
 /** When bit on this position is 1, a reserved bit was set in page directory. */ 
-#define PFERR_CODE_RSVD		(1 << 3)	
+#define PFERR_CODE_RSVD		(1 << 3)
 
 /** Page Table Entry. */
Index: kernel/arch/ia32/include/proc/thread.h
===================================================================
--- kernel/arch/ia32/include/proc/thread.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/proc/thread.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 
 typedef struct {
-	unative_t tls;
+	sysarg_t tls;
 } thread_arch_t;
 
Index: kernel/arch/ia32/include/smp/ap.h
===================================================================
--- kernel/arch/ia32/include/smp/ap.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/smp/ap.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup ia32	
+/** @addtogroup ia32
  * @{
  */
Index: kernel/arch/ia32/include/smp/apic.h
===================================================================
--- kernel/arch/ia32/include/smp/apic.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/smp/apic.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,63 +49,63 @@
 
 /** Delivery modes. */
-#define DELMOD_FIXED    0x0
-#define DELMOD_LOWPRI   0x1
-#define DELMOD_SMI      0x2
+#define DELMOD_FIXED    0x0U
+#define DELMOD_LOWPRI   0x1U
+#define DELMOD_SMI      0x2U
 /* 0x3 reserved */
-#define DELMOD_NMI      0x4
-#define DELMOD_INIT     0x5
-#define DELMOD_STARTUP  0x6
-#define DELMOD_EXTINT   0x7
+#define DELMOD_NMI      0x4U
+#define DELMOD_INIT     0x5U
+#define DELMOD_STARTUP  0x6U
+#define DELMOD_EXTINT   0x7U
 
 /** Destination modes. */
-#define DESTMOD_PHYS   0x0
-#define DESTMOD_LOGIC  0x1
+#define DESTMOD_PHYS   0x0U
+#define DESTMOD_LOGIC  0x1U
 
 /** Trigger Modes. */
-#define TRIGMOD_EDGE   0x0
-#define TRIGMOD_LEVEL  0x1
+#define TRIGMOD_EDGE   0x0U
+#define TRIGMOD_LEVEL  0x1U
 
 /** Levels. */
-#define LEVEL_DEASSERT  0x0
-#define LEVEL_ASSERT    0x1
+#define LEVEL_DEASSERT  0x0U
+#define LEVEL_ASSERT    0x1U
 
 /** Destination Shorthands. */
-#define SHORTHAND_NONE      0x0
-#define SHORTHAND_SELF      0x1
-#define SHORTHAND_ALL_INCL  0x2
-#define SHORTHAND_ALL_EXCL  0x3
+#define SHORTHAND_NONE      0x0U
+#define SHORTHAND_SELF      0x1U
+#define SHORTHAND_ALL_INCL  0x2U
+#define SHORTHAND_ALL_EXCL  0x3U
 
 /** Interrupt Input Pin Polarities. */
-#define POLARITY_HIGH  0x0
-#define POLARITY_LOW   0x1
+#define POLARITY_HIGH  0x0U
+#define POLARITY_LOW   0x1U
 
 /** Divide Values. (Bit 2 is always 0) */
-#define DIVIDE_2    0x0
-#define DIVIDE_4    0x1
-#define DIVIDE_8    0x2
-#define DIVIDE_16   0x3
-#define DIVIDE_32   0x8
-#define DIVIDE_64   0x9
-#define DIVIDE_128  0xa
-#define DIVIDE_1    0xb
+#define DIVIDE_2    0x0U
+#define DIVIDE_4    0x1U
+#define DIVIDE_8    0x2U
+#define DIVIDE_16   0x3U
+#define DIVIDE_32   0x8U
+#define DIVIDE_64   0x9U
+#define DIVIDE_128  0xaU
+#define DIVIDE_1    0xbU
 
 /** Timer Modes. */
-#define TIMER_ONESHOT   0x0
-#define TIMER_PERIODIC  0x1
+#define TIMER_ONESHOT   0x0U
+#define TIMER_PERIODIC  0x1U
 
 /** Delivery status. */
-#define DELIVS_IDLE     0x0
-#define DELIVS_PENDING  0x1
+#define DELIVS_IDLE     0x0U
+#define DELIVS_PENDING  0x1U
 
 /** Destination masks. */
-#define DEST_ALL  0xff
+#define DEST_ALL  0xffU
 
 /** Dest format models. */
-#define MODEL_FLAT     0xf
-#define MODEL_CLUSTER  0x0
+#define MODEL_FLAT     0xfU
+#define MODEL_CLUSTER  0x0U
 
 /** Interrupt Command Register. */
-#define ICRlo  (0x300 / sizeof(uint32_t))
-#define ICRhi  (0x310 / sizeof(uint32_t))
+#define ICRlo  (0x300U / sizeof(uint32_t))
+#define ICRhi  (0x310U / sizeof(uint32_t))
 
 typedef struct {
@@ -135,8 +135,8 @@
 
 /* End Of Interrupt. */
-#define EOI  (0x0b0 / sizeof(uint32_t))
+#define EOI  (0x0b0U / sizeof(uint32_t))
 
 /** Error Status Register. */
-#define ESR  (0x280 / sizeof(uint32_t))
+#define ESR  (0x280U / sizeof(uint32_t))
 
 typedef union {
@@ -157,5 +157,5 @@
 
 /* Task Priority Register */
-#define TPR  (0x080 / sizeof(uint32_t))
+#define TPR  (0x080U / sizeof(uint32_t))
 
 typedef union {
@@ -168,5 +168,5 @@
 
 /** Spurious-Interrupt Vector Register. */
-#define SVR  (0x0f0 / sizeof(uint32_t))
+#define SVR  (0x0f0U / sizeof(uint32_t))
 
 typedef union {
@@ -181,5 +181,5 @@
 
 /** Time Divide Configuration Register. */
-#define TDCR  (0x3e0 / sizeof(uint32_t))
+#define TDCR  (0x3e0U / sizeof(uint32_t))
 
 typedef union {
@@ -192,11 +192,11 @@
 
 /* Initial Count Register for Timer */
-#define ICRT  (0x380 / sizeof(uint32_t))
+#define ICRT  (0x380U / sizeof(uint32_t))
 
 /* Current Count Register for Timer */
-#define CCRT  (0x390 / sizeof(uint32_t))
+#define CCRT  (0x390U / sizeof(uint32_t))
 
 /** LVT Timer register. */
-#define LVT_Tm  (0x320 / sizeof(uint32_t))
+#define LVT_Tm  (0x320U / sizeof(uint32_t))
 
 typedef union {
@@ -214,6 +214,6 @@
 
 /** LVT LINT registers. */
-#define LVT_LINT0  (0x350 / sizeof(uint32_t))
-#define LVT_LINT1  (0x360 / sizeof(uint32_t))
+#define LVT_LINT0  (0x350U / sizeof(uint32_t))
+#define LVT_LINT1  (0x360U / sizeof(uint32_t))
 
 typedef union {
@@ -233,5 +233,5 @@
 
 /** LVT Error register. */
-#define LVT_Err  (0x370 / sizeof(uint32_t))
+#define LVT_Err  (0x370U / sizeof(uint32_t))
 
 typedef union {
@@ -248,5 +248,5 @@
 
 /** Local APIC ID Register. */
-#define L_APIC_ID  (0x020 / sizeof(uint32_t))
+#define L_APIC_ID  (0x020U / sizeof(uint32_t))
 
 typedef union {
@@ -259,13 +259,13 @@
 
 /** Local APIC Version Register */
-#define LAVR       (0x030 / sizeof(uint32_t))
-#define LAVR_Mask  0xff
-
-#define is_local_apic(x)    (((x) & LAVR_Mask & 0xf0) == 0x1)
-#define is_82489DX_apic(x)  ((((x) & LAVR_Mask & 0xf0) == 0x0))
-#define is_local_xapic(x)   (((x) & LAVR_Mask) == 0x14)
+#define LAVR       (0x030U / sizeof(uint32_t))
+#define LAVR_Mask  0xffU
+
+#define is_local_apic(x)    (((x) & LAVR_Mask & 0xf0U) == 0x1U)
+#define is_82489DX_apic(x)  ((((x) & LAVR_Mask & 0xf0U) == 0x0U))
+#define is_local_xapic(x)   (((x) & LAVR_Mask) == 0x14U)
 
 /** Logical Destination Register. */
-#define  LDR  (0x0d0 / sizeof(uint32_t))
+#define  LDR  (0x0d0U / sizeof(uint32_t))
 
 typedef union {
@@ -278,5 +278,5 @@
 
 /** Destination Format Register. */
-#define DFR  (0x0e0 / sizeof(uint32_t))
+#define DFR  (0x0e0U / sizeof(uint32_t))
 
 typedef union {
@@ -289,11 +289,11 @@
 
 /* IO APIC */
-#define IOREGSEL  (0x00 / sizeof(uint32_t))
-#define IOWIN     (0x10 / sizeof(uint32_t))
-
-#define IOAPICID   0x00
-#define IOAPICVER  0x01
-#define IOAPICARB  0x02
-#define IOREDTBL   0x10
+#define IOREGSEL  (0x00U / sizeof(uint32_t))
+#define IOWIN     (0x10U / sizeof(uint32_t))
+
+#define IOAPICID   0x00U
+#define IOAPICVER  0x01U
+#define IOAPICARB  0x02U
+#define IOREDTBL   0x10U
 
 /** I/O Register Select Register. */
Index: kernel/arch/ia32/include/types.h
===================================================================
--- kernel/arch/ia32/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,5 +43,5 @@
 typedef uint32_t ipl_t;
 
-typedef uint32_t unative_t;
+typedef uint32_t sysarg_t;
 typedef int32_t native_t;
 typedef uint32_t atomic_count_t;
@@ -50,24 +50,11 @@
 } fncptr_t;
 
-#define PRIp "x"  /**< Format for uintptr_t. */
-#define PRIs "u"  /**< Format for size_t. */
+#define INTN_C(c)   INT32_C(c)
+#define UINTN_C(c)  UINT32_C(c)
 
-#define PRId8 "d"     /**< Format for int8_t. */
-#define PRId16 "d"    /**< Format for int16_t. */
-#define PRId32 "d"    /**< Format for int32_t. */
-#define PRId64 "lld"  /**< Format for int64_t. */
-#define PRIdn "d"     /**< Format for native_t. */
-
-#define PRIu8 "u"     /**< Format for uint8_t. */
-#define PRIu16 "u"    /**< Format for uint16_t. */
-#define PRIu32 "u"    /**< Format for uint32_t. */
-#define PRIu64 "llu"  /**< Format for uint64_t. */
-#define PRIun "u"     /**< Format for unative_t. */
-
-#define PRIx8 "x"     /**< Format for hexadecimal (u)int8_t. */
-#define PRIx16 "x"    /**< Format for hexadecimal (u)int16_t. */
-#define PRIx32 "x"    /**< Format for hexadecimal (u)uint32_t. */
-#define PRIx64 "llx"  /**< Format for hexadecimal (u)int64_t. */
-#define PRIxn "x"     /**< Format for hexadecimal (u)native_t. */
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ia32/src/bios/bios.c
===================================================================
--- kernel/arch/ia32/src/bios/bios.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/bios/bios.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,5 +36,5 @@
 #include <typedefs.h>
 
-#define BIOS_EBDA_PTR  0x40e
+#define BIOS_EBDA_PTR  0x40eU
 
 uintptr_t ebda = 0;
@@ -43,5 +43,5 @@
 {
 	/* Copy the EBDA address out from BIOS Data Area */
-	ebda = *((uint16_t *) BIOS_EBDA_PTR) * 0x10;
+	ebda = *((uint16_t *) BIOS_EBDA_PTR) * 0x10U;
 }
 
Index: kernel/arch/ia32/src/boot/memmap.c
===================================================================
--- kernel/arch/ia32/src/boot/memmap.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/boot/memmap.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,5 +35,5 @@
 #include <arch/boot/memmap.h>
 
-uint8_t e820counter = 0xff;
+uint8_t e820counter = 0xffU;
 e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
 
Index: kernel/arch/ia32/src/cpu/cpu.c
===================================================================
--- kernel/arch/ia32/src/cpu/cpu.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/cpu/cpu.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,11 +49,11 @@
  * Contains only non-MP-Specification specific SMP code.
  */
-#define AMD_CPUID_EBX  0x68747541
-#define AMD_CPUID_ECX  0x444d4163
-#define AMD_CPUID_EDX  0x69746e65
+#define AMD_CPUID_EBX  UINT32_C(0x68747541)
+#define AMD_CPUID_ECX  UINT32_C(0x444d4163)
+#define AMD_CPUID_EDX  UINT32_C(0x69746e65)
 
-#define INTEL_CPUID_EBX  0x756e6547
-#define INTEL_CPUID_ECX  0x6c65746e
-#define INTEL_CPUID_EDX  0x49656e69
+#define INTEL_CPUID_EBX  UINT32_C(0x756e6547)
+#define INTEL_CPUID_ECX  UINT32_C(0x6c65746e)
+#define INTEL_CPUID_EDX  UINT32_C(0x49656e69)
 
 
@@ -140,19 +140,19 @@
 		if ((info.cpuid_ebx == AMD_CPUID_EBX)
 		    && (info.cpuid_ecx == AMD_CPUID_ECX)
-			&& (info.cpuid_edx == AMD_CPUID_EDX))
+		    && (info.cpuid_edx == AMD_CPUID_EDX))
 			CPU->arch.vendor = VendorAMD;
 		
 		/*
 		 * Check for Intel processor.
-		 */		
+		 */
 		if ((info.cpuid_ebx == INTEL_CPUID_EBX)
 		    && (info.cpuid_ecx == INTEL_CPUID_ECX)
-			&& (info.cpuid_edx == INTEL_CPUID_EDX))
+		    && (info.cpuid_edx == INTEL_CPUID_EDX))
 			CPU->arch.vendor = VendorIntel;
 		
 		cpuid(INTEL_CPUID_STANDARD, &info);
-		CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f;
-		CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f;
-		CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0f;						
+		CPU->arch.family = (info.cpuid_eax >> 8) & 0x0fU;
+		CPU->arch.model = (info.cpuid_eax >> 4) & 0x0fU;
+		CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0fU;
 	}
 }
Index: kernel/arch/ia32/src/debug/stacktrace.c
===================================================================
--- kernel/arch/ia32/src/debug/stacktrace.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/debug/stacktrace.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,6 +37,6 @@
 #include <typedefs.h>
 
-#define FRAME_OFFSET_FP_PREV	0
-#define FRAME_OFFSET_RA		1
+#define FRAME_OFFSET_FP_PREV  0
+#define FRAME_OFFSET_RA       1
 
 bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
Index: kernel/arch/ia32/src/drivers/i8254.c
===================================================================
--- kernel/arch/ia32/src/drivers/i8254.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/drivers/i8254.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -54,6 +54,6 @@
 #include <ddi/device.h>
 
-#define CLK_PORT1  ((ioport8_t *) 0x40)
-#define CLK_PORT4  ((ioport8_t *) 0x43)
+#define CLK_PORT1  ((ioport8_t *) 0x40U)
+#define CLK_PORT4  ((ioport8_t *) 0x43U)
 
 #define CLK_CONST     1193180
Index: kernel/arch/ia32/src/drivers/i8259.c
===================================================================
--- kernel/arch/ia32/src/drivers/i8259.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/drivers/i8259.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -121,6 +121,6 @@
 void pic_eoi(void)
 {
-	pio_write_8((ioport8_t *)0x20, 0x20);
-	pio_write_8((ioport8_t *)0xa0, 0x20);
+	pio_write_8((ioport8_t *) 0x20, 0x20);
+	pio_write_8((ioport8_t *) 0xa0, 0x20);
 }
 
Index: kernel/arch/ia32/src/drivers/vesa.c
===================================================================
--- kernel/arch/ia32/src/drivers/vesa.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/drivers/vesa.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -70,5 +70,5 @@
 bool vesa_init(void)
 {
-	if ((vesa_width == 0xffff) || (vesa_height == 0xffff))
+	if ((vesa_width == 0xffffU) || (vesa_height == 0xffffU))
 		return false;
 	
Index: kernel/arch/ia32/src/ia32.c
===================================================================
--- kernel/arch/ia32/src/ia32.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/ia32.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -157,4 +157,10 @@
 void arch_post_smp_init(void)
 {
+	/* Currently the only supported platform for ia32 is 'pc'. */
+	static const char *platform = "pc";
+
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 #ifdef CONFIG_PC_KBD
 	/*
@@ -211,5 +217,5 @@
  * selector, and the descriptor->base is the correct address.
  */
-unative_t sys_tls_set(unative_t addr)
+sysarg_t sys_tls_set(sysarg_t addr)
 {
 	THREAD->arch.tls = addr;
Index: kernel/arch/ia32/src/interrupt.c
===================================================================
--- kernel/arch/ia32/src/interrupt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/interrupt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,17 +65,25 @@
 void istate_decode(istate_t *istate)
 {
-	printf("cs =%p\teip=%p\tefl=%p\terr=%p\n",
-	    istate->cs, istate->eip, istate->eflags, istate->error_word);
-
-	printf("ds =%p\tes =%p\tfs =%p\tgs =%p\n",
+	printf("cs =%#0" PRIx32 "\teip=%p\t"
+	    "efl=%#0" PRIx32 "\terr=%#0" PRIx32 "\n",
+	    istate->cs, (void *) istate->eip,
+	    istate->eflags, istate->error_word);
+	
+	printf("ds =%#0" PRIx32 "\tes =%#0" PRIx32 "\t"
+	    "fs =%#0" PRIx32 "\tgs =%#0" PRIx32 "\n",
 	    istate->ds, istate->es, istate->fs, istate->gs);
+	
 	if (istate_from_uspace(istate))
-		printf("ss =%p\n", istate->ss);
-
-	printf("eax=%p\tebx=%p\tecx=%p\tedx=%p\n",
+		printf("ss =%#0" PRIx32 "\n", istate->ss);
+	
+	printf("eax=%#0" PRIx32 "\tebx=%#0" PRIx32 "\t"
+	    "ecx=%#0" PRIx32 "\tedx=%#0" PRIx32 "\n",
 	    istate->eax, istate->ebx, istate->ecx, istate->edx);
+	
 	printf("esi=%p\tedi=%p\tebp=%p\tesp=%p\n",
-	    istate->esi, istate->edi, istate->ebp,
-	    istate_from_uspace(istate) ? istate->esp : (uintptr_t)&istate->esp);
+	    (void *) istate->esi, (void *) istate->edi,
+	    (void *) istate->ebp,
+	    istate_from_uspace(istate) ? ((void *) istate->esp) :
+	    &istate->esp);
 }
 
@@ -139,7 +147,7 @@
 	);
 	
-	fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR=%#0.8x.",
-	    (unative_t) mxcsr);
-	panic_badtrap(istate, n, "SIMD FP exception, MXCSR=%#0.8x");
+	fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR=%#0" PRIx32 ".",
+	    mxcsr);
+	panic_badtrap(istate, n, "SIMD FP exception");
 }
 
Index: kernel/arch/ia32/src/mm/frame.c
===================================================================
--- kernel/arch/ia32/src/mm/frame.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/mm/frame.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,9 +44,8 @@
 #include <align.h>
 #include <macros.h>
-
 #include <print.h>
 
-#define PHYSMEM_LIMIT32  0x07c000000ull
-#define PHYSMEM_LIMIT64  0x200000000ull
+#define PHYSMEM_LIMIT32  UINT64_C(0x07c000000)
+#define PHYSMEM_LIMIT64  UINT64_C(0x200000000)
 
 size_t hardcoded_unmapped_ktext_size = 0;
Index: kernel/arch/ia32/src/mm/page.c
===================================================================
--- kernel/arch/ia32/src/mm/page.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/mm/page.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -82,5 +82,6 @@
 {
 	if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
-		panic("Unable to map physical memory %p (%d bytes).", physaddr, size);
+		panic("Unable to map physical memory %p (%zu bytes).",
+		    (void *) physaddr, size);
 	
 	uintptr_t virtaddr = PA2KA(last_frame);
Index: kernel/arch/ia32/src/smp/apic.c
===================================================================
--- kernel/arch/ia32/src/smp/apic.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/smp/apic.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -72,6 +72,6 @@
  *
  */
-volatile uint32_t *l_apic = (uint32_t *) 0xfee00000;
-volatile uint32_t *io_apic = (uint32_t *) 0xfec00000;
+volatile uint32_t *l_apic = (uint32_t *) UINT32_C(0xfee00000);
+volatile uint32_t *io_apic = (uint32_t *) UINT32_C(0xfec00000);
 
 uint32_t apic_id_mask = 0;
@@ -184,5 +184,5 @@
 	 * Other interrupts will be forwarded to the lowest priority CPU.
 	 */
-	io_apic_disable_irqs(0xffff);
+	io_apic_disable_irqs(0xffffU);
 	
 	irq_initialize(&l_apic_timer_irq);
@@ -477,5 +477,5 @@
 {
 #ifdef LAPIC_VERBOSE
-	printf("LVT on cpu%" PRIs ", LAPIC ID: %" PRIu8 "\n",
+	printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n",
 	    CPU->id, l_apic_id());
 	
Index: kernel/arch/ia32/src/smp/mps.c
===================================================================
--- kernel/arch/ia32/src/smp/mps.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia32/src/smp/mps.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,6 +52,6 @@
  */
 
-#define FS_SIGNATURE  0x5f504d5f
-#define CT_SIGNATURE  0x504d4350
+#define FS_SIGNATURE  UINT32_C(0x5f504d5f)
+#define CT_SIGNATURE  UINT32_C(0x504d4350)
 
 static struct mps_fs *fs;
Index: kernel/arch/ia64/include/bootinfo.h
===================================================================
--- kernel/arch/ia64/include/bootinfo.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia64/include/bootinfo.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,5 +62,5 @@
 	unsigned int memmap_items;
 	
-	unative_t *sapic;
+	sysarg_t *sapic;
 	unsigned long sys_freq;
 	unsigned long freq_scale;
Index: kernel/arch/ia64/include/types.h
===================================================================
--- kernel/arch/ia64/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia64/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,33 +43,20 @@
 typedef uint64_t ipl_t;
 
-typedef uint64_t unative_t;
+typedef uint64_t sysarg_t;
 typedef int64_t native_t;
 typedef uint64_t atomic_count_t;
 
 typedef struct {
-	unative_t fnc;
-	unative_t gp;
+	sysarg_t fnc;
+	sysarg_t gp;
 } __attribute__((may_alias)) fncptr_t;
 
-#define PRIp "lx"  /**< Format for uintptr_t. */
-#define PRIs "lu"  /**< Format for size_t. */
+#define INTN_C(c)   INT64_C(c)
+#define UINTN_C(c)  UINT64_C(c)
 
-#define PRId8 "d"    /**< Format for int8_t. */
-#define PRId16 "d"   /**< Format for int16_t. */
-#define PRId32 "d"   /**< Format for int32_t. */
-#define PRId64 "ld"  /**< Format for int64_t. */
-#define PRIdn "d"    /**< Format for native_t. */
-
-#define PRIu8 "u"    /**< Format for uint8_t. */
-#define PRIu16 "u"   /**< Format for uint16_t. */
-#define PRIu32 "u"   /**< Format for uint32_t. */
-#define PRIu64 "lu"  /**< Format for uint64_t. */
-#define PRIun "u"    /**< Format for unative_t. */
-
-#define PRIx8 "x"    /**< Format for hexadecimal (u)int8_t. */
-#define PRIx16 "x"   /**< Format for hexadecimal (u)int16_t. */
-#define PRIx32 "x"   /**< Format for hexadecimal (u)uint32_t. */
-#define PRIx64 "lx"  /**< Format for hexadecimal (u)int64_t. */
-#define PRIxn "x"    /**< Format for hexadecimal (u)native_t. */
+#define PRIdn  PRId64  /**< Format for native_t. */
+#define PRIun  PRIu64  /**< Format for sysarg_t. */
+#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ia64/src/ia64.c
===================================================================
--- kernel/arch/ia64/src/ia64.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia64/src/ia64.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -104,5 +104,5 @@
 static void iosapic_init(void)
 {
-	uint64_t IOSAPIC = PA2KA((unative_t)(iosapic_base)) | FW_OFFSET;
+	uint64_t IOSAPIC = PA2KA((sysarg_t)(iosapic_base)) | FW_OFFSET;
 	int i;
 	
@@ -147,4 +147,16 @@
 void arch_post_smp_init(void)
 {
+	static const char *platform;
+
+	/* Set platform name. */
+#ifdef MACHINE_ski
+	platform = "pc";
+#endif
+#ifdef MACHINE_i460GX
+	platform = "i460GX";
+#endif
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 #ifdef MACHINE_ski
 	ski_instance_t *ski_instance = skiin_init();
@@ -251,5 +263,5 @@
  * We use r13 (a.k.a. tp) for this purpose.
  */
-unative_t sys_tls_set(unative_t addr)
+sysarg_t sys_tls_set(sysarg_t addr)
 {
 	return 0;
@@ -274,6 +286,6 @@
 void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
 {
-	fptr->fnc = (unative_t) addr;
-	fptr->gp = ((unative_t *) caller)[1];
+	fptr->fnc = (sysarg_t) addr;
+	fptr->gp = ((sysarg_t *) caller)[1];
 	
 	return (void *) fptr;
Index: kernel/arch/ia64/src/interrupt.c
===================================================================
--- kernel/arch/ia64/src/interrupt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia64/src/interrupt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -135,18 +135,19 @@
 void istate_decode(istate_t *istate)
 {
-	printf("ar.bsp=%p\tar.bspstore=%p\n", istate->ar_bsp,
-	    istate->ar_bspstore);
-	printf("ar.rnat=%#018llx\tar.rsc=%#018llx\n", istate->ar_rnat,
-	    istate->ar_rsc);
-	printf("ar.ifs=%#018llx\tar.pfs=%#018llx\n", istate->ar_ifs,
-	    istate->ar_pfs);
-	printf("cr.isr=%#018llx\tcr.ipsr=%#018llx\t\n", istate->cr_isr.value,
-	    istate->cr_ipsr);
-	
-	printf("cr.iip=%#018llx, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei,
+	printf("ar.bsp=%p\tar.bspstore=%p\n",
+	    (void *) istate->ar_bsp, (void *) istate->ar_bspstore);
+	printf("ar.rnat=%#0" PRIx64 "\tar.rsc=%#0" PRIx64 "\n",
+	    istate->ar_rnat, istate->ar_rsc);
+	printf("ar.ifs=%#0" PRIx64 "\tar.pfs=%#0" PRIx64 "\n",
+	    istate->ar_ifs, istate->ar_pfs);
+	printf("cr.isr=%#0" PRIx64 "\tcr.ipsr=%#0" PRIx64 "\n",
+	    istate->cr_isr.value, istate->cr_ipsr.value);
+	
+	printf("cr.iip=%#0" PRIx64 ", #%u\t(%s)\n",
+	    istate->cr_iip, istate->cr_isr.ei,
 	    symtab_fmt_name_lookup(istate->cr_iip));
-	printf("cr.iipa=%#018llx\t(%s)\n", istate->cr_iipa,
+	printf("cr.iipa=%#0" PRIx64 "\t(%s)\n", istate->cr_iipa,
 	    symtab_fmt_name_lookup(istate->cr_iipa));
-	printf("cr.ifa=%#018llx\t(%s)\n", istate->cr_ifa,
+	printf("cr.ifa=%#0" PRIx64 "\t(%s)\n", istate->cr_ifa,
 	    symtab_fmt_name_lookup(istate->cr_ifa));
 }
Index: kernel/arch/ia64/src/mm/tlb.c
===================================================================
--- kernel/arch/ia64/src/mm/tlb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ia64/src/mm/tlb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -499,5 +499,6 @@
 		page_table_unlock(AS, true);
 		if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.", va);
+			fault_if_from_uspace(istate, "Page fault at %p.",
+			    (void *) va);
 			panic_memtrap(istate, PF_ACCESS_EXEC, va, NULL);
 		}
@@ -556,5 +557,5 @@
 			} else {
 				fault_if_from_uspace(istate,
-				    "IO access fault at %p.", va);
+				    "IO access fault at %p.", (void *) va);
 			}
 		}
@@ -620,5 +621,6 @@
 		 */
 		if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.", va);
+			fault_if_from_uspace(istate, "Page fault at %p.",
+			    (void *) va);
 			panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL);
 		}
@@ -668,5 +670,6 @@
 	} else {
 		if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.", va);
+			fault_if_from_uspace(istate, "Page fault at %p.",
+			    (void *) va);
 			panic_memtrap(istate, PF_ACCESS_WRITE, va, NULL);
 		}
@@ -704,5 +707,6 @@
 	} else {
 		if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.", va);
+			fault_if_from_uspace(istate, "Page fault at %p.",
+			    (void *) va);
 			panic_memtrap(istate, PF_ACCESS_EXEC, va, NULL);
 		}
@@ -740,5 +744,6 @@
 	} else {
 		if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.", va);
+			fault_if_from_uspace(istate, "Page fault at %p.",
+			    (void *) va);
 			panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL);
 		}
@@ -772,5 +777,6 @@
 	ASSERT(!t->w);
 	if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
-		fault_if_from_uspace(istate, "Page fault at %p.", va);
+		fault_if_from_uspace(istate, "Page fault at %p.",
+		    (void *) va);
 		panic_memtrap(istate, PF_ACCESS_WRITE, va, NULL);
 	}
@@ -812,5 +818,6 @@
 		page_table_unlock(AS, true);
 		if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.", va);
+			fault_if_from_uspace(istate, "Page fault at %p.",
+			    (void *) va);
 			panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL);
 		}
Index: kernel/arch/mips32/include/debugger.h
===================================================================
--- kernel/arch/mips32/include/debugger.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/include/debugger.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -58,8 +58,8 @@
 
 typedef struct  {
-	uintptr_t address;          /**< Breakpoint address */
-	unative_t instruction;      /**< Original instruction */
-	unative_t nextinstruction;  /**< Original instruction following break */
-	unsigned int flags;         /**< Flags regarding breakpoint */
+	uintptr_t address;         /**< Breakpoint address */
+	sysarg_t instruction;      /**< Original instruction */
+	sysarg_t nextinstruction;  /**< Original instruction following break */
+	unsigned int flags;        /**< Flags regarding breakpoint */
 	size_t counter;
 	void (*bkfunc)(void *, istate_t *);
@@ -68,5 +68,5 @@
 extern bpinfo_t breakpoints[BKPOINTS_MAX];
 
-extern bool is_jump(unative_t);
+extern bool is_jump(sysarg_t);
 
 extern void debugger_init(void);
Index: kernel/arch/mips32/include/fpu_context.h
===================================================================
--- kernel/arch/mips32/include/fpu_context.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/include/fpu_context.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,9 +38,9 @@
 #include <typedefs.h>
 
-#define FPU_CONTEXT_ALIGN    sizeof(unative_t)
+#define FPU_CONTEXT_ALIGN    sizeof(sysarg_t)
 
 typedef struct {
-	unative_t dregs[32];
-	unative_t cregs[32];
+	sysarg_t dregs[32];
+	sysarg_t cregs[32];
 } fpu_context_t;
 
Index: kernel/arch/mips32/include/types.h
===================================================================
--- kernel/arch/mips32/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,5 +43,5 @@
 typedef uint32_t ipl_t;
 
-typedef uint32_t unative_t;
+typedef uint32_t sysarg_t;
 typedef int32_t native_t;
 typedef uint32_t atomic_count_t;
@@ -50,24 +50,11 @@
 } fncptr_t;
 
-#define PRIp "x"  /**< Format for uintptr_t. */
-#define PRIs "u"  /**< Format for size_t. */
+#define INTN_C(c)   INT32_C(c)
+#define UINTN_C(c)  UINT32_C(c)
 
-#define PRId8 "d"     /**< Format for int8_t. */
-#define PRId16 "d"    /**< Format for int16_t. */
-#define PRId32 "ld"   /**< Format for int32_t. */
-#define PRId64 "lld"  /**< Format for int64_t. */
-#define PRIdn "d"     /**< Format for native_t. */
-
-#define PRIu8 "u"     /**< Format for uint8_t. */
-#define PRIu16 "u"    /**< Format for uint16_t. */
-#define PRIu32 "u"    /**< Format for uint32_t. */
-#define PRIu64 "llu"  /**< Format for uint64_t. */
-#define PRIun "u"     /**< Format for unative_t. */
-
-#define PRIx8 "x"     /**< Format for hexadecimal (u)int8_t. */
-#define PRIx16 "x"    /**< Format for hexadecimal (u)int16_t. */
-#define PRIx32 "x"    /**< Format for hexadecimal (u)uint32_t. */
-#define PRIx64 "llx"  /**< Format for hexadecimal (u)int64_t. */
-#define PRIxn "x"     /**< Format for hexadecimal (u)native_t. */
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/mips32/src/cache.c
===================================================================
--- kernel/arch/mips32/src/cache.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/src/cache.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 void cache_error(istate_t *istate)
 {
-	panic("cache_error exception (epc=%p).", istate->epc);
+	panic("cache_error exception (epc=%p).", (void *) istate->epc);
 }
 
Index: kernel/arch/mips32/src/debugger.c
===================================================================
--- kernel/arch/mips32/src/debugger.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/src/debugger.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -134,5 +134,5 @@
  *
  */
-bool is_jump(unative_t instr)
+bool is_jump(sysarg_t instr)
 {
 	unsigned int i;
@@ -166,6 +166,6 @@
 			return 0;
 		} else if ((breakpoints[i].address == (uintptr_t) argv->intval +
-		    sizeof(unative_t)) || (breakpoints[i].address ==
-		    (uintptr_t) argv->intval - sizeof(unative_t))) {
+		    sizeof(sysarg_t)) || (breakpoints[i].address ==
+		    (uintptr_t) argv->intval - sizeof(sysarg_t))) {
 			printf("Adjacent breakpoints not supported, conflict "
 			    "with %d.\n", i);
@@ -191,9 +191,9 @@
 	}
 	
-	printf("Adding breakpoint on address %p\n", argv->intval);
+	printf("Adding breakpoint on address %p\n", (void *) argv->intval);
 	
 	cur->address = (uintptr_t) argv->intval;
-	cur->instruction = ((unative_t *) cur->address)[0];
-	cur->nextinstruction = ((unative_t *) cur->address)[1];
+	cur->instruction = ((sysarg_t *) cur->address)[0];
+	cur->nextinstruction = ((sysarg_t *) cur->address)[1];
 	if (argv == &add_argv) {
 		cur->flags = 0;
@@ -209,5 +209,5 @@
 	
 	/* Set breakpoint */
-	*((unative_t *) cur->address) = 0x0d;
+	*((sysarg_t *) cur->address) = 0x0d;
 	smc_coherence(cur->address);
 	
@@ -247,5 +247,5 @@
 	smc_coherence(((uint32_t *) cur->address)[1]);
 	
-	cur->address = NULL;
+	cur->address = (uintptr_t) NULL;
 	
 	irq_spinlock_unlock(&bkpoint_lock, true);
@@ -267,6 +267,6 @@
 			    breakpoints[i].address);
 			
-			printf("%-4u %7" PRIs " %p %-8s %-9s %-10s %s\n", i,
-			    breakpoints[i].counter, breakpoints[i].address,
+			printf("%-4u %7zu %p %-8s %-9s %-10s %s\n", i,
+			    breakpoints[i].counter, (void *) breakpoints[i].address,
 			    ((breakpoints[i].flags & BKPOINT_INPROG) ? "true" :
 			    "false"), ((breakpoints[i].flags & BKPOINT_ONESHOT)
@@ -289,5 +289,5 @@
 	
 	for (i = 0; i < BKPOINTS_MAX; i++)
-		breakpoints[i].address = NULL;
+		breakpoints[i].address = (uintptr_t) NULL;
 	
 #ifdef CONFIG_KCONSOLE
@@ -341,5 +341,5 @@
 		/* Reinst only breakpoint */
 		if ((breakpoints[i].flags & BKPOINT_REINST) &&
-		    (fireaddr == breakpoints[i].address + sizeof(unative_t))) {
+		    (fireaddr == breakpoints[i].address + sizeof(sysarg_t))) {
 			cur = &breakpoints[i];
 			break;
@@ -366,5 +366,6 @@
 		
 		if (!(cur->flags & BKPOINT_FUNCCALL)) {
-			printf("***Breakpoint %u: %p in %s.\n", i, fireaddr,
+			printf("***Breakpoint %u: %p in %s.\n", i,
+			    (void *) fireaddr,
 			    symtab_fmt_name_lookup(fireaddr));
 		}
@@ -381,5 +382,6 @@
 		cur->flags |= BKPOINT_INPROG;
 	} else {
-		printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
+		printf("***Breakpoint %d: %p in %s.\n", i,
+		    (void *) fireaddr,
 		    symtab_fmt_name_lookup(fireaddr));
 		
@@ -417,5 +419,5 @@
 		/* Remove one-shot breakpoint */
 		if ((cur->flags & BKPOINT_ONESHOT))
-			cur->address = NULL;
+			cur->address = (uintptr_t) NULL;
 		
 		/* Remove in-progress flag */
Index: kernel/arch/mips32/src/exception.c
===================================================================
--- kernel/arch/mips32/src/exception.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/src/exception.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -74,22 +74,40 @@
 void istate_decode(istate_t *istate)
 {
-	printf("epc=%p\tsta=%p\tlo =%p\thi =%p\n",
-	    istate->epc, istate->status, istate->lo, istate->hi);
-	printf("a0 =%p\ta1 =%p\ta2 =%p\ta3 =%p\n",
+	printf("epc=%p\tsta=%#010" PRIx32 "\t"
+	    "lo =%#010" PRIx32 "\thi =%#010" PRIx32 "\n",
+	    (void *) istate->epc, istate->status,
+	    istate->lo, istate->hi);
+	
+	printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"
+	    "a2 =%#010" PRIx32 "\ta3 =%#010" PRIx32 "\n",
 	    istate->a0, istate->a1, istate->a2, istate->a3);
-	printf("t0 =%p\tt1 =%p\tt2 =%p\tt3 =%p\n",
+	
+	printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"
+	    "t2 =%#010" PRIx32 "\tt3 =%#010" PRIx32 "\n",
 	    istate->t0, istate->t1, istate->t2, istate->t3);
-	printf("t4 =%p\tt5 =%p\tt6 =%p\tt7 =%p\n",
+	
+	printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"
+	    "t6 =%#010" PRIx32 "\tt7 =%#010" PRIx32 "\n",
 	    istate->t4, istate->t5, istate->t6, istate->t7);
-	printf("t8 =%p\tt9 =%p\tv0 =%p\tv1 =%p\n",
+	
+	printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"
+	    "v0 =%#010" PRIx32 "\tv1 =%#010" PRIx32 "\n",
 	    istate->t8, istate->t9, istate->v0, istate->v1);
-	printf("s0 =%p\ts1 =%p\ts2 =%p\ts3 =%p\n",
+	
+	printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"
+	    "s2 =%#010" PRIx32 "\ts3 =%#010" PRIx32 "\n",
 	    istate->s0, istate->s1, istate->s2, istate->s3);
-	printf("s4 =%p\ts5 =%p\ts6 =%p\ts7 =%p\n",
+	
+	printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"
+	    "s6 =%#010" PRIx32 "\ts7 =%#010" PRIx32 "\n",
 	    istate->s4, istate->s5, istate->s6, istate->s7);
-	printf("s8 =%p\tat =%p\tkt0=%p\tkt1=%p\n",
+	
+	printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"
+	    "kt0=%#010" PRIx32 "\tkt1=%#010" PRIx32 "\n",
 	    istate->s8, istate->at, istate->kt0, istate->kt1);
+	
 	printf("sp =%p\tra =%p\tgp =%p\n",
-	    istate->sp, istate->ra, istate->gp);
+	    (void *) istate->sp, (void *) istate->ra,
+	    (void *) istate->gp);
 }
 
Index: kernel/arch/mips32/src/mips32.c
===================================================================
--- kernel/arch/mips32/src/mips32.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/src/mips32.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -168,4 +168,19 @@
 void arch_post_smp_init(void)
 {
+	static const char *platform;
+
+	/* Set platform name. */
+#ifdef MACHINE_msim
+	platform = "msim";
+#endif
+#ifdef MACHINE_bgxemul
+	platform = "gxemul";
+#endif
+#ifdef MACHINE_lgxemul
+	platform = "gxemul";
+#endif
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 #ifdef CONFIG_MIPS_KBD
 	/*
@@ -233,5 +248,5 @@
  * possible to have it separately in the future.
  */
-unative_t sys_tls_set(unative_t addr)
+sysarg_t sys_tls_set(sysarg_t addr)
 {
 	return 0;
Index: kernel/arch/mips32/src/mm/tlb.c
===================================================================
--- kernel/arch/mips32/src/mm/tlb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/src/mm/tlb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -323,5 +323,6 @@
 	uintptr_t va = cp0_badvaddr_read();
 	
-	fault_if_from_uspace(istate, "TLB Refill Exception on %p.", va);
+	fault_if_from_uspace(istate, "TLB Refill Exception on %p.",
+	    (void *) va);
 	panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, "TLB Refill Exception.");
 }
@@ -332,5 +333,6 @@
 	uintptr_t va = cp0_badvaddr_read();
 	
-	fault_if_from_uspace(istate, "TLB Invalid Exception on %p.", va);
+	fault_if_from_uspace(istate, "TLB Invalid Exception on %p.",
+	    (void *) va);
 	panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, "TLB Invalid Exception.");
 }
@@ -340,5 +342,6 @@
 	uintptr_t va = cp0_badvaddr_read();
 	
-	fault_if_from_uspace(istate, "TLB Modified Exception on %p.", va);
+	fault_if_from_uspace(istate, "TLB Modified Exception on %p.",
+	    (void *) va);
 	panic_memtrap(istate, PF_ACCESS_WRITE, va, "TLB Modified Exception.");
 }
Index: kernel/arch/mips32/src/smp/dorder.c
===================================================================
--- kernel/arch/mips32/src/smp/dorder.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/mips32/src/smp/dorder.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,5 +37,5 @@
 #include <arch/smp/dorder.h>
 
-#define MSIM_DORDER_ADDRESS  0xB0000004
+#define MSIM_DORDER_ADDRESS  0xB0000100
 
 #ifdef CONFIG_SMP
Index: kernel/arch/ppc32/include/exception.h
===================================================================
--- kernel/arch/ppc32/include/exception.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/include/exception.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -98,10 +98,10 @@
 }
 
-NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)
+NO_TRACE static inline sysarg_t istate_get_pc(istate_t *istate)
 {
 	return istate->pc;
 }
 
-NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)
+NO_TRACE static inline sysarg_t istate_get_fp(istate_t *istate)
 {
 	return istate->sp;
Index: kernel/arch/ppc32/include/types.h
===================================================================
--- kernel/arch/ppc32/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,5 +43,5 @@
 typedef uint32_t ipl_t;
 
-typedef uint32_t unative_t;
+typedef uint32_t sysarg_t;
 typedef int32_t native_t;
 typedef uint32_t atomic_count_t;
@@ -50,26 +50,11 @@
 } fncptr_t;
 
-/** Formats for uintptr_t, size_t */
-#define PRIp  "x"
-#define PRIs  "u"
+#define INTN_C(c)   INT32_C(c)
+#define UINTN_C(c)  UINT32_C(c)
 
-/** Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */
-#define PRId8   "d"
-#define PRId16  "d"
-#define PRId32  "d"
-#define PRId64  "lld"
-#define PRIdn   "d"
-
-#define PRIu8   "u"
-#define PRIu16  "u"
-#define PRIu32  "u"
-#define PRIu64  "llu"
-#define PRIun   "u"
-
-#define PRIx8   "x"
-#define PRIx16  "x"
-#define PRIx32  "x"
-#define PRIx64  "llx"
-#define PRIxn   "x"
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ppc32/src/cpu/cpu.c
===================================================================
--- kernel/arch/ppc32/src/cpu/cpu.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/src/cpu/cpu.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -68,5 +68,5 @@
 	}
 	
-	printf("cpu%" PRIs ": version=%" PRIu16" (%s), revision=%" PRIu16 "\n", cpu->id,
+	printf("cpu%u: version=%" PRIu16" (%s), revision=%" PRIu16 "\n", cpu->id,
 	    cpu->arch.version, name, cpu->arch.revision);
 }
Index: kernel/arch/ppc32/src/interrupt.c
===================================================================
--- kernel/arch/ppc32/src/interrupt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/src/interrupt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -54,26 +54,44 @@
 void istate_decode(istate_t *istate)
 {
-	printf("r0 =%p\tr1 =%p\tr2 =%p\n", istate->r0, istate->sp, istate->r2);
-	printf("r3 =%p\tr4 =%p\tr5 =%p\n", istate->r3, istate->r4, istate->r5);
-	printf("r6 =%p\tr7 =%p\tr8 =%p\n", istate->r6, istate->r7, istate->r8);
-	printf("r9 =%p\tr10=%p\tr11=%p\n",
+	printf("r0 =%#0" PRIx32 "\tr1 =%p\tr2 =%#0" PRIx32 "\n",
+	    istate->r0, (void *) istate->sp, istate->r2);
+	
+	printf("r3 =%#0" PRIx32 "\tr4 =%#0" PRIx32 "\tr5 =%#0" PRIx32 "\n",
+	    istate->r3, istate->r4, istate->r5);
+	
+	printf("r6 =%#0" PRIx32 "\tr7 =%#0" PRIx32 "\tr8 =%#0" PRIx32 "\n",
+	    istate->r6, istate->r7, istate->r8);
+	
+	printf("r9 =%#0" PRIx32 "\tr10=%#0" PRIx32 "\tr11=%#0" PRIx32 "\n",
 	    istate->r9, istate->r10, istate->r11);
-	printf("r12=%p\tr13=%p\tr14=%p\n",
+	
+	printf("r12=%#0" PRIx32 "\tr13=%#0" PRIx32 "\tr14=%#0" PRIx32 "\n",
 	    istate->r12, istate->r13, istate->r14);
-	printf("r15=%p\tr16=%p\tr17=%p\n",
+	
+	printf("r15=%#0" PRIx32 "\tr16=%#0" PRIx32 "\tr17=%#0" PRIx32 "\n",
 	    istate->r15, istate->r16, istate->r17);
-	printf("r18=%p\tr19=%p\tr20=%p\n",
+	
+	printf("r18=%#0" PRIx32 "\tr19=%#0" PRIx32 "\tr20=%#0" PRIx32 "\n",
 	    istate->r18, istate->r19, istate->r20);
-	printf("r21=%p\tr22=%p\tr23=%p\n",
+	
+	printf("r21=%#0" PRIx32 "\tr22=%#0" PRIx32 "\tr23=%#0" PRIx32 "\n",
 	    istate->r21, istate->r22, istate->r23);
-	printf("r24=%p\tr25=%p\tr26=%p\n",
+	
+	printf("r24=%#0" PRIx32 "\tr25=%#0" PRIx32 "\tr26=%#0" PRIx32 "\n",
 	    istate->r24, istate->r25, istate->r26);
-	printf("r27=%p\tr28=%p\tr29=%p\n",
+	
+	printf("r27=%#0" PRIx32 "\tr28=%#0" PRIx32 "\tr29=%#0" PRIx32 "\n",
 	    istate->r27, istate->r28, istate->r29);
-	printf("r30=%p\tr31=%p\n", istate->r30, istate->r31);
-	printf("cr =%p\tpc =%p\tlr =%p\n", istate->cr, istate->pc, istate->lr);
-	printf("ctr=%p\txer=%p\tdar=%p\n",
+	
+	printf("r30=%#0" PRIx32 "\tr31=%#0" PRIx32 "\n",
+	    istate->r30, istate->r31);
+	
+	printf("cr =%#0" PRIx32 "\tpc =%p\tlr =%p\n",
+	    istate->cr, (void *) istate->pc, (void *) istate->lr);
+	
+	printf("ctr=%#0" PRIx32 "\txer=%#0" PRIx32 "\tdar=%#0" PRIx32 "\n",
 	    istate->ctr, istate->xer, istate->dar);
-	printf("srr1=%p\n", istate->srr1);
+	
+	printf("srr1=%p\n", (void *) istate->srr1);
 }
 
@@ -111,5 +129,5 @@
 			 */
 #ifdef CONFIG_DEBUG
-			printf("cpu%" PRIs ": spurious interrupt (inum=%" PRIu8 ")\n",
+			printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n",
 			    CPU->id, inum);
 #endif
Index: kernel/arch/ppc32/src/mm/frame.c
===================================================================
--- kernel/arch/ppc32/src/mm/frame.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/src/mm/frame.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,5 +49,5 @@
 	size_t i;
 	for (i = 0; i < memmap.cnt; i++) {
-		printf("%#10x %#10x\n", memmap.zones[i].start,
+		printf("%p %#0zx\n", memmap.zones[i].start,
 		    memmap.zones[i].size);
 	}
Index: kernel/arch/ppc32/src/mm/page.c
===================================================================
--- kernel/arch/ppc32/src/mm/page.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/src/mm/page.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,6 +49,6 @@
 	if (last_frame + ALIGN_UP(size, PAGE_SIZE) >
 	    KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
-		panic("Unable to map physical memory %p (%" PRIs " bytes).",
-		    physaddr, size);
+		panic("Unable to map physical memory %p (%zu bytes).",
+		    (void *) physaddr, size);
 	
 	uintptr_t virtaddr = PA2KA(last_frame);
Index: kernel/arch/ppc32/src/mm/tlb.c
===================================================================
--- kernel/arch/ppc32/src/mm/tlb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/src/mm/tlb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -111,5 +111,6 @@
 static void pht_refill_fail(uintptr_t badvaddr, istate_t *istate)
 {
-	fault_if_from_uspace(istate, "PHT Refill Exception on %p.", badvaddr);
+	fault_if_from_uspace(istate, "PHT Refill Exception on %p.",
+	    (void *) badvaddr);
 	panic_memtrap(istate, PF_ACCESS_UNKNOWN, badvaddr,
 	    "PHT Refill Exception.");
@@ -459,11 +460,11 @@
 		length = 0; \
 	\
-	printf(name ": page=%.*p frame=%.*p length=%d KB (mask=%#x)%s%s\n", \
-	    sizeof(upper) * 2, upper & 0xffff0000, sizeof(lower) * 2, \
-	    lower & 0xffff0000, length, mask, \
+	printf(name ": page=%#0" PRIx32 " frame=%#0" PRIx32 \
+	    " length=%#0" PRIx32 " KB (mask=%#0" PRIx32 ")%s%s\n", \
+	    upper & UINT32_C(0xffff0000), lower & UINT32_C(0xffff0000), \
+	    length, mask, \
 	    ((upper >> 1) & 1) ? " supervisor" : "", \
 	    (upper & 1) ? " user" : "");
 
-
 void tlb_print(void)
 {
@@ -473,6 +474,7 @@
 		uint32_t vsid = sr_get(sr << 28);
 		
-		printf("sr[%02u]: vsid=%.*p (asid=%u)%s%s\n", sr,
-		    sizeof(vsid) * 2, vsid & 0xffffff, (vsid & 0xffffff) >> 4,
+		printf("sr[%02" PRIu32 "]: vsid=%#0" PRIx32 " (asid=%" PRIu32 ")"
+		    "%s%s\n", sr, vsid & UINT32_C(0x00ffffff),
+		    (vsid & UINT32_C(0x00ffffff)) >> 4,
 		    ((vsid >> 30) & 1) ? " supervisor" : "",
 		    ((vsid >> 29) & 1) ? " user" : "");
Index: kernel/arch/ppc32/src/ppc32.c
===================================================================
--- kernel/arch/ppc32/src/ppc32.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/ppc32/src/ppc32.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -249,4 +249,10 @@
 void arch_post_smp_init(void)
 {
+	/* Currently the only supported platform for ppc32 is 'mac'. */
+	static const char *platform = "mac";
+
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 	ofw_tree_walk_by_device_type("mac-io", macio_register, NULL);
 }
Index: kernel/arch/sparc64/include/mm/sun4u/tlb.h
===================================================================
--- kernel/arch/sparc64/include/mm/sun4u/tlb.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/include/mm/sun4u/tlb.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -678,5 +678,5 @@
 }
 
-extern void fast_instruction_access_mmu_miss(unative_t, istate_t *);
+extern void fast_instruction_access_mmu_miss(sysarg_t, istate_t *);
 extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t, istate_t *);
 extern void fast_data_access_protection(tlb_tag_access_reg_t , istate_t *);
Index: kernel/arch/sparc64/include/mm/sun4v/tlb.h
===================================================================
--- kernel/arch/sparc64/include/mm/sun4v/tlb.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/include/mm/sun4v/tlb.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -141,7 +141,7 @@
 }
 
-extern void fast_instruction_access_mmu_miss(unative_t, istate_t *);
-extern void fast_data_access_mmu_miss(unative_t, istate_t *);
-extern void fast_data_access_protection(unative_t, istate_t *);
+extern void fast_instruction_access_mmu_miss(sysarg_t, istate_t *);
+extern void fast_data_access_mmu_miss(sysarg_t, istate_t *);
+extern void fast_data_access_protection(sysarg_t, istate_t *);
 
 extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool);
Index: kernel/arch/sparc64/include/types.h
===================================================================
--- kernel/arch/sparc64/include/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/include/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,5 +43,5 @@
 typedef uint64_t ipl_t;
 
-typedef uint64_t unative_t;
+typedef uint64_t sysarg_t;
 typedef int64_t native_t;
 typedef uint64_t atomic_count_t;
@@ -52,26 +52,11 @@
 typedef uint8_t asi_t;
 
-/** Formats for uintptr_t, size_t */
-#define PRIp  "llx"
-#define PRIs  "llu"
+#define INTN_C(c)   INT64_C(c)
+#define UINTN_C(c)  UINT64_C(c)
 
-/** Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */
-#define PRId8   "d"
-#define PRId16  "d"
-#define PRId32  "d"
-#define PRId64  "lld"
-#define PRIdn   "lld"
-
-#define PRIu8   "u"
-#define PRIu16  "u"
-#define PRIu32  "u"
-#define PRIu64  "llu"
-#define PRIun   "llu"
-
-#define PRIx8   "x"
-#define PRIx16  "x"
-#define PRIx32  "x"
-#define PRIx64  "llx"
-#define PRIxn   "llx"
+#define PRIdn  PRId64  /**< Format for native_t. */
+#define PRIun  PRIu64  /**< Format for sysarg_t. */
+#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/sparc64/src/console.c
===================================================================
--- kernel/arch/sparc64/src/console.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/console.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -70,5 +70,5 @@
 	ofw_tree_node_t *screen = ofw_tree_lookup(prop_scr->value);
 	if (!screen)
-		panic("Cannot find %s.", prop_scr->value);
+		panic("Cannot find %s.", (char *) prop_scr->value);
 	
 	scr_init(screen);
@@ -83,5 +83,5 @@
 	ofw_tree_node_t *keyboard = ofw_tree_lookup(prop_kbd->value);
 	if (!keyboard)
-		panic("Cannot find %s.", prop_kbd->value);
+		panic("Cannot find %s.", (char *) prop_kbd->value);
 	
 	kbd_init(keyboard);
Index: kernel/arch/sparc64/src/drivers/pci.c
===================================================================
--- kernel/arch/sparc64/src/drivers/pci.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/drivers/pci.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -211,5 +211,6 @@
 		 * Unsupported model.
 		 */
-		printf("Unsupported PCI controller model (%s).\n", prop->value);
+		printf("Unsupported PCI controller model (%s).\n",
+		    (char *) prop->value);
 	}
 
Index: kernel/arch/sparc64/src/mm/sun4u/frame.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/frame.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/mm/sun4u/frame.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,5 +41,5 @@
 #include <macros.h>
 
-uintptr_t last_frame = NULL;
+uintptr_t last_frame = (uintptr_t) NULL;
 
 /** Create memory zones according to information stored in memmap.
Index: kernel/arch/sparc64/src/mm/sun4u/tlb.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/tlb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/mm/sun4u/tlb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -200,5 +200,5 @@
 
 /** ITLB miss handler. */
-void fast_instruction_access_mmu_miss(unative_t unused, istate_t *istate)
+void fast_instruction_access_mmu_miss(sysarg_t unused, istate_t *istate)
 {
 	uintptr_t page_16k = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
@@ -360,7 +360,7 @@
 static void print_tlb_entry(int i, tlb_tag_read_reg_t t, tlb_data_t d)
 {
-	printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, "
-	    "ie=%d, soft2=%#x, pfn=%#x, soft=%#x, l=%d, "
-	    "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
+	printf("%u: vpn=%#" PRIx64 ", context=%u, v=%u, size=%u, nfo=%u, "
+	    "ie=%u, soft2=%#x, pfn=%#x, soft=%#x, l=%u, "
+	    "cp=%u, cv=%u, e=%u, p=%u, w=%u, g=%u\n", i, (uint64_t) t.vpn,
 	    t.context, d.v, d.size, d.nfo, d.ie, d.soft2,
 	    d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
@@ -441,5 +441,5 @@
     uintptr_t va, const char *str)
 {
-	fault_if_from_uspace(istate, "%s, Address=%p.", str, va);
+	fault_if_from_uspace(istate, "%s, address=%p.", str, (void *) va);
 	panic_memtrap(istate, PF_ACCESS_EXEC, va, str);
 }
@@ -451,6 +451,6 @@
 
 	va = tag.vpn << MMU_PAGE_WIDTH;
-	fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va,
-	    tag.context);
+	fault_if_from_uspace(istate, "%s, page=%p (asid=%u).", str,
+	    (void *) va, tag.context);
 	panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, str);
 }
@@ -462,6 +462,6 @@
 
 	va = tag.vpn << MMU_PAGE_WIDTH;
-	fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va,
-	    tag.context);
+	fault_if_from_uspace(istate, "%s, page=%p (asid=%u).", str,
+	    (void *) va, tag.context);
 	panic_memtrap(istate, PF_ACCESS_WRITE, va, str);
 }
@@ -484,6 +484,6 @@
 	    sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv);
 #endif
-	    
-	printf("DTLB SFAR: address=%p\n", sfar);
+	
+	printf("DTLB SFAR: address=%p\n", (void *) sfar);
 	
 	dtlb_sfsr_write(0);
@@ -508,5 +508,5 @@
 #endif
 	    
-	printf("DTLB SFAR: address=%p\n", sfar);
+	printf("DTLB SFAR: address=%p\n", (void *) sfar);
 	
 	dtlb_sfsr_write(0);
Index: kernel/arch/sparc64/src/mm/sun4v/tlb.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/tlb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/mm/sun4v/tlb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -213,5 +213,5 @@
 
 /** ITLB miss handler. */
-void fast_instruction_access_mmu_miss(unative_t unused, istate_t *istate)
+void fast_instruction_access_mmu_miss(sysarg_t unused, istate_t *istate)
 {
 	uintptr_t va = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
@@ -358,5 +358,6 @@
     const char *str)
 {
-	fault_if_from_uspace(istate, "%s, Address=%p.", str, va);
+	fault_if_from_uspace(istate, "%s, address=%p.", str,
+	    (void *) va);
 	panic_memtrap(istate, PF_ACCESS_EXEC, va, str);
 }
@@ -365,6 +366,6 @@
     uint64_t page_and_ctx, const char *str)
 {
-	fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str,
-	    DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx));
+	fault_if_from_uspace(istate, "%s, page=%p (asid=%" PRId64 ").", str,
+	    (void *) DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx));
 	panic_memtrap(istate, PF_ACCESS_UNKNOWN, DMISS_ADDRESS(page_and_ctx),
 	    str);
@@ -374,6 +375,6 @@
     uint64_t page_and_ctx, const char *str)
 {
-	fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str,
-	    DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx));
+	fault_if_from_uspace(istate, "%s, page=%p (asid=%" PRId64 ").", str,
+	    (void *) DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx));
 	panic_memtrap(istate, PF_ACCESS_WRITE, DMISS_ADDRESS(page_and_ctx),
 	    str);
@@ -399,7 +400,6 @@
 	uint64_t errno =  __hypercall_fast3(MMU_DEMAP_ALL, 0, 0,
 		MMU_FLAG_DTLB | MMU_FLAG_ITLB);
-	if (errno != HV_EOK) {
-		panic("Error code = %d.\n", errno);
-	}
+	if (errno != HV_EOK)
+		panic("Error code = %" PRIu64 ".\n", errno);
 }
 
Index: kernel/arch/sparc64/src/sun4u/sparc64.c
===================================================================
--- kernel/arch/sparc64/src/sun4u/sparc64.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/sun4u/sparc64.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -50,4 +50,5 @@
 #include <ddi/irq.h>
 #include <str.h>
+#include <sysinfo/sysinfo.h>
 
 memmap_t memmap;
@@ -111,4 +112,10 @@
 void arch_post_smp_init(void)
 {
+	/* Currently the only supported platform for sparc64/sun4u is 'sun4u'. */
+	static const char *platform = "sun4u";
+
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 	standalone_sparc64_console_init();
 }
Index: kernel/arch/sparc64/src/sun4v/md.c
===================================================================
--- kernel/arch/sparc64/src/sun4v/md.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/sun4v/md.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -310,6 +310,6 @@
 	retval = retval;
 	if (retval != HV_EOK) {
-		printf("Could not retrieve machine description, error = %d.\n",
-		    retval);
+		printf("Could not retrieve machine description, "
+		    "error=%" PRIu64 ".\n", retval);
 	}
 }
Index: kernel/arch/sparc64/src/sun4v/sparc64.c
===================================================================
--- kernel/arch/sparc64/src/sun4v/sparc64.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/sun4v/sparc64.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,4 +52,5 @@
 #include <str.h>
 #include <arch/drivers/niagara.h>
+#include <sysinfo/sysinfo.h>
 
 memmap_t memmap;
@@ -109,4 +110,10 @@
 void arch_post_smp_init(void)
 {
+	/* Currently the only supported platform for sparc64/sun4v is 'sun4v'. */
+	static const char *platform = "sun4v";
+
+	sysinfo_set_item_data("platform", NULL, (void *) platform,
+	    str_size(platform));
+
 	niagarain_init();
 }
Index: kernel/arch/sparc64/src/trap/sun4v/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -87,5 +87,5 @@
 		KA2PA(cpu_mondo_queues[CPU->id]),
 		CPU_MONDO_NENTRIES) != HV_EOK)
-			panic("Initializing mondo queue failed on CPU %d.\n",
+			panic("Initializing mondo queue failed on CPU %" PRIu64 ".\n",
 			    CPU->arch.id);
 }
Index: kernel/genarch/src/acpi/acpi.c
===================================================================
--- kernel/genarch/src/acpi/acpi.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/genarch/src/acpi/acpi.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -116,5 +116,5 @@
 		    / sizeof(struct acpi_signature_map); j++) {
 			struct acpi_sdt_header *hdr =
-			    (struct acpi_sdt_header *) (unative_t) acpi_rsdt->entry[i];
+			    (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i];
 			
 			map_sdt(hdr);
Index: kernel/genarch/src/acpi/madt.c
===================================================================
--- kernel/genarch/src/acpi/madt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/genarch/src/acpi/madt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -165,5 +165,5 @@
 		/* Remember index of the first io apic entry */
 		madt_io_apic_entry_index = i;
-		io_apic = (uint32_t *) (unative_t) ioa->io_apic_address;
+		io_apic = (uint32_t *) (sysarg_t) ioa->io_apic_address;
 	} else {
 		/* Currently not supported */
@@ -190,5 +190,5 @@
 	struct madt_apic_header *hdr;
 	
-	l_apic = (uint32_t *) (unative_t) acpi_madt->l_apic_address;
+	l_apic = (uint32_t *) (sysarg_t) acpi_madt->l_apic_address;
 	
 	/* Count MADT entries */
Index: kernel/genarch/src/mm/page_ht.c
===================================================================
--- kernel/genarch/src/mm/page_ht.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/genarch/src/mm/page_ht.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,6 +52,6 @@
 #include <align.h>
 
-static size_t hash(unative_t[]);
-static bool compare(unative_t[], size_t, link_t *);
+static size_t hash(sysarg_t[]);
+static bool compare(sysarg_t[], size_t, link_t *);
 static void remove_callback(link_t *);
 
@@ -96,5 +96,5 @@
  *
  */
-size_t hash(unative_t key[])
+size_t hash(sysarg_t key[])
 {
 	as_t *as = (as_t *) key[KEY_AS];
@@ -115,5 +115,5 @@
 	 *
 	 */
-	index |= ((unative_t) as) & (PAGE_HT_ENTRIES - 1);
+	index |= ((sysarg_t) as) & (PAGE_HT_ENTRIES - 1);
 	
 	return index;
@@ -129,5 +129,5 @@
  *
  */
-bool compare(unative_t key[], size_t keys, link_t *item)
+bool compare(sysarg_t key[], size_t keys, link_t *item)
 {
 	ASSERT(item);
@@ -180,5 +180,5 @@
     unsigned int flags)
 {
-	unative_t key[2] = {
+	sysarg_t key[2] = {
 		(uintptr_t) as,
 		page = ALIGN_DOWN(page, PAGE_SIZE)
@@ -220,5 +220,5 @@
 void ht_mapping_remove(as_t *as, uintptr_t page)
 {
-	unative_t key[2] = {
+	sysarg_t key[2] = {
 		(uintptr_t) as,
 		page = ALIGN_DOWN(page, PAGE_SIZE)
@@ -247,5 +247,5 @@
 pte_t *ht_mapping_find(as_t *as, uintptr_t page)
 {
-	unative_t key[2] = {
+	sysarg_t key[2] = {
 		(uintptr_t) as,
 		page = ALIGN_DOWN(page, PAGE_SIZE)
Index: kernel/generic/include/adt/hash_table.h
===================================================================
--- kernel/generic/include/adt/hash_table.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/adt/hash_table.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,5 +48,5 @@
 	 * @return Index into hash table.
 	 */
-	size_t (* hash)(unative_t key[]);
+	size_t (* hash)(sysarg_t key[]);
 	
 	/** Hash table item comparison function.
@@ -57,5 +57,5 @@
 	 * @return true if the keys match, false otherwise.
 	 */
-	bool (*compare)(unative_t key[], size_t keys, link_t *item);
+	bool (*compare)(sysarg_t key[], size_t keys, link_t *item);
 
 	/** Hash table item removal callback.
@@ -79,7 +79,7 @@
 extern void hash_table_create(hash_table_t *h, size_t m, size_t max_keys,
     hash_table_operations_t *op);
-extern void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item);
-extern link_t *hash_table_find(hash_table_t *h, unative_t key[]);
-extern void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys);
+extern void hash_table_insert(hash_table_t *h, sysarg_t key[], link_t *item);
+extern link_t *hash_table_find(hash_table_t *h, sysarg_t key[]);
+extern void hash_table_remove(hash_table_t *h, sysarg_t key[], size_t keys);
 
 #endif
Index: kernel/generic/include/config.h
===================================================================
--- kernel/generic/include/config.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/config.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -66,5 +66,5 @@
 
 typedef struct {
-	size_t cpu_count;            /**< Number of processors detected. */
+	unsigned int cpu_count;      /**< Number of processors detected. */
 	volatile size_t cpu_active;  /**< Number of processors that are up and running. */
 	
Index: kernel/generic/include/console/console.h
===================================================================
--- kernel/generic/include/console/console.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/console/console.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -67,11 +67,11 @@
 extern wchar_t getc(indev_t *indev);
 extern size_t gets(indev_t *indev, char *buf, size_t buflen);
-extern unative_t sys_klog(int fd, const void *buf, size_t size);
+extern sysarg_t sys_klog(int fd, const void *buf, size_t size);
 
 extern void grab_console(void);
 extern void release_console(void);
 
-extern unative_t sys_debug_enable_console(void);
-extern unative_t sys_debug_disable_console(void);
+extern sysarg_t sys_debug_enable_console(void);
+extern sysarg_t sys_debug_disable_console(void);
 
 #endif /* KERN_CONSOLE_H_ */
Index: kernel/generic/include/console/kconsole.h
===================================================================
--- kernel/generic/include/console/kconsole.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/console/kconsole.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,5 +62,5 @@
 	size_t len;
 	/** Integer value. */
-	unative_t intval;
+	sysarg_t intval;
 	/** Resulting type of variable arg */
 	cmd_arg_type_t vartype;
Index: kernel/generic/include/cpu.h
===================================================================
--- kernel/generic/include/cpu.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/cpu.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -83,5 +83,5 @@
 	 * Processor ID assigned by kernel.
 	 */
-	size_t id;
+	unsigned int id;
 	
 	bool active;
Index: kernel/generic/include/ddi/ddi.h
===================================================================
--- kernel/generic/include/ddi/ddi.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ddi/ddi.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,7 +52,7 @@
 extern void ddi_parea_register(parea_t *);
 
-extern unative_t sys_physmem_map(unative_t, unative_t, unative_t, unative_t);
-extern unative_t sys_iospace_enable(ddi_ioarg_t *);
-extern unative_t sys_interrupt_enable(int irq, int enable);
+extern sysarg_t sys_physmem_map(sysarg_t, sysarg_t, sysarg_t, sysarg_t);
+extern sysarg_t sys_iospace_enable(ddi_ioarg_t *);
+extern sysarg_t sys_interrupt_enable(int irq, int enable);
 
 /*
Index: kernel/generic/include/ddi/device.h
===================================================================
--- kernel/generic/include/ddi/device.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ddi/device.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 
 extern devno_t device_assign_devno(void);
-extern unative_t sys_device_assign_devno(void);
+extern sysarg_t sys_device_assign_devno(void);
 
 #endif
Index: kernel/generic/include/ddi/irq.h
===================================================================
--- kernel/generic/include/ddi/irq.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ddi/irq.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -122,6 +122,6 @@
 	/** Answerbox for notifications. */
 	answerbox_t *answerbox;
-	/** Method to be used for the notification. */
-	unative_t method;
+	/** Interface and method to be used for the notification. */
+	sysarg_t imethod;
 	/** Arguments that will be sent if the IRQ is claimed. */
 	uint32_t scratch[IPC_CALL_LEN];
@@ -189,4 +189,6 @@
 extern hash_table_t irq_uspace_hash_table;
 
+extern inr_t last_inr;
+
 extern void irq_init(size_t, size_t);
 extern void irq_initialize(irq_t *);
Index: kernel/generic/include/interrupt.h
===================================================================
--- kernel/generic/include/interrupt.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/interrupt.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,4 +37,5 @@
 
 #include <arch/interrupt.h>
+#include <print.h>
 #include <typedefs.h>
 #include <proc/task.h>
@@ -57,5 +58,6 @@
 extern exc_table_t exc_table[];
 
-extern void fault_if_from_uspace(istate_t *, const char *, ...);
+extern void fault_if_from_uspace(istate_t *, const char *, ...)
+    PRINTF_ATTRIBUTE(2, 3);
 extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
 extern void exc_dispatch(unsigned int, istate_t *);
Index: kernel/generic/include/ipc/event.h
===================================================================
--- kernel/generic/include/ipc/event.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ipc/event.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,6 +47,6 @@
 	/** Answerbox for notifications. */
 	answerbox_t *answerbox;
-	/** Method to be used for the notification. */
-	unative_t method;
+	/** Interface and method to be used for the notification. */
+	sysarg_t imethod;
 	/** Counter. */
 	size_t counter;
@@ -54,5 +54,5 @@
 
 extern void event_init(void);
-extern unative_t sys_event_subscribe(unative_t, unative_t);
+extern sysarg_t sys_event_subscribe(sysarg_t, sysarg_t);
 extern bool event_is_subscribed(event_type_t);
 extern void event_cleanup_answerbox(answerbox_t *);
@@ -71,6 +71,6 @@
 	event_notify((e), (a1), (a2), (a3), (a4), (a5))
 
-extern void event_notify(event_type_t, unative_t, unative_t, unative_t,
-    unative_t, unative_t);
+extern void event_notify(event_type_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t);
 
 #endif
Index: kernel/generic/include/ipc/ipc.h
===================================================================
--- kernel/generic/include/ipc/ipc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ipc/ipc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,10 +43,6 @@
 #define IPC_CALL_LEN  6
 
-/** Maximum active async calls per thread */
-#ifdef CONFIG_DEBUG
-	#define IPC_MAX_ASYNC_CALLS  4
-#else
-	#define IPC_MAX_ASYNC_CALLS  4000
-#endif
+/** Maximum active async calls per phone */
+#define IPC_MAX_ASYNC_CALLS  4
 
 /* Flags for calls */
@@ -88,5 +84,5 @@
 /* Macros for manipulating calling data */
 #define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (retval))
-#define IPC_SET_METHOD(data, val)     ((data).args[0] = (val))
+#define IPC_SET_IMETHOD(data, val)    ((data).args[0] = (val))
 #define IPC_SET_ARG1(data, val)       ((data).args[1] = (val))
 #define IPC_SET_ARG2(data, val)       ((data).args[2] = (val))
@@ -95,6 +91,6 @@
 #define IPC_SET_ARG5(data, val)       ((data).args[5] = (val))
 
-#define IPC_GET_METHOD(data)  ((data).args[0])
-#define IPC_GET_RETVAL(data)  ((data).args[0])
+#define IPC_GET_IMETHOD(data)  ((data).args[0])
+#define IPC_GET_RETVAL(data)   ((data).args[0])
 
 #define IPC_GET_ARG1(data)  ((data).args[1])
@@ -120,6 +116,13 @@
 #define IPC_FF_ROUTE_FROM_ME  (1 << 0)
 
+/** Kernel IPC interfaces
+ *
+ */
+#define IPC_IF_KERNEL  0
+
 /** System-specific methods - only through special syscalls
- * These methods have special behaviour
+ *
+ * These methods have special behaviour. These methods also
+ * have the implicit kernel interface 0.
  *
  */
@@ -315,5 +318,5 @@
 
 typedef struct {
-	unative_t args[IPC_CALL_LEN];
+	sysarg_t args[IPC_CALL_LEN];
 	phone_t *phone;
 } ipc_data_t;
@@ -335,5 +338,5 @@
 	
 	/** Private data to internal IPC. */
-	unative_t priv;
+	sysarg_t priv;
 	
 	/** Data passed from/to userspace. */
@@ -372,5 +375,5 @@
 
 extern void ipc_cleanup(void);
-extern void ipc_backsend_err(phone_t *, call_t *, unative_t);
+extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t);
 extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
 extern void ipc_cleanup_call_list(link_t *);
Index: kernel/generic/include/ipc/ipcrsc.h
===================================================================
--- kernel/generic/include/ipc/ipcrsc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ipc/ipcrsc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 #include <ipc/ipc.h>
 
-extern call_t * get_call(unative_t callid);
+extern call_t * get_call(sysarg_t callid);
 extern int phone_alloc(task_t *t);
 extern void phone_connect(int phoneid, answerbox_t *box);
Index: kernel/generic/include/ipc/irq.h
===================================================================
--- kernel/generic/include/ipc/irq.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ipc/irq.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,5 +44,5 @@
 #include <adt/list.h>
 
-extern int ipc_irq_register(answerbox_t *, inr_t, devno_t, unative_t,
+extern int ipc_irq_register(answerbox_t *, inr_t, devno_t, sysarg_t,
     irq_code_t *);
 
@@ -75,6 +75,6 @@
 	ipc_irq_send_msg((irq), (a1), (a2), (a3), (a4), (a5))
 
-extern void ipc_irq_send_msg(irq_t *, unative_t, unative_t, unative_t, unative_t,
-    unative_t);
+extern void ipc_irq_send_msg(irq_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t);
 
 #endif
Index: kernel/generic/include/ipc/sysipc.h
===================================================================
--- kernel/generic/include/ipc/sysipc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/ipc/sysipc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,26 +40,34 @@
 #include <typedefs.h>
 
-extern unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, 
-    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data);
-extern unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
-    ipc_data_t *reply);
-extern unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method, 
-    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
-extern unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data);
-extern unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, 
-    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
-extern unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data);
-extern unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
-    unsigned int nonblocking);
-extern unative_t sys_ipc_poke(void);
-extern unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
-    unative_t method, unative_t arg1, unative_t arg2, unsigned int mode);
-extern unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
-    ipc_data_t *data, unsigned int mode);
-extern unative_t sys_ipc_hangup(unative_t phoneid);
-extern unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
-    irq_code_t *ucode);
-extern unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
-extern unative_t sys_ipc_connect_kbox(sysarg64_t *task_id);
+extern sysarg_t sys_ipc_call_sync_fast(sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, ipc_data_t *);
+extern sysarg_t sys_ipc_call_sync_slow(sysarg_t, ipc_data_t *, ipc_data_t *);
+extern sysarg_t sys_ipc_call_async_fast(sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t);
+extern sysarg_t sys_ipc_call_async_slow(sysarg_t, ipc_data_t *);
+extern sysarg_t sys_ipc_answer_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t);
+extern sysarg_t sys_ipc_answer_slow(sysarg_t, ipc_data_t *);
+extern sysarg_t sys_ipc_wait_for_call(ipc_data_t *, uint32_t, unsigned int);
+extern sysarg_t sys_ipc_poke(void);
+extern sysarg_t sys_ipc_forward_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, unsigned int);
+extern sysarg_t sys_ipc_forward_slow(sysarg_t, sysarg_t, ipc_data_t *,
+    unsigned int);
+extern sysarg_t sys_ipc_hangup(sysarg_t);
+extern sysarg_t sys_ipc_register_irq(inr_t, devno_t, sysarg_t, irq_code_t *);
+extern sysarg_t sys_ipc_unregister_irq(inr_t, devno_t);
+
+#ifdef __32_BITS__
+
+extern sysarg_t sys_ipc_connect_kbox(sysarg64_t *);
+
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+extern sysarg_t sys_ipc_connect_kbox(sysarg_t);
+
+#endif  /* __64_BITS__ */
 
 #endif
Index: kernel/generic/include/macros.h
===================================================================
--- kernel/generic/include/macros.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/macros.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -104,10 +104,10 @@
 #define STRING_ARG(arg)  #arg
 
-#define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
-#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
+#define LOWER32(arg)  (((uint64_t) (arg)) & UINT32_C(0xffffffff))
+#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & UINT32_C(0xffffffff))
 
 #define MERGE_LOUP32(lo, up) \
-	((((uint64_t) (lo)) & 0xffffffff) \
-	    | ((((uint64_t) (up)) & 0xffffffff) << 32))
+	((((uint64_t) (lo)) & UINT32_C(0xffffffff)) \
+	    | ((((uint64_t) (up)) & UINT32_C(0xffffffff)) << 32))
 
 /** Pseudorandom generator
Index: kernel/generic/include/mm/as.h
===================================================================
--- kernel/generic/include/mm/as.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/mm/as.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -303,8 +303,8 @@
 
 /* Address space area related syscalls. */
-extern unative_t sys_as_area_create(uintptr_t, size_t, unsigned int);
-extern unative_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
-extern unative_t sys_as_area_change_flags(uintptr_t, unsigned int);
-extern unative_t sys_as_area_destroy(uintptr_t);
+extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int);
+extern sysarg_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
+extern sysarg_t sys_as_area_change_flags(uintptr_t, unsigned int);
+extern sysarg_t sys_as_area_destroy(uintptr_t);
 
 /* Introspection functions. */
Index: kernel/generic/include/mm/frame.h
===================================================================
--- kernel/generic/include/mm/frame.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/mm/frame.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -144,5 +144,5 @@
 
 #define IS_BUDDY_ORDER_OK(index, order) \
-    ((~(((unative_t) -1) << (order)) & (index)) == 0)
+    ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
 #define IS_BUDDY_LEFT_BLOCK(zone, frame) \
     (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
Index: kernel/generic/include/mm/slab.h
===================================================================
--- kernel/generic/include/mm/slab.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/mm/slab.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -126,5 +126,6 @@
 extern void slab_cache_destroy(slab_cache_t *);
 
-extern void * slab_alloc(slab_cache_t *, unsigned int);
+extern void *slab_alloc(slab_cache_t *, unsigned int)
+    __attribute__((malloc));
 extern void slab_free(slab_cache_t *, void *);
 extern size_t slab_reclaim(unsigned int);
@@ -138,5 +139,6 @@
 
 /* malloc support */
-extern void *malloc(size_t, unsigned int);
+extern void *malloc(size_t, unsigned int)
+    __attribute__((malloc));
 extern void *realloc(void *, size_t, unsigned int);
 extern void free(void *);
Index: kernel/generic/include/panic.h
===================================================================
--- kernel/generic/include/panic.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/panic.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,4 +37,5 @@
 
 #include <typedefs.h>
+#include <print.h>
 
 #define panic(fmt, ...) \
@@ -62,5 +63,6 @@
 
 extern void panic_common(panic_category_t, struct istate *, int,
-    uintptr_t, const char *, ...) __attribute__ ((noreturn));
+    uintptr_t, const char *, ...) __attribute__ ((noreturn))
+    PRINTF_ATTRIBUTE(5, 6);
 
 #endif
Index: kernel/generic/include/print.h
===================================================================
--- kernel/generic/include/print.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/print.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,9 +39,22 @@
 #include <stdarg.h>
 
+#ifndef NVERIFY_PRINTF
+
+#define PRINTF_ATTRIBUTE(start, end) \
+	__attribute__((format(gnu_printf, start, end)))
+
+#else /* NVERIFY_PRINTF */
+
+#define PRINTF_ATTRIBUTE(start, end)
+
+#endif /* NVERIFY_PRINTF */
+
 #define EOF  (-1)
 
 extern int puts(const char *s);
-extern int printf(const char *fmt, ...);
-extern int snprintf(char *str, size_t size, const char *fmt, ...);
+extern int printf(const char *fmt, ...)
+    PRINTF_ATTRIBUTE(1, 2);
+extern int snprintf(char *str, size_t size, const char *fmt, ...)
+    PRINTF_ATTRIBUTE(3, 4);
 
 extern int vprintf(const char *fmt, va_list ap);
Index: kernel/generic/include/proc/program.h
===================================================================
--- kernel/generic/include/proc/program.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/proc/program.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -59,5 +59,5 @@
 extern void program_ready(program_t *);
 
-extern unative_t sys_program_spawn_loader(char *, size_t);
+extern sysarg_t sys_program_spawn_loader(char *, size_t);
 
 #endif
Index: kernel/generic/include/proc/task.h
===================================================================
--- kernel/generic/include/proc/task.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/proc/task.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -93,9 +93,4 @@
 	phone_t phones[IPC_MAX_PHONES];
 	stats_ipc_t ipc_info;   /**< IPC statistics */
-	/**
-	 * Active asynchronous messages. It is used for limiting uspace to
-	 * certain extent.
-	 */
-	atomic_t active_calls;
 	/** List of synchronous answerboxes. */
 	link_t sync_box_head;
@@ -150,6 +145,13 @@
 #endif
 
-extern unative_t sys_task_get_id(task_id_t *);
-extern unative_t sys_task_set_name(const char *, size_t);
+#ifdef __32_BITS__
+extern sysarg_t sys_task_get_id(sysarg64_t *);
+#endif
+
+#ifdef __64_BITS__
+extern sysarg_t sys_task_get_id(void);
+#endif
+
+extern sysarg_t sys_task_set_name(const char *, size_t);
 
 #endif
Index: kernel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/proc/thread.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -241,9 +241,9 @@
 
 /* Thread syscall prototypes. */
-extern unative_t sys_thread_create(uspace_arg_t *, char *, size_t,
+extern sysarg_t sys_thread_create(uspace_arg_t *, char *, size_t,
     thread_id_t *);
-extern unative_t sys_thread_exit(int);
-extern unative_t sys_thread_get_id(thread_id_t *);
-extern unative_t sys_thread_usleep(uint32_t);
+extern sysarg_t sys_thread_exit(int);
+extern sysarg_t sys_thread_get_id(thread_id_t *);
+extern sysarg_t sys_thread_usleep(uint32_t);
 
 #endif
Index: kernel/generic/include/security/cap.h
===================================================================
--- kernel/generic/include/security/cap.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/security/cap.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,5 +48,4 @@
 #define __CAP_H__
 
-#include <syscall/sysarg64.h>
 #include <typedefs.h>
 
@@ -55,5 +54,5 @@
  * privilege to/from other tasks.
  */
-#define CAP_CAP			(1<<0)
+#define CAP_CAP  (1 << 0)
 
 /**
@@ -61,5 +60,5 @@
  * to other tasks.
  */
-#define CAP_MEM_MANAGER		(1<<1)
+#define CAP_MEM_MANAGER  (1 << 1)
 
 /**
@@ -67,15 +66,26 @@
  * to other tasks.
  */
-#define CAP_IO_MANAGER		(1<<2)
+#define CAP_IO_MANAGER  (1 << 2)
 
 /**
  * CAP_IRQ_REG entitles its holder to register IRQ handlers.
  */
-#define CAP_IRQ_REG		(1<<3) 
+#define CAP_IRQ_REG  (1 << 3)
 
 typedef uint32_t cap_t;
 
-extern unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps);
-extern unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps);
+#ifdef __32_BITS__
+
+extern sysarg_t sys_cap_grant(sysarg64_t *, cap_t);
+extern sysarg_t sys_cap_revoke(sysarg64_t *, cap_t);
+
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+extern sysarg_t sys_cap_grant(sysarg_t, cap_t);
+extern sysarg_t sys_cap_revoke(sysarg_t, cap_t);
+
+#endif  /* __64_BITS__ */
 
 #endif
Index: kernel/generic/include/stdint.h
===================================================================
--- kernel/generic/include/stdint.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/stdint.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,27 +36,27 @@
 #define KERN_STDINT_H_
 
-#define INT8_MIN  (0x80)
-#define INT8_MAX  (0x7F)
+#define INT8_MIN  INT8_C(0x80)
+#define INT8_MAX  INT8_C(0x7F)
 
-#define UINT8_MIN  (0u)
-#define UINT8_MAX  (0xFFu)
+#define UINT8_MIN  UINT8_C(0)
+#define UINT8_MAX  UINT8_C(0xFF)
 
-#define INT16_MIN  (0x8000)
-#define INT16_MAX  (0x7FFF)
+#define INT16_MIN  INT16_C(0x8000)
+#define INT16_MAX  INT16_C(0x7FFF)
 
-#define UINT16_MIN  (0u)
-#define UINT16_MAX  (0xFFFFu)
+#define UINT16_MIN  UINT16_C(0)
+#define UINT16_MAX  UINT16_C(0xFFFF)
 
-#define INT32_MIN  (0x80000000l)
-#define INT32_MAX  (0x7FFFFFFFl)
+#define INT32_MIN  INT32_C(0x80000000)
+#define INT32_MAX  INT32_C(0x7FFFFFFF)
 
-#define UINT32_MIN  (0ul)
-#define UINT32_MAX  (0xFFFFFFFFul)
+#define UINT32_MIN  UINT32_C(0)
+#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
 
-#define INT64_MIN  (0x8000000000000000ll)
-#define INT64_MAX  (0x7FFFFFFFFFFFFFFFll)
+#define INT64_MIN  INT64_C(0x8000000000000000)
+#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
 
-#define UINT64_MIN  (0ull)
-#define UINT64_MAX  (0xFFFFFFFFFFFFFFFFull)
+#define UINT64_MIN  UINT64_C(0)
+#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
 
 #endif
Index: kernel/generic/include/synch/futex.h
===================================================================
--- kernel/generic/include/synch/futex.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/synch/futex.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,6 +52,6 @@
 
 extern void futex_init(void);
-extern unative_t sys_futex_sleep(uintptr_t);
-extern unative_t sys_futex_wakeup(uintptr_t);
+extern sysarg_t sys_futex_sleep(uintptr_t);
+extern sysarg_t sys_futex_wakeup(uintptr_t);
 
 extern void futex_cleanup(void);
Index: kernel/generic/include/synch/smc.h
===================================================================
--- kernel/generic/include/synch/smc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/synch/smc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,5 +36,5 @@
 #define KERN_SMC_H_
 
-extern unative_t sys_smc_coherence(uintptr_t va, size_t size);
+extern sysarg_t sys_smc_coherence(uintptr_t va, size_t size);
 
 #endif
Index: kernel/generic/include/synch/spinlock.h
===================================================================
--- kernel/generic/include/synch/spinlock.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/synch/spinlock.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -146,5 +146,5 @@
 	if ((pname)++ > (value)) { \
 		(pname) = 0; \
-		printf("Deadlock probe %s: exceeded threshold %u\n", \
+		printf("Deadlock probe %s: exceeded threshold %u\n" \
 		    "cpu%u: function=%s, line=%u\n", \
 		    #pname, (value), CPU->id, __func__, __LINE__); \
Index: rnel/generic/include/syscall/sysarg64.h
===================================================================
--- kernel/generic/include/syscall/sysarg64.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * 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 Wrapper for explicit 64-bit arguments passed to syscalls.
- */
-
-#ifndef KERN_SYSARG64_H_
-#define KERN_SYSARG64_H_
-
-typedef struct {
-	unsigned long long value;
-} sysarg64_t;
-
-#endif
-
-/** @}
- */
Index: kernel/generic/include/syscall/syscall.h
===================================================================
--- kernel/generic/include/syscall/syscall.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/syscall/syscall.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,5 +38,5 @@
 typedef enum {
 	SYS_KLOG = 0,
-	SYS_TLS_SET = 1, /* Hardcoded in AMD64, IA32 uspace - fibril.S */
+	SYS_TLS_SET = 1,  /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */
 	
 	SYS_THREAD_CREATE,
@@ -71,4 +71,5 @@
 	SYS_IPC_REGISTER_IRQ,
 	SYS_IPC_UNREGISTER_IRQ,
+	SYS_IPC_CONNECT_KBOX,
 	
 	SYS_EVENT_SUBSCRIBE,
@@ -90,5 +91,4 @@
 	SYS_DEBUG_DISABLE_CONSOLE,
 	
-	SYS_IPC_CONNECT_KBOX,
 	SYSCALL_END
 } syscall_t;
@@ -98,11 +98,11 @@
 #include <typedefs.h>
 
-typedef unative_t (*syshandler_t)(unative_t, unative_t, unative_t, unative_t,
-    unative_t, unative_t);
+typedef sysarg_t (*syshandler_t)(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t);
 
 extern syshandler_t syscall_table[SYSCALL_END];
-extern unative_t syscall_handler(unative_t, unative_t, unative_t, unative_t,
-    unative_t, unative_t, unative_t);
-extern unative_t sys_tls_set(unative_t);
+extern sysarg_t syscall_handler(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t);
+extern sysarg_t sys_tls_set(sysarg_t);
 
 #endif
Index: kernel/generic/include/sysinfo/abi.h
===================================================================
--- kernel/generic/include/sysinfo/abi.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/sysinfo/abi.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -66,5 +66,5 @@
  */
 typedef struct {
-	size_t id;               /**< CPU ID as stored by kernel */
+	unsigned int id;         /**< CPU ID as stored by kernel */
 	bool active;             /**< CPU is activate */
 	uint16_t frequency_mhz;  /**< Frequency in MHz */
Index: kernel/generic/include/sysinfo/sysinfo.h
===================================================================
--- kernel/generic/include/sysinfo/sysinfo.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/sysinfo/sysinfo.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,5 +65,5 @@
 
 /** Gerated numeric value function */
-typedef unative_t (*sysinfo_fn_val_t)(struct sysinfo_item *);
+typedef sysarg_t (*sysinfo_fn_val_t)(struct sysinfo_item *);
 
 /** Generated binary data function */
@@ -82,5 +82,5 @@
  */
 typedef union {
-	unative_t val;              /**< Constant numberic value */
+	sysarg_t val;               /**< Constant numberic value */
 	sysinfo_fn_val_t fn_val;    /**< Generated numeric value function */
 	sysinfo_fn_data_t fn_data;  /**< Generated binary data function */
@@ -99,5 +99,5 @@
 	sysinfo_item_val_type_t tag;  /**< Return value type */
 	union {
-		unative_t val;            /**< Numberic value */
+		sysarg_t val;             /**< Numberic value */
 		sysinfo_data_t data;      /**< Binary data */
 	};
@@ -130,5 +130,5 @@
 } sysinfo_item_t;
 
-extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, unative_t);
+extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, sysarg_t);
 extern void sysinfo_set_item_data(const char *, sysinfo_item_t **, void *,
     size_t);
@@ -145,8 +145,8 @@
 extern void sysinfo_dump(sysinfo_item_t *);
 
-extern unative_t sys_sysinfo_get_tag(void *, size_t);
-extern unative_t sys_sysinfo_get_value(void *, size_t, void *);
-extern unative_t sys_sysinfo_get_data_size(void *, size_t, void *);
-extern unative_t sys_sysinfo_get_data(void *, size_t, void *, size_t);
+extern sysarg_t sys_sysinfo_get_tag(void *, size_t);
+extern sysarg_t sys_sysinfo_get_value(void *, size_t, void *);
+extern sysarg_t sys_sysinfo_get_data_size(void *, size_t, void *);
+extern sysarg_t sys_sysinfo_get_data(void *, size_t, void *, size_t);
 
 #endif
Index: kernel/generic/include/time/clock.h
===================================================================
--- kernel/generic/include/time/clock.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/time/clock.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -42,7 +42,7 @@
 /** Uptime structure */
 typedef struct {
-	unative_t seconds1;
-	unative_t useconds;
-	unative_t seconds2;
+	sysarg_t seconds1;
+	sysarg_t useconds;
+	sysarg_t seconds2;
 } uptime_t;
 
Index: kernel/generic/include/typedefs.h
===================================================================
--- kernel/generic/include/typedefs.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/typedefs.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,5 +40,5 @@
 #include <arch/types.h>
 
-#define NULL  0UL
+#define NULL  ((void *) 0)
 
 #define false  0
@@ -69,9 +69,14 @@
 typedef int32_t devno_t;
 
-typedef int32_t wchar_t;
-
 typedef volatile uint8_t ioport8_t;
 typedef volatile uint16_t ioport16_t;
 typedef volatile uint32_t ioport32_t;
+
+#ifdef __32_BITS__
+
+/** Explicit 64-bit arguments passed to syscalls. */
+typedef uint64_t sysarg64_t;
+
+#endif /* __32_BITS__ */
 
 #endif
Index: kernel/generic/include/udebug/udebug.h
===================================================================
--- kernel/generic/include/udebug/udebug.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/udebug/udebug.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -212,5 +212,5 @@
 	waitq_t go_wq;
 	call_t *go_call;
-	unative_t syscall_args[6];
+	sysarg_t syscall_args[6];
 	istate_t *uspace_state;
 
@@ -229,6 +229,6 @@
 void udebug_thread_initialize(udebug_thread_t *ut);
 
-void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
-    unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc,
+void udebug_syscall_event(sysarg_t a1, sysarg_t a2, sysarg_t a3,
+    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id, sysarg_t rc,
     bool end_variant);
 
Index: kernel/generic/include/udebug/udebug_ops.h
===================================================================
--- kernel/generic/include/udebug/udebug_ops.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/include/udebug/udebug_ops.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,5 +52,5 @@
 int udebug_regs_read(thread_t *t, void **buffer);
 
-int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer);
+int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer);
 
 #endif
Index: kernel/generic/src/adt/btree.c
===================================================================
--- kernel/generic/src/adt/btree.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/adt/btree.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -888,4 +888,7 @@
 		*leaf_node = cur;
 		
+		if (cur->keys == 0)
+			return NULL;
+
 		/*
 		 * The key can be in the leftmost subtree.
@@ -926,5 +929,5 @@
 				return key == cur->key[i - 1] ? val : NULL;
 		}
-		descend:
+descend:
 		;
 	}
Index: kernel/generic/src/adt/hash_table.c
===================================================================
--- kernel/generic/src/adt/hash_table.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/adt/hash_table.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -82,5 +82,5 @@
  * @param item Item to be inserted into the hash table.
  */
-void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item)
+void hash_table_insert(hash_table_t *h, sysarg_t key[], link_t *item)
 {
 	size_t chain;
@@ -105,5 +105,5 @@
  * @return Matching item on success, NULL if there is no such item.
  */
-link_t *hash_table_find(hash_table_t *h, unative_t key[])
+link_t *hash_table_find(hash_table_t *h, sysarg_t key[])
 {
 	link_t *cur;
@@ -138,5 +138,5 @@
  * @param keys Number of keys in the key array.
  */
-void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys)
+void hash_table_remove(hash_table_t *h, sysarg_t key[], size_t keys)
 {
 	size_t chain;
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/console/cmd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -554,4 +554,10 @@
 	}
 	
+	unsigned int _len = (unsigned int) len;
+	if ((_len != len) || (((int) _len) < 0)) {
+		printf("Command length overflow\n");
+		return 1;
+	}
+	
 	for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
 		cmd_info_t *hlp;
@@ -559,5 +565,5 @@
 		
 		spinlock_lock(&hlp->lock);
-		printf("%-*s %s\n", len, hlp->name, hlp->description);
+		printf("%-*s %s\n", _len, hlp->name, hlp->description);
 		spinlock_unlock(&hlp->lock);
 	}
@@ -595,5 +601,5 @@
 	
 	/* This doesn't have to be very accurate */
-	unative_t sec = uptime->seconds1;
+	sysarg_t sec = uptime->seconds1;
 	
 	printf("Up %" PRIun " days, %" PRIun " hours, %" PRIun " minutes, %" PRIun " seconds\n",
@@ -650,5 +656,5 @@
 	uintptr_t symaddr;
 	char *symbol;
-	unative_t (*fnc)(void);
+	sysarg_t (*fnc)(void);
 	fncptr_t fptr;
 	int rc;
@@ -666,7 +672,7 @@
 
 		ipl = interrupts_disable();
-		fnc = (unative_t (*)(void)) arch_construct_function(&fptr,
+		fnc = (sysarg_t (*)(void)) arch_construct_function(&fptr,
 		    (void *) symaddr, (void *) cmd_call0);
-		printf("Calling %s() (%p)\n", symbol, symaddr);
+		printf("Calling %s() (%p)\n", symbol, (void *) symaddr);
 		printf("Result: %#" PRIxn "\n", fnc());
 		interrupts_restore(ipl);
@@ -685,5 +691,5 @@
 	 */
 	
-	size_t i;
+	unsigned int i;
 	for (i = 0; i < config.cpu_count; i++) {
 		if (!cpus[i].active)
@@ -697,5 +703,5 @@
 			irq_spinlock_unlock(&thread->lock, true);
 			
-			printf("cpu%" PRIs ": ", i);
+			printf("cpu%u: ", i);
 			
 			thread_ready(thread);
@@ -703,5 +709,5 @@
 			thread_detach(thread);
 		} else
-			printf("Unable to create thread for cpu%" PRIs "\n", i);
+			printf("Unable to create thread for cpu%u\n", i);
 	}
 	
@@ -714,6 +720,6 @@
 	uintptr_t symaddr;
 	char *symbol;
-	unative_t (*fnc)(unative_t, ...);
-	unative_t arg1 = argv[1].intval;
+	sysarg_t (*fnc)(sysarg_t, ...);
+	sysarg_t arg1 = argv[1].intval;
 	fncptr_t fptr;
 	int rc;
@@ -731,6 +737,9 @@
 
 		ipl = interrupts_disable();
-		fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1);
-		printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
+		fnc = (sysarg_t (*)(sysarg_t, ...))
+		    arch_construct_function(&fptr, (void *) symaddr,
+		    (void *) cmd_call1);
+		printf("Calling f(%#" PRIxn "): %p: %s\n", arg1,
+		    (void *) symaddr, symbol);
 		printf("Result: %#" PRIxn "\n", fnc(arg1));
 		interrupts_restore(ipl);
@@ -747,7 +756,7 @@
 	uintptr_t symaddr;
 	char *symbol;
-	unative_t (*fnc)(unative_t, unative_t, ...);
-	unative_t arg1 = argv[1].intval;
-	unative_t arg2 = argv[2].intval;
+	sysarg_t (*fnc)(sysarg_t, sysarg_t, ...);
+	sysarg_t arg1 = argv[1].intval;
+	sysarg_t arg2 = argv[2].intval;
 	fncptr_t fptr;
 	int rc;
@@ -765,7 +774,9 @@
 
 		ipl = interrupts_disable();
-		fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2);
+		fnc = (sysarg_t (*)(sysarg_t, sysarg_t, ...))
+		    arch_construct_function(&fptr, (void *) symaddr,
+		    (void *) cmd_call2);
 		printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n", 
-		       arg1, arg2, symaddr, symbol);
+		       arg1, arg2, (void *) symaddr, symbol);
 		printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
 		interrupts_restore(ipl);
@@ -781,8 +792,8 @@
 	uintptr_t symaddr;
 	char *symbol;
-	unative_t (*fnc)(unative_t, unative_t, unative_t, ...);
-	unative_t arg1 = argv[1].intval;
-	unative_t arg2 = argv[2].intval;
-	unative_t arg3 = argv[3].intval;
+	sysarg_t (*fnc)(sysarg_t, sysarg_t, sysarg_t, ...);
+	sysarg_t arg1 = argv[1].intval;
+	sysarg_t arg2 = argv[2].intval;
+	sysarg_t arg3 = argv[3].intval;
 	fncptr_t fptr;
 	int rc;
@@ -800,7 +811,9 @@
 
 		ipl = interrupts_disable();
-		fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3);
-		printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n", 
-		       arg1, arg2, arg3, symaddr, symbol);
+		fnc = (sysarg_t (*)(sysarg_t, sysarg_t, sysarg_t, ...))
+		    arch_construct_function(&fptr, (void *) symaddr,
+		    (void *) cmd_call3);
+		printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
+		       arg1, arg2, arg3, (void *) symaddr, symbol);
 		printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
 		interrupts_restore(ipl);
@@ -875,5 +888,5 @@
 	
 	if (rc == ENOENT)
-		printf("Symbol %s not found.\n", argv->buffer);
+		printf("Symbol %s not found.\n", (char *) argv->buffer);
 	else if (rc == EINVAL)
 		printf("Invalid address.\n");
@@ -884,5 +897,5 @@
 		if (pointer)
 			addr = *(uintptr_t *) addr;
-		printf("Writing %#" PRIx64 " -> %p\n", arg1, addr);
+		printf("Writing %#" PRIx32" -> %p\n", arg1, (void *) addr);
 		*(uint32_t *) addr = arg1;
 	} else
@@ -1172,8 +1185,15 @@
 	}
 	
+	unsigned int _len = (unsigned int) len;
+	if ((_len != len) || (((int) _len) < 0)) {
+		printf("Command length overflow\n");
+		return;
+	}
+	
 	for (test = tests; test->name != NULL; test++)
-		printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)"));
-	
-	printf("%-*s Run all safe tests\n", len, "*");
+		printf("%-*s %s%s\n", _len, test->name, test->desc,
+		    (test->safe ? "" : " (unsafe)"));
+	
+	printf("%-*s Run all safe tests\n", _len, "*");
 }
 
Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/console/console.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -162,5 +162,5 @@
 	ddi_parea_register(&klog_parea);
 	
-	sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
+	sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr);
 	sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
 	
@@ -193,5 +193,5 @@
 
 /** Tell kernel to get keyboard/console access again */
-unative_t sys_debug_enable_console(void)
+sysarg_t sys_debug_enable_console(void)
 {
 #ifdef CONFIG_KCONSOLE
@@ -204,5 +204,5 @@
 
 /** Tell kernel to relinquish keyboard/console access */
-unative_t sys_debug_disable_console(void)
+sysarg_t sys_debug_disable_console(void)
 {
 	release_console();
@@ -333,5 +333,5 @@
  *
  */
-unative_t sys_klog(int fd, const void *buf, size_t size)
+sysarg_t sys_klog(int fd, const void *buf, size_t size)
 {
 	char *data;
@@ -339,15 +339,15 @@
 	
 	if (size > PAGE_SIZE)
-		return (unative_t) ELIMIT;
+		return (sysarg_t) ELIMIT;
 	
 	if (size > 0) {
 		data = (char *) malloc(size + 1, 0);
 		if (!data)
-			return (unative_t) ENOMEM;
+			return (sysarg_t) ENOMEM;
 		
 		rc = copy_from_uspace(data, buf, size);
 		if (rc) {
 			free(data);
-			return (unative_t) rc;
+			return (sysarg_t) rc;
 		}
 		data[size] = 0;
Index: kernel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/console/kconsole.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -426,5 +426,5 @@
 
 NO_TRACE static bool parse_int_arg(const char *text, size_t len,
-    unative_t *result)
+    sysarg_t *result)
 {
 	bool isaddr = false;
@@ -461,9 +461,9 @@
 		case EOK:
 			if (isaddr)
-				*result = (unative_t) symaddr;
+				*result = (sysarg_t) symaddr;
 			else if (isptr)
-				*result = **((unative_t **) symaddr);
+				*result = **((sysarg_t **) symaddr);
 			else
-				*result = *((unative_t *) symaddr);
+				*result = *((sysarg_t *) symaddr);
 			break;
 		default:
@@ -483,7 +483,7 @@
 			return false;
 		case EOK:
-			*result = (unative_t) value;
+			*result = (sysarg_t) value;
 			if (isptr)
-				*result = *((unative_t *) *result);
+				*result = *((sysarg_t *) *result);
 			break;
 		default:
@@ -629,5 +629,5 @@
 					    cmdline + start + 1,
 					    (end - start) - 1);
-					cmd->argv[i].intval = (unative_t) buf;
+					cmd->argv[i].intval = (sysarg_t) buf;
 					cmd->argv[i].vartype = ARG_TYPE_STRING;
 				} else {
Index: kernel/generic/src/cpu/cpu.c
===================================================================
--- kernel/generic/src/cpu/cpu.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/cpu/cpu.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -107,5 +107,5 @@
 void cpu_list(void)
 {
-	size_t i;
+	unsigned int i;
 	
 	for (i = 0; i < config.cpu_count; i++) {
Index: kernel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ddi/ddi.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -232,8 +232,8 @@
  *
  */
-unative_t sys_physmem_map(unative_t phys_base, unative_t virt_base,
-    unative_t pages, unative_t flags)
-{
-	return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
+sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base,
+    sysarg_t pages, sysarg_t flags)
+{
+	return (sysarg_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
 	    FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
 	    (size_t) pages, (int) flags);
@@ -247,12 +247,12 @@
  *
  */
-unative_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
+sysarg_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
 {
 	ddi_ioarg_t arg;
 	int rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
 	if (rc != 0)
-		return (unative_t) rc;
-	
-	return (unative_t) ddi_iospace_enable((task_id_t) arg.task_id,
+		return (sysarg_t) rc;
+	
+	return (sysarg_t) ddi_iospace_enable((task_id_t) arg.task_id,
 	    (uintptr_t) arg.ioaddr, (size_t) arg.size);
 }
@@ -265,5 +265,5 @@
  * @retutn Zero on success, error code otherwise.
  */
-unative_t sys_interrupt_enable(int irq, int enable)
+sysarg_t sys_interrupt_enable(int irq, int enable)
 {
 /* FIXME: this needs to be generic code, or better not be in kernel at all. */
Index: kernel/generic/src/ddi/device.c
===================================================================
--- kernel/generic/src/ddi/device.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ddi/device.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -54,7 +54,7 @@
 }
 
-unative_t sys_device_assign_devno(void)
+sysarg_t sys_device_assign_devno(void)
 {
-	return (unative_t) device_assign_devno();
+	return (sysarg_t) device_assign_devno();
 }
 
Index: kernel/generic/src/ddi/irq.c
===================================================================
--- kernel/generic/src/ddi/irq.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ddi/irq.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -106,6 +106,6 @@
  *
  */
-static size_t irq_ht_hash(unative_t *key);
-static bool irq_ht_compare(unative_t *key, size_t keys, link_t *item);
+static size_t irq_ht_hash(sysarg_t *key);
+static bool irq_ht_compare(sysarg_t *key, size_t keys, link_t *item);
 static void irq_ht_remove(link_t *item);
 
@@ -123,6 +123,6 @@
  *
  */
-static size_t irq_lin_hash(unative_t *key);
-static bool irq_lin_compare(unative_t *key, size_t keys, link_t *item);
+static size_t irq_lin_hash(sysarg_t *key);
+static bool irq_lin_compare(sysarg_t *key, size_t keys, link_t *item);
 static void irq_lin_remove(link_t *item);
 
@@ -136,4 +136,7 @@
 static size_t buckets;
 
+/** Last valid INR. */
+inr_t last_inr = 0;
+
 /** Initialize IRQ subsystem.
  *
@@ -145,4 +148,6 @@
 {
 	buckets = chains;
+	last_inr = inrs - 1;
+
 	/*
 	 * Be smart about the choice of the hash table operations.
@@ -194,7 +199,7 @@
 void irq_register(irq_t *irq)
 {
-	unative_t key[] = {
-		(unative_t) irq->inr,
-		(unative_t) irq->devno
+	sysarg_t key[] = {
+		(sysarg_t) irq->inr,
+		(sysarg_t) irq->devno
 	};
 	
@@ -212,7 +217,7 @@
 {
 	link_t *lnk;
-	unative_t key[] = {
-		(unative_t) inr,
-		(unative_t) -1    /* Search will use claim() instead of devno */
+	sysarg_t key[] = {
+		(sysarg_t) inr,
+		(sysarg_t) -1    /* Search will use claim() instead of devno */
 	};
 	
@@ -235,7 +240,7 @@
 {
 	link_t *lnk;
-	unative_t key[] = {
-		(unative_t) inr,
-		(unative_t) -1    /* Search will use claim() instead of devno */
+	sysarg_t key[] = {
+		(sysarg_t) inr,
+		(sysarg_t) -1    /* Search will use claim() instead of devno */
 	};
 	
@@ -306,5 +311,5 @@
  *
  */
-size_t irq_ht_hash(unative_t key[])
+size_t irq_ht_hash(sysarg_t key[])
 {
 	inr_t inr = (inr_t) key[KEY_INR];
@@ -333,5 +338,5 @@
  *
  */
-bool irq_ht_compare(unative_t key[], size_t keys, link_t *item)
+bool irq_ht_compare(sysarg_t key[], size_t keys, link_t *item)
 {
 	irq_t *irq = hash_table_get_instance(item, irq_t, link);
@@ -381,5 +386,5 @@
  *
  */
-size_t irq_lin_hash(unative_t key[])
+size_t irq_lin_hash(sysarg_t key[])
 {
 	inr_t inr = (inr_t) key[KEY_INR];
@@ -408,5 +413,5 @@
  *
  */
-bool irq_lin_compare(unative_t key[], size_t keys, link_t *item)
+bool irq_lin_compare(sysarg_t key[], size_t keys, link_t *item)
 {
 	irq_t *irq = list_get_instance(item, irq_t, link);
Index: kernel/generic/src/debug/debug.c
===================================================================
--- kernel/generic/src/debug/debug.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/debug/debug.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,8 +52,8 @@
 	if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
 	    &call_site_off) == EOK)
-		printf("%s+%" PRIp "->%s\n", call_site_sym, call_site_off,
-		    fn_sym);
+		printf("%s()+%p->%s()\n", call_site_sym,
+		    (void *) call_site_off, fn_sym);
 	else
-		printf("->%s\n", fn_sym);
+		printf("->%s()\n", fn_sym);
 }
 
@@ -67,8 +67,8 @@
 	if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
 	    &call_site_off) == EOK)
-		printf("%s+%" PRIp "<-%s\n", call_site_sym, call_site_off,
-		    fn_sym);
+		printf("%s()+%p<-%s()\n", call_site_sym,
+		    (void *) call_site_off, fn_sym);
 	else
-		printf("<-%s\n", fn_sym);
+		printf("<-%s()\n", fn_sym);
 }
 
Index: kernel/generic/src/debug/panic.c
===================================================================
--- kernel/generic/src/debug/panic.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/debug/panic.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -42,23 +42,27 @@
 #include <interrupt.h>
 
+#define BANNER_LEFT   "######>"
+#define BANNER_RIGHT  "<######"
+
 void panic_common(panic_category_t cat, istate_t *istate, int access,
     uintptr_t address, const char *fmt, ...)
 {
 	va_list args;
-
+	
 	silent = false;
-
-	printf("\nKERNEL PANIC ");
+	
+	printf("\n%s Kernel panic ", BANNER_LEFT);
 	if (CPU)
-		printf("ON cpu%d ", CPU->id);
-	printf("DUE TO ");
-
+		printf("on cpu%u ", CPU->id);
+	printf("due to ");
+	
 	va_start(args, fmt);
 	if (cat == PANIC_ASSERT) {
-		printf("A FAILED ASSERTION:\n");
+		printf("a failed assertion: %s\n", BANNER_RIGHT);
 		vprintf(fmt, args);
 		printf("\n");
 	} else if (cat == PANIC_BADTRAP) {
-		printf("BAD TRAP %ld.\n", address);
+		printf("bad trap %" PRIun ". %s\n", address,
+		    BANNER_RIGHT);
 		if (fmt) {
 			vprintf(fmt, args);
@@ -66,14 +70,15 @@
 		}
 	} else if (cat == PANIC_MEMTRAP) {
-		printf("A BAD MEMORY ACCESS WHILE ");
+		printf("a bad memory access while ");
 		if (access == PF_ACCESS_READ)
-			printf("LOADING FROM");
+			printf("loading from");
 		else if (access == PF_ACCESS_WRITE)
-			printf("STORING TO");
+			printf("storing to");
 		else if (access == PF_ACCESS_EXEC)
-			printf("BRANCHING TO");
+			printf("branching to");
 		else
-			printf("REFERENCING");
-		printf(" ADDRESS %p.\n", address); 
+			printf("referencing");
+		printf(" address %p. %s\n", (void *) address,
+		    BANNER_RIGHT);
 		if (fmt) {
 			vprintf(fmt, args);
@@ -81,17 +86,18 @@
 		}
 	} else {
-		printf("THE FOLLOWING REASON:\n");
+		printf("the following reason: %s\n",
+		    BANNER_RIGHT);
 		vprintf(fmt, args);
 		printf("\n");
 	}
 	va_end(args);
-
+	
 	printf("\n");
-
+	
 	if (istate) {
 		istate_decode(istate);
 		printf("\n");
 	}
-
+	
 	stack_trace();
 	halt();
Index: kernel/generic/src/debug/stacktrace.c
===================================================================
--- kernel/generic/src/debug/stacktrace.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/debug/stacktrace.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,6 +41,5 @@
 #define STACK_FRAMES_MAX	20
 
-void
-stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
+void stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
 {
 	int cnt = 0;
@@ -54,17 +53,18 @@
 		if (ops->symbol_resolve &&
 		    ops->symbol_resolve(ctx->pc, &symbol, &offset)) {
-		    	if (offset)
-				printf("%p: %s+%" PRIp "()\n",
-				    ctx->fp, symbol, offset);
+			if (offset)
+				printf("%p: %s()+%p\n", (void *) ctx->fp,
+				    symbol, (void *) offset);
 			else
-				printf("%p: %s()\n",
-				    ctx->fp, symbol);
-		} else {
-			printf("%p: %p()\n", ctx->fp, ctx->pc);
-		}
+				printf("%p: %s()\n", (void *) ctx->fp, symbol);
+		} else
+			printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc);
+		
 		if (!ops->return_address_get(ctx, &pc))
 			break;
+		
 		if (!ops->frame_pointer_prev(ctx, &fp))
 			break;
+		
 		ctx->fp = fp;
 		ctx->pc = pc;
Index: kernel/generic/src/debug/symtab.c
===================================================================
--- kernel/generic/src/debug/symtab.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/debug/symtab.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -192,5 +192,5 @@
 		uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
 		char *realname = symbol_table[pos].symbol_name;
-		printf("%p: %s\n", addr, realname);
+		printf("%p: %s\n", (void *) addr, realname);
 		pos++;
 	}
Index: kernel/generic/src/interrupt/interrupt.c
===================================================================
--- kernel/generic/src/interrupt/interrupt.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/interrupt/interrupt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -176,5 +176,5 @@
 	printf("Task %s (%" PRIu64 ") killed due to an exception at "
 	    "program counter %p.\n", TASK->name, TASK->taskid,
-	    istate_get_pc(istate));
+	    (void *) istate_get_pc(istate));
 	
 	stack_trace_istate(istate);
@@ -197,5 +197,5 @@
 		/* Notify the subscriber that a fault occurred. */
 		event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid),
-		    UPPER32(TASK->taskid), (unative_t) THREAD);
+		    UPPER32(TASK->taskid), (sysarg_t) THREAD);
 		
 #ifdef CONFIG_UDEBUG
@@ -263,5 +263,5 @@
 		
 		const char *symbol =
-		    symtab_fmt_name_lookup((unative_t) exc_table[i].handler);
+		    symtab_fmt_name_lookup((sysarg_t) exc_table[i].handler);
 		
 #ifdef __32_BITS__
Index: kernel/generic/src/ipc/event.c
===================================================================
--- kernel/generic/src/ipc/event.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ipc/event.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,9 +57,9 @@
 		events[i].answerbox = NULL;
 		events[i].counter = 0;
-		events[i].method = 0;
+		events[i].imethod = 0;
 	}
 }
 
-static int event_subscribe(event_type_t evno, unative_t method,
+static int event_subscribe(event_type_t evno, sysarg_t imethod,
     answerbox_t *answerbox)
 {
@@ -73,5 +73,5 @@
 	if (events[evno].answerbox == NULL) {
 		events[evno].answerbox = answerbox;
-		events[evno].method = method;
+		events[evno].imethod = imethod;
 		events[evno].counter = 0;
 		res = EOK;
@@ -84,8 +84,8 @@
 }
 
-unative_t sys_event_subscribe(unative_t evno, unative_t method)
+sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t imethod)
 {
-	return (unative_t) event_subscribe((event_type_t) evno, (unative_t)
-	    method, &TASK->answerbox);
+	return (sysarg_t) event_subscribe((event_type_t) evno, (sysarg_t)
+	    imethod, &TASK->answerbox);
 }
 
@@ -113,5 +113,5 @@
 			events[i].answerbox = NULL;
 			events[i].counter = 0;
-			events[i].method = 0;
+			events[i].imethod = 0;
 		}
 		spinlock_unlock(&events[i].lock);
@@ -119,6 +119,6 @@
 }
 
-void event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
-    unative_t a4, unative_t a5)
+void event_notify(event_type_t evno, sysarg_t a1, sysarg_t a2, sysarg_t a3,
+    sysarg_t a4, sysarg_t a5)
 {
 	ASSERT(evno < EVENT_END);
@@ -130,5 +130,5 @@
 			call->flags |= IPC_CALL_NOTIF;
 			call->priv = ++events[evno].counter;
-			IPC_SET_METHOD(call->data, events[evno].method);
+			IPC_SET_IMETHOD(call->data, events[evno].imethod);
 			IPC_SET_ARG1(call->data, a1);
 			IPC_SET_ARG2(call->data, a2);
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ipc/ipc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -270,5 +270,5 @@
  *
  */
-void ipc_backsend_err(phone_t *phone, call_t *call, unative_t err)
+void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
 {
 	call->data.phone = phone;
@@ -367,5 +367,5 @@
 		
 		call_t *call = ipc_call_alloc(0);
-		IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP);
+		IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
 		call->flags |= IPC_CALL_DISCARD_ANSWER;
 		_ipc_call(phone, box, call);
@@ -547,5 +547,5 @@
 			 * disconnected.
 			 */
-			IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP);
+			IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
 			call->flags |= IPC_CALL_DISCARD_ANSWER;
 			_ipc_call(phone, box, call);
@@ -655,12 +655,4 @@
 		    (call->flags & IPC_CALL_NOTIF));
 		
-		/*
-		 * Record the receipt of this call in the current task's counter
-		 * of active calls. IPC_M_PHONE_HUNGUP calls do not contribute
-		 * to this counter so do not record answers to them either.
-		 */
-		if (!(call->flags & IPC_CALL_DISCARD_ANSWER))
-			atomic_dec(&TASK->active_calls);
-		
 		ipc_call_free(call);
 	}
@@ -702,10 +694,10 @@
 	for (i = 0; i < IPC_MAX_PHONES; i++) {
 		if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) {
-			printf("%d: mutex busy\n", i);
+			printf("%zu: mutex busy\n", i);
 			continue;
 		}
 		
 		if (task->phones[i].state != IPC_PHONE_FREE) {
-			printf("%" PRIs ": ", i);
+			printf("%zu: ", i);
 			
 			switch (task->phones[i].state) {
@@ -749,5 +741,5 @@
 		    " A4:%" PRIun " A5:%" PRIun " Flags:%x\n", call,
 		    call->sender->taskid,
-		    IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
+		    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
 		    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
 		    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
@@ -765,5 +757,5 @@
 		    " A4:%" PRIun " A5:%" PRIun " Flags:%x\n", call,
 		    call->sender->taskid,
-		    IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
+		    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
 		    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
 		    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
@@ -779,5 +771,5 @@
 		printf("Callid:%p M:%" PRIun " A1:%" PRIun " A2:%" PRIun
 		    " A3:%" PRIun " A4:%" PRIun " A5:%" PRIun " Flags:%x\n",
-		    call, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
+		    call, IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
 		    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
 		    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
Index: kernel/generic/src/ipc/ipcrsc.c
===================================================================
--- kernel/generic/src/ipc/ipcrsc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ipc/ipcrsc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -144,5 +144,5 @@
  *
  */
-call_t *get_call(unative_t callid)
+call_t *get_call(sysarg_t callid)
 {
 	link_t *lst;
@@ -153,5 +153,5 @@
 	    lst != &TASK->answerbox.dispatched_calls; lst = lst->next) {
 		call_t *call = list_get_instance(lst, call_t, link);
-		if ((unative_t) call == callid) {
+		if ((sysarg_t) call == callid) {
 			result = call;
 			break;
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ipc/irq.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -42,5 +42,6 @@
  *
  * The structure of a notification message is as follows:
- * - METHOD: method as registered by the SYS_IPC_REGISTER_IRQ syscall
+ * - IMETHOD: interface and method as registered by the SYS_IPC_REGISTER_IRQ
+ *            syscall
  * - ARG1: payload modified by a 'top-half' handler
  * - ARG2: payload modified by a 'top-half' handler
@@ -49,5 +50,5 @@
  * - ARG5: payload modified by a 'top-half' handler
  * - in_phone_hash: interrupt counter (may be needed to assure correct order
- *         in multithreaded drivers)
+ *                  in multithreaded drivers)
  *
  * Note on synchronization for ipc_irq_register(), ipc_irq_unregister(),
@@ -130,20 +131,23 @@
 /** Register an answerbox as a receiving end for IRQ notifications.
  *
- * @param box    Receiving answerbox.
- * @param inr    IRQ number.
- * @param devno  Device number.
- * @param method Method to be associated with the notification.
- * @param ucode  Uspace pointer to top-half pseudocode.
- *
- * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
+ * @param box		Receiving answerbox.
+ * @param inr		IRQ number.
+ * @param devno		Device number.
+ * @param imethod	Interface and method to be associated with the
+ *			notification.
+ * @param ucode		Uspace pointer to top-half pseudocode.
+ * @return		EOK on success or a negative error code.
  *
  */
 int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno,
-    unative_t method, irq_code_t *ucode)
-{
-	unative_t key[] = {
-		(unative_t) inr,
-		(unative_t) devno
+    sysarg_t imethod, irq_code_t *ucode)
+{
+	sysarg_t key[] = {
+		(sysarg_t) inr,
+		(sysarg_t) devno
 	};
+
+	if ((inr < 0) || (inr > last_inr))
+		return ELIMIT;
 	
 	irq_code_t *code;
@@ -167,5 +171,5 @@
 	irq->notif_cfg.notify = true;
 	irq->notif_cfg.answerbox = box;
-	irq->notif_cfg.method = method;
+	irq->notif_cfg.imethod = imethod;
 	irq->notif_cfg.code = code;
 	irq->notif_cfg.counter = 0;
@@ -206,15 +210,18 @@
 /** Unregister task from IRQ notification.
  *
- * @param box   Answerbox associated with the notification.
- * @param inr   IRQ number.
- * @param devno Device number.
- *
+ * @param box		Answerbox associated with the notification.
+ * @param inr		IRQ number.
+ * @param devno		Device number.
+ * @return		EOK on success or a negative error code.
  */
 int ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno)
 {
-	unative_t key[] = {
-		(unative_t) inr,
-		(unative_t) devno
+	sysarg_t key[] = {
+		(sysarg_t) inr,
+		(sysarg_t) devno
 	};
+
+	if ((inr < 0) || (inr > last_inr))
+		return ELIMIT;
 	
 	irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
@@ -290,5 +297,5 @@
 		}
 		
-		unative_t key[2];
+		sysarg_t key[2];
 		key[0] = irq->inr;
 		key[1] = irq->devno;
@@ -444,5 +451,5 @@
 		
 		/* Set up args */
-		IPC_SET_METHOD(call->data, irq->notif_cfg.method);
+		IPC_SET_IMETHOD(call->data, irq->notif_cfg.imethod);
 		IPC_SET_ARG1(call->data, irq->notif_cfg.scratch[1]);
 		IPC_SET_ARG2(call->data, irq->notif_cfg.scratch[2]);
@@ -465,6 +472,6 @@
  *
  */
-void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3,
-    unative_t a4, unative_t a5)
+void ipc_irq_send_msg(irq_t *irq, sysarg_t a1, sysarg_t a2, sysarg_t a3,
+    sysarg_t a4, sysarg_t a5)
 {
 	irq_spinlock_lock(&irq->lock, true);
@@ -481,5 +488,5 @@
 		call->priv = ++irq->notif_cfg.counter;
 		
-		IPC_SET_METHOD(call->data, irq->notif_cfg.method);
+		IPC_SET_IMETHOD(call->data, irq->notif_cfg.imethod);
 		IPC_SET_ARG1(call->data, a1);
 		IPC_SET_ARG2(call->data, a2);
Index: kernel/generic/src/ipc/kbox.c
===================================================================
--- kernel/generic/src/ipc/kbox.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ipc/kbox.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -167,5 +167,5 @@
 			continue;  /* Try again. */
 		
-		switch (IPC_GET_METHOD(call->data)) {
+		switch (IPC_GET_IMETHOD(call->data)) {
 		
 		case IPC_M_DEBUG_ALL:
@@ -192,5 +192,4 @@
 }
 
-
 /** Connect phone to a task kernel-box specified by id.
  *
Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/ipc/sysipc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,4 +49,5 @@
 #include <syscall/copy.h>
 #include <security/cap.h>
+#include <console/console.h>
 #include <mm/as.h>
 #include <print.h>
@@ -68,5 +69,5 @@
  *
  */
-static int phone_get(unative_t phoneid, phone_t **phone)
+static int phone_get(sysarg_t phoneid, phone_t **phone)
 {
 	if (phoneid >= IPC_MAX_PHONES)
@@ -77,14 +78,15 @@
 }
 
-/** Decide if the method is a system method.
- *
- * @param method Method to be decided.
- *
- * @return true if the method is a system method.
- *
- */
-static inline bool method_is_system(unative_t method)
-{
-	if (method <= IPC_M_LAST_SYSTEM)
+/** Decide if the interface and method is a system method.
+ *
+ * @param imethod Interface and method to be decided.
+ *
+ * @return True if the interface and method is a system
+ *         interface and method.
+ *
+ */
+static inline bool method_is_system(sysarg_t imethod)
+{
+	if (imethod <= IPC_M_LAST_SYSTEM)
 		return true;
 	
@@ -92,17 +94,17 @@
 }
 
-/** Decide if the message with this method is forwardable.
- *
- * - some system messages may be forwarded, for some of them
- *   it is useless
- *
- * @param method Method to be decided.
- *
- * @return true if the method is forwardable.
- *
- */
-static inline bool method_is_forwardable(unative_t method)
-{
-	switch (method) {
+/** Decide if the message with this interface and method is forwardable.
+ *
+ * Some system messages may be forwarded, for some of them
+ * it is useless.
+ *
+ * @param imethod Interface and method to be decided.
+ *
+ * @return True if the interface and method is forwardable.
+ *
+ */
+static inline bool method_is_forwardable(sysarg_t imethod)
+{
+	switch (imethod) {
 	case IPC_M_CONNECTION_CLONE:
 	case IPC_M_CONNECT_ME:
@@ -115,16 +117,16 @@
 }
 
-/** Decide if the message with this method is immutable on forward.
- *
- * - some system messages may be forwarded but their content cannot be altered
- *
- * @param method Method to be decided.
- *
- * @return true if the method is immutable on forward.
- *
- */
-static inline bool method_is_immutable(unative_t method)
-{
-	switch (method) {
+/** Decide if the message with this interface and method is immutable on forward.
+ *
+ * Some system messages may be forwarded but their content cannot be altered.
+ *
+ * @param imethod Interface and method to be decided.
+ *
+ * @return True if the interface and method is immutable on forward.
+ *
+ */
+static inline bool method_is_immutable(sysarg_t imethod)
+{
+	switch (imethod) {
 	case IPC_M_SHARE_OUT:
 	case IPC_M_SHARE_IN:
@@ -152,5 +154,5 @@
 static inline bool answer_need_old(call_t *call)
 {
-	switch (IPC_GET_METHOD(call->data)) {
+	switch (IPC_GET_IMETHOD(call->data)) {
 	case IPC_M_CONNECTION_CLONE:
 	case IPC_M_CONNECT_ME:
@@ -196,5 +198,5 @@
 		return 0;
 	
-	if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
+	if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
 		int phoneid = IPC_GET_ARG1(*olddata);
 		phone_t *phone = &TASK->phones[phoneid];
@@ -218,5 +220,5 @@
 			mutex_unlock(&phone->lock);
 		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME) {
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME) {
 		phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata);
 		
@@ -237,5 +239,5 @@
 			mutex_unlock(&phone->lock);
 		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
 		int phoneid = IPC_GET_ARG5(*olddata);
 		
@@ -248,7 +250,7 @@
 			/* Set 'phone hash' as arg5 of response */
 			IPC_SET_ARG5(answer->data,
-			    (unative_t) &TASK->phones[phoneid]);
-		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
+			    (sysarg_t) &TASK->phones[phoneid]);
+		}
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
 		/* If the users accepted call, connect */
 		if (IPC_GET_RETVAL(answer->data) == EOK) {
@@ -256,5 +258,5 @@
 			    &TASK->answerbox);
 		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_OUT) {
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_OUT) {
 		if (!IPC_GET_RETVAL(answer->data)) {
 			/* Accepted, handle as_area receipt */
@@ -270,5 +272,5 @@
 			return rc;
 		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_IN) {
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_IN) {
 		if (!IPC_GET_RETVAL(answer->data)) { 
 			irq_spinlock_lock(&answer->sender->lock, true);
@@ -281,5 +283,5 @@
 			IPC_SET_RETVAL(answer->data, rc);
 		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_READ) {
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_READ) {
 		ASSERT(!answer->buffer);
 		if (!IPC_GET_RETVAL(answer->data)) {
@@ -310,5 +312,5 @@
 			}
 		}
-	} else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) {
+	} else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_WRITE) {
 		ASSERT(answer->buffer);
 		if (!IPC_GET_RETVAL(answer->data)) {
@@ -363,5 +365,5 @@
 static int request_preprocess(call_t *call, phone_t *phone)
 {
-	switch (IPC_GET_METHOD(call->data)) {
+	switch (IPC_GET_IMETHOD(call->data)) {
 	case IPC_M_CONNECTION_CLONE: {
 		phone_t *cloned_phone;
@@ -399,5 +401,5 @@
 	}
 	case IPC_M_CONNECT_ME:
-		IPC_SET_ARG5(call->data, (unative_t) phone);
+		IPC_SET_ARG5(call->data, (sysarg_t) phone);
 		break;
 	case IPC_M_CONNECT_ME_TO: {
@@ -407,5 +409,5 @@
 		
 		/* Set arg5 for server */
-		IPC_SET_ARG5(call->data, (unative_t) &TASK->phones[newphid]);
+		IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]);
 		call->flags |= IPC_CALL_CONN_ME_TO;
 		call->priv = newphid;
@@ -503,5 +505,5 @@
 static int process_request(answerbox_t *box, call_t *call)
 {
-	if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME) {
+	if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME) {
 		int phoneid = phone_alloc(TASK);
 		if (phoneid < 0) { /* Failed to allocate phone */
@@ -514,5 +516,5 @@
 	}
 	
-	switch (IPC_GET_METHOD(call->data)) {
+	switch (IPC_GET_IMETHOD(call->data)) {
 	case IPC_M_DEBUG_ALL:
 		return -1;
@@ -530,9 +532,9 @@
  *
  * @param phoneid Phone handle for the call.
- * @param method  Method of the call.
+ * @param imethod Interface and method of the call.
  * @param arg1    Service-defined payload argument.
  * @param arg2    Service-defined payload argument.
  * @param arg3    Service-defined payload argument.
- * @param data    Address of userspace structure where the reply call will
+ * @param data    Address of user-space structure where the reply call will
  *                be stored.
  *
@@ -541,13 +543,13 @@
  *
  */
-unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method,
-    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
+sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t imethod,
+    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data)
 {
 	phone_t *phone;
 	if (phone_get(phoneid, &phone) != EOK)
 		return ENOENT;
-
+	
 	call_t *call = ipc_call_alloc(0);
-	IPC_SET_METHOD(call->data, method);
+	IPC_SET_IMETHOD(call->data, imethod);
 	IPC_SET_ARG1(call->data, arg1);
 	IPC_SET_ARG2(call->data, arg2);
@@ -579,5 +581,4 @@
 		
 		process_answer(call);
-		
 	} else
 		IPC_SET_RETVAL(call->data, res);
@@ -593,13 +594,13 @@
 /** Make a synchronous IPC call allowing to transmit the entire payload.
  *
- * @param phoneid  Phone handle for the call.
- * @param question Userspace address of call data with the request.
- * @param reply    Userspace address of call data where to store the
- *                 answer.
+ * @param phoneid Phone handle for the call.
+ * @param request User-space address of call data with the request.
+ * @param reply   User-space address of call data where to store the
+ *                answer.
  *
  * @return Zero on success or an error code.
  *
  */
-unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
+sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *request,
     ipc_data_t *reply)
 {
@@ -607,11 +608,11 @@
 	if (phone_get(phoneid, &phone) != EOK)
 		return ENOENT;
-
+	
 	call_t *call = ipc_call_alloc(0);
-	int rc = copy_from_uspace(&call->data.args, &question->args,
+	int rc = copy_from_uspace(&call->data.args, &request->args,
 	    sizeof(call->data.args));
 	if (rc != 0) {
 		ipc_call_free(call);
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	}
 	
@@ -644,15 +645,16 @@
 }
 
-/** Check that the task did not exceed the allowed limit of asynchronous calls.
+/** Check that the task did not exceed the allowed limit of asynchronous calls
+ * made over a phone.
+ *
+ * @param phone Phone to check the limit against.
  *
  * @return 0 if limit not reached or -1 if limit exceeded.
  *
  */
-static int check_call_limit(void)
-{
-	if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
-		atomic_dec(&TASK->active_calls);
+static int check_call_limit(phone_t *phone)
+{
+	if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
 		return -1;
-	}
 	
 	return 0;
@@ -665,5 +667,5 @@
  *
  * @param phoneid Phone handle for the call.
- * @param method  Method of the call.
+ * @param imethod Interface and method of the call.
  * @param arg1    Service-defined payload argument.
  * @param arg2    Service-defined payload argument.
@@ -677,16 +679,16 @@
  *
  */
-unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
-    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
-{
-	if (check_call_limit())
-		return IPC_CALLRET_TEMPORARY;
-	
+sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t imethod,
+    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
+{
 	phone_t *phone;
 	if (phone_get(phoneid, &phone) != EOK)
 		return IPC_CALLRET_FATAL;
 	
+	if (check_call_limit(phone))
+		return IPC_CALLRET_TEMPORARY;
+	
 	call_t *call = ipc_call_alloc(0);
-	IPC_SET_METHOD(call->data, method);
+	IPC_SET_IMETHOD(call->data, imethod);
 	IPC_SET_ARG1(call->data, arg1);
 	IPC_SET_ARG2(call->data, arg2);
@@ -707,5 +709,5 @@
 		ipc_backsend_err(phone, call, res);
 	
-	return (unative_t) call;
+	return (sysarg_t) call;
 }
 
@@ -718,12 +720,12 @@
  *
  */
-unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data)
-{
-	if (check_call_limit())
-		return IPC_CALLRET_TEMPORARY;
-	
+sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data)
+{
 	phone_t *phone;
 	if (phone_get(phoneid, &phone) != EOK)
 		return IPC_CALLRET_FATAL;
+
+	if (check_call_limit(phone))
+		return IPC_CALLRET_TEMPORARY;
 
 	call_t *call = ipc_call_alloc(0);
@@ -732,5 +734,5 @@
 	if (rc != 0) {
 		ipc_call_free(call);
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	}
 	
@@ -742,5 +744,5 @@
 		ipc_backsend_err(phone, call, res);
 	
-	return (unative_t) call;
+	return (sysarg_t) call;
 }
 
@@ -751,5 +753,5 @@
  * @param callid  Hash of the call to forward.
  * @param phoneid Phone handle to use for forwarding.
- * @param method  New method to use for the forwarded call.
+ * @param imethod New interface and method to use for the forwarded call.
  * @param arg1    New value of the first argument for the forwarded call.
  * @param arg2    New value of the second argument for the forwarded call.
@@ -767,7 +769,7 @@
  *
  */
-static unative_t sys_ipc_forward_common(unative_t callid, unative_t phoneid,
-    unative_t method, unative_t arg1, unative_t arg2, unative_t arg3,
-    unative_t arg4, unative_t arg5, unsigned int mode, bool slow)
+static sysarg_t sys_ipc_forward_common(sysarg_t callid, sysarg_t phoneid,
+    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
+    sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
 {
 	call_t *call = get_call(callid);
@@ -784,5 +786,5 @@
 	}
 	
-	if (!method_is_forwardable(IPC_GET_METHOD(call->data))) {
+	if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) {
 		IPC_SET_RETVAL(call->data, EFORWARD);
 		ipc_answer(&TASK->answerbox, call);
@@ -791,15 +793,15 @@
 	
 	/*
-	 * Userspace is not allowed to change method of system methods on
-	 * forward, allow changing ARG1, ARG2, ARG3 and ARG4 by means of method,
-	 * arg1, arg2 and arg3.
-	 * If the method is immutable, don't change anything.
+	 * Userspace is not allowed to change interface and method of system
+	 * methods on forward, allow changing ARG1, ARG2, ARG3 and ARG4 by
+	 * means of method, arg1, arg2 and arg3.
+	 * If the interface and method is immutable, don't change anything.
 	 */
-	if (!method_is_immutable(IPC_GET_METHOD(call->data))) {
-		if (method_is_system(IPC_GET_METHOD(call->data))) {
-			if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME)
+	if (!method_is_immutable(IPC_GET_IMETHOD(call->data))) {
+		if (method_is_system(IPC_GET_IMETHOD(call->data))) {
+			if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
 				phone_dealloc(IPC_GET_ARG5(call->data));
 			
-			IPC_SET_ARG1(call->data, method);
+			IPC_SET_ARG1(call->data, imethod);
 			IPC_SET_ARG2(call->data, arg1);
 			IPC_SET_ARG3(call->data, arg2);
@@ -813,5 +815,5 @@
 			}
 		} else {
-			IPC_SET_METHOD(call->data, method);
+			IPC_SET_IMETHOD(call->data, imethod);
 			IPC_SET_ARG1(call->data, arg1);
 			IPC_SET_ARG2(call->data, arg2);
@@ -829,14 +831,14 @@
 /** Forward a received call to another destination - fast version.
  *
- * In case the original method is a system method, ARG1, ARG2 and ARG3 are
- * overwritten in the forwarded message with the new method and the new
- * arg1 and arg2, respectively. Otherwise the METHOD, ARG1 and ARG2 are
- * rewritten with the new method, arg1 and arg2, respectively. Also note there
- * is a set of immutable methods, for which the new method and arguments are not
- * set and these values are ignored.
+ * In case the original interface and method is a system method, ARG1, ARG2
+ * and ARG3 are overwritten in the forwarded message with the new method and
+ * the new arg1 and arg2, respectively. Otherwise the IMETHOD, ARG1 and ARG2
+ * are rewritten with the new interface and method, arg1 and arg2, respectively.
+ * Also note there is a set of immutable methods, for which the new method and
+ * arguments are not set and these values are ignored.
  *
  * @param callid  Hash of the call to forward.
  * @param phoneid Phone handle to use for forwarding.
- * @param method  New method to use for the forwarded call.
+ * @param imethod New interface and method to use for the forwarded call.
  * @param arg1    New value of the first argument for the forwarded call.
  * @param arg2    New value of the second argument for the forwarded call.
@@ -846,8 +848,8 @@
  *
  */
-unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
-    unative_t method, unative_t arg1, unative_t arg2, unsigned int mode)
-{
-	return sys_ipc_forward_common(callid, phoneid, method, arg1, arg2, 0, 0,
+sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid,
+    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
+{
+	return sys_ipc_forward_common(callid, phoneid, imethod, arg1, arg2, 0, 0,
 	    0, mode, false); 
 }
@@ -856,9 +858,9 @@
  *
  * This function is the slow verision of the sys_ipc_forward_fast interface.
- * It can copy all five new arguments and the new method from the userspace.
- * It naturally extends the functionality of the fast version. For system
- * methods, it additionally stores the new value of arg3 to ARG4. For non-system
- * methods, it additionally stores the new value of arg3, arg4 and arg5,
- * respectively, to ARG3, ARG4 and ARG5, respectively.
+ * It can copy all five new arguments and the new interface and method from
+ * the userspace. It naturally extends the functionality of the fast version.
+ * For system methods, it additionally stores the new value of arg3 to ARG4.
+ * For non-system methods, it additionally stores the new value of arg3, arg4
+ * and arg5, respectively, to ARG3, ARG4 and ARG5, respectively.
  *
  * @param callid  Hash of the call to forward.
@@ -870,5 +872,5 @@
  *
  */
-unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
+sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid,
     ipc_data_t *data, unsigned int mode)
 {
@@ -877,8 +879,8 @@
 	    sizeof(newdata.args));
 	if (rc != 0)
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	
 	return sys_ipc_forward_common(callid, phoneid,
-	    IPC_GET_METHOD(newdata), IPC_GET_ARG1(newdata),
+	    IPC_GET_IMETHOD(newdata), IPC_GET_ARG1(newdata),
 	    IPC_GET_ARG2(newdata), IPC_GET_ARG3(newdata),
 	    IPC_GET_ARG4(newdata), IPC_GET_ARG5(newdata), mode, true); 
@@ -900,6 +902,6 @@
  *
  */
-unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
-    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
+sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval,
+    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
 	/* Do not answer notification callids */
@@ -945,5 +947,5 @@
  *
  */
-unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data)
+sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data)
 {
 	/* Do not answer notification callids */
@@ -982,5 +984,5 @@
  *
  */
-unative_t sys_ipc_hangup(unative_t phoneid)
+sysarg_t sys_ipc_hangup(sysarg_t phoneid)
 {
 	phone_t *phone;
@@ -1008,5 +1010,5 @@
  *
  */
-unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
+sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     unsigned int flags)
 {
@@ -1037,5 +1039,5 @@
 		ipc_call_free(call);
 		
-		return ((unative_t) call) | IPC_CALLID_NOTIFICATION;
+		return ((sysarg_t) call) | IPC_CALLID_NOTIFICATION;
 	}
 	
@@ -1046,11 +1048,4 @@
 			ipc_call_free(call);
 			goto restart;
-		} else {
-			/*
-			 * Decrement the counter of active calls only if the
-			 * call is not an answer to IPC_M_PHONE_HUNGUP,
-			 * which doesn't contribute to the counter.
-			 */
-			atomic_dec(&TASK->active_calls);
 		}
 		
@@ -1058,5 +1053,5 @@
 		ipc_call_free(call);
 		
-		return ((unative_t) call) | IPC_CALLID_ANSWERED;
+		return ((sysarg_t) call) | IPC_CALLID_ANSWERED;
 	}
 	
@@ -1086,5 +1081,5 @@
 	}
 	
-	return (unative_t) call;
+	return (sysarg_t) call;
 }
 
@@ -1092,5 +1087,5 @@
  *
  */
-unative_t sys_ipc_poke(void)
+sysarg_t sys_ipc_poke(void)
 {
 	waitq_unsleep(&TASK->answerbox.wq);
@@ -1100,13 +1095,13 @@
 /** Connect an IRQ handler to a task.
  *
- * @param inr    IRQ number.
- * @param devno  Device number.
- * @param method Method to be associated with the notification.
- * @param ucode  Uspace pointer to the top-half pseudocode.
+ * @param inr     IRQ number.
+ * @param devno   Device number.
+ * @param imethod Interface and method to be associated with the notification.
+ * @param ucode   Uspace pointer to the top-half pseudocode.
  *
  * @return EPERM or a return code returned by ipc_irq_register().
  *
  */
-unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
+sysarg_t sys_ipc_register_irq(inr_t inr, devno_t devno, sysarg_t imethod,
     irq_code_t *ucode)
 {
@@ -1114,5 +1109,5 @@
 		return EPERM;
 	
-	return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
+	return ipc_irq_register(&TASK->answerbox, inr, devno, imethod, ucode);
 }
 
@@ -1125,5 +1120,5 @@
  *
  */
-unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
+sysarg_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
 {
 	if (!(cap_get(TASK) & CAP_IRQ_REG))
@@ -1135,27 +1130,45 @@
 }
 
-#include <console/console.h>
-
-/** Syscall connect to a task by id.
+#ifdef __32_BITS__
+
+/** Syscall connect to a task by ID (32 bits)
  *
  * @return Phone id on success, or negative error code.
  *
  */
-unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
+sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid)
 {
 #ifdef CONFIG_UDEBUG
-	sysarg64_t taskid_arg;
-	int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
+	sysarg64_t taskid;
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
 	if (rc != 0)
-		return (unative_t) rc;
-	
-	LOG("sys_ipc_connect_kbox(%" PRIu64 ")", taskid_arg.value);
-	
-	return ipc_connect_kbox(taskid_arg.value);
+		return (sysarg_t) rc;
+	
+	return ipc_connect_kbox((task_id_t) taskid);
 #else
-	return (unative_t) ENOTSUP;
+	return (sysarg_t) ENOTSUP;
 #endif
 }
 
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+/** Syscall connect to a task by ID (64 bits)
+ *
+ * @return Phone id on success, or negative error code.
+ *
+ */
+sysarg_t sys_ipc_connect_kbox(sysarg_t taskid)
+{
+#ifdef CONFIG_UDEBUG
+	return ipc_connect_kbox((task_id_t) taskid);
+#else
+	return (sysarg_t) ENOTSUP;
+#endif
+}
+
+#endif  /* __64_BITS__ */
+
 /** @}
  */
Index: kernel/generic/src/lib/memstr.c
===================================================================
--- kernel/generic/src/lib/memstr.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/lib/memstr.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,15 +62,15 @@
 	unsigned int i, j;
 	
-	if (ALIGN_UP((uintptr_t) src, sizeof(unative_t)) != (uintptr_t) src ||
-	    ALIGN_UP((uintptr_t) dst, sizeof(unative_t)) != (uintptr_t) dst) {
+	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(unative_t); i++)
-			((unative_t *) dst)[i] = ((unative_t *) src)[i];
+		for (i = 0; i < cnt / sizeof(sysarg_t); i++)
+			((sysarg_t *) dst)[i] = ((sysarg_t *) src)[i];
 		
-		for (j = 0; j < cnt % sizeof(unative_t); j++)
-			((uint8_t *)(((unative_t *) dst) + i))[j] =
-			    ((uint8_t *)(((unative_t *) src) + i))[j];
+		for (j = 0; j < cnt % sizeof(sysarg_t); j++)
+			((uint8_t *)(((sysarg_t *) dst) + i))[j] =
+			    ((uint8_t *)(((sysarg_t *) src) + i))[j];
 	}
 		
Index: kernel/generic/src/lib/rd.c
===================================================================
--- kernel/generic/src/lib/rd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/lib/rd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -96,5 +96,5 @@
 	sysinfo_set_item_val("rd.size", NULL, dsize);
 	sysinfo_set_item_val("rd.address.physical", NULL,
-	    (unative_t)	KA2PA((void *) header + hsize));
+	    (sysarg_t) KA2PA((void *) header + hsize));
 
 	return RE_OK;
Index: kernel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/main/kinit.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -129,5 +129,5 @@
 		 * For each CPU, create its load balancing thread.
 		 */
-		size_t i;
+		unsigned int i;
 		
 		for (i = 0; i < config.cpu_count; i++) {
@@ -139,5 +139,5 @@
 				thread_ready(thread);
 			} else
-				printf("Unable to create kcpulb thread for cpu" PRIs "\n", i);
+				printf("Unable to create kcpulb thread for cpu%u\n", i);
 		}
 	}
@@ -179,5 +179,5 @@
 	for (i = 0; i < init.cnt; i++) {
 		if (init.tasks[i].addr % FRAME_SIZE) {
-			printf("init[%" PRIs "].addr is not frame aligned\n", i);
+			printf("init[%zu].addr is not frame aligned\n", i);
 			programs[i].task = NULL;
 			continue;
@@ -219,5 +219,5 @@
 			
 			if (rd != RE_OK)
-				printf("Init binary %" PRIs " not used (error %d)\n", i, rd);
+				printf("Init binary %zu not used (error %d)\n", i, rd);
 		}
 	}
Index: kernel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/main/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -97,5 +97,5 @@
 /** Boot allocations. */
 ballocs_t ballocs = {
-	.base = NULL,
+	.base = (uintptr_t) NULL,
 	.size = 0
 };
@@ -183,6 +183,6 @@
 	version_print();
 	
-	LOG("\nconfig.base=%p config.kernel_size=%" PRIs
-	    "\nconfig.stack_base=%p config.stack_size=%" PRIs,
+	LOG("\nconfig.base=%p config.kernel_size=%zu"
+	    "\nconfig.stack_base=%p config.stack_size=%zu",
 	    config.base, config.kernel_size, config.stack_base,
 	    config.stack_size);
@@ -225,5 +225,5 @@
 	slab_enable_cpucache();
 	
-	printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n",
+	printf("Detected %u CPU(s), %" PRIu64 " MiB free memory\n",
 	    config.cpu_count, SIZE2MB(zones_total_size()));
 	
@@ -241,7 +241,6 @@
 		size_t i;
 		for (i = 0; i < init.cnt; i++)
-			LOG("init[%" PRIs "].addr=%p, init[%" PRIs
-			    "].size=%" PRIs, i, init.tasks[i].addr, i,
-			    init.tasks[i].size);
+			LOG("init[%zu].addr=%p, init[%zu].size=%zu",
+			    i, init.tasks[i].addr, i, init.tasks[i].size);
 	} else
 		printf("No init binaries found.\n");
Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/mm/as.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -312,5 +312,5 @@
 	 *
 	 */
-	if (overlaps(va, size, NULL, PAGE_SIZE))
+	if (overlaps(va, size, (uintptr_t) NULL, PAGE_SIZE))
 		return false;
 	
@@ -1811,6 +1811,6 @@
 	}
 	
-	panic("Inconsistency detected while adding %" PRIs " pages of used "
-	    "space at %p.", count, page);
+	panic("Inconsistency detected while adding %zu pages of used "
+	    "space at %p.", count, (void *) page);
 }
 
@@ -1991,6 +1991,6 @@
 	
 error:
-	panic("Inconsistency detected while removing %" PRIs " pages of used "
-	    "space from %p.", count, page);
+	panic("Inconsistency detected while removing %zu pages of used "
+	    "space from %p.", count, (void *) page);
 }
 
@@ -2000,29 +2000,29 @@
 
 /** Wrapper for as_area_create(). */
-unative_t sys_as_area_create(uintptr_t address, size_t size, unsigned int flags)
+sysarg_t sys_as_area_create(uintptr_t address, size_t size, unsigned int flags)
 {
 	if (as_area_create(AS, flags | AS_AREA_CACHEABLE, size, address,
 	    AS_AREA_ATTR_NONE, &anon_backend, NULL))
-		return (unative_t) address;
+		return (sysarg_t) address;
 	else
-		return (unative_t) -1;
+		return (sysarg_t) -1;
 }
 
 /** Wrapper for as_area_resize(). */
-unative_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
-{
-	return (unative_t) as_area_resize(AS, address, size, 0);
+sysarg_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
+{
+	return (sysarg_t) as_area_resize(AS, address, size, 0);
 }
 
 /** Wrapper for as_area_change_flags(). */
-unative_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
-{
-	return (unative_t) as_area_change_flags(AS, flags, address);
+sysarg_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
+{
+	return (sysarg_t) as_area_change_flags(AS, flags, address);
 }
 
 /** Wrapper for as_area_destroy(). */
-unative_t sys_as_area_destroy(uintptr_t address)
-{
-	return (unative_t) as_area_destroy(AS, address);
+sysarg_t sys_as_area_destroy(uintptr_t address)
+{
+	return (sysarg_t) as_area_destroy(AS, address);
 }
 
@@ -2105,7 +2105,8 @@
 			
 			mutex_lock(&area->lock);
-			printf("as_area: %p, base=%p, pages=%" PRIs
-			    " (%p - %p)\n", area, area->base, area->pages,
-			    area->base, area->base + FRAMES2SIZE(area->pages));
+			printf("as_area: %p, base=%p, pages=%zu"
+			    " (%p - %p)\n", area, (void *) area->base,
+			    area->pages, (void *) area->base,
+			    (void *) (area->base + FRAMES2SIZE(area->pages)));
 			mutex_unlock(&area->lock);
 		}
Index: kernel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/mm/frame.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -145,8 +145,9 @@
 			    (!iswithin(zones.info[i].base, zones.info[i].count,
 			    base, count))) {
-				printf("Zone (%p, %p) overlaps with previous zone (%p, %p)!\n",
-				    PFN2ADDR(base), PFN2ADDR(count),
-				    PFN2ADDR(zones.info[i].base),
-				    PFN2ADDR(zones.info[i].count));
+				printf("Zone (%p, %p) overlaps "
+				    "with previous zone (%p %p)!\n",
+				    (void *) PFN2ADDR(base), (void *) PFN2ADDR(count),
+				    (void *) PFN2ADDR(zones.info[i].base),
+				    (void *) PFN2ADDR(zones.info[i].count));
 			}
 			
@@ -878,5 +879,5 @@
 		 * the assert
 		 */
-		ASSERT(confframe != NULL);
+		ASSERT(confframe != ADDR2PFN((uintptr_t ) NULL));
 		
 		/* If confframe is supposed to be inside our zone, then make sure
@@ -1049,6 +1050,6 @@
 		
 #ifdef CONFIG_DEBUG
-		printf("Thread %" PRIu64 " waiting for %" PRIs " frames, "
-		    "%" PRIs " available.\n", THREAD->tid, size, avail);
+		printf("Thread %" PRIu64 " waiting for %zu frames, "
+		    "%zu available.\n", THREAD->tid, size, avail);
 #endif
 		
@@ -1104,5 +1105,5 @@
 	 */
 	pfn_t pfn = ADDR2PFN(frame);
-	size_t znum = find_zone(pfn, 1, NULL);
+	size_t znum = find_zone(pfn, 1, 0);
 	
 	ASSERT(znum != (size_t) -1);
@@ -1141,5 +1142,5 @@
 	 * First, find host frame zone for addr.
 	 */
-	size_t znum = find_zone(pfn, 1, NULL);
+	size_t znum = find_zone(pfn, 1, 0);
 	
 	ASSERT(znum != (size_t) -1);
@@ -1297,15 +1298,15 @@
 		bool available = zone_flags_available(flags);
 		
-		printf("%-4" PRIs, i);
+		printf("%-4zu", i);
 		
 #ifdef __32_BITS__
-		printf("  %10p", base);
+		printf("  %p", (void *) base);
 #endif
 		
 #ifdef __64_BITS__
-		printf(" %18p", base);
+		printf(" %p", (void *) base);
 #endif
 		
-		printf(" %12" PRIs " %c%c%c      ", count,
+		printf(" %12zu %c%c%c      ", count,
 		    available ? 'A' : ' ',
 		    (flags & ZONE_RESERVED) ? 'R' : ' ',
@@ -1313,5 +1314,5 @@
 		
 		if (available)
-			printf("%14" PRIs " %14" PRIs,
+			printf("%14zu %14zu",
 			    free_count, busy_count);
 		
@@ -1354,7 +1355,7 @@
 	bool available = zone_flags_available(flags);
 	
-	printf("Zone number:       %" PRIs "\n", znum);
-	printf("Zone base address: %p\n", base);
-	printf("Zone size:         %" PRIs " frames (%" PRIs " KiB)\n", count,
+	printf("Zone number:       %zu\n", znum);
+	printf("Zone base address: %p\n", (void *) base);
+	printf("Zone size:         %zu frames (%zu KiB)\n", count,
 	    SIZE2KB(FRAMES2SIZE(count)));
 	printf("Zone flags:        %c%c%c\n",
@@ -1364,7 +1365,7 @@
 	
 	if (available) {
-		printf("Allocated space:   %" PRIs " frames (%" PRIs " KiB)\n",
+		printf("Allocated space:   %zu frames (%zu KiB)\n",
 		    busy_count, SIZE2KB(FRAMES2SIZE(busy_count)));
-		printf("Available space:   %" PRIs " frames (%" PRIs " KiB)\n",
+		printf("Available space:   %zu frames (%zu KiB)\n",
 		    free_count, SIZE2KB(FRAMES2SIZE(free_count)));
 	}
Index: kernel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/mm/slab.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -612,6 +612,6 @@
 	cache->name = name;
 	
-	if (align < sizeof(unative_t))
-		align = sizeof(unative_t);
+	if (align < sizeof(sysarg_t))
+		align = sizeof(sysarg_t);
 	
 	size = ALIGN_UP(size, align);
@@ -890,5 +890,5 @@
 		irq_spinlock_unlock(&slab_cache_lock, true);
 		
-		printf("%-18s %8" PRIs " %8u %8" PRIs " %8ld %8ld %8ld %-5s\n",
+		printf("%-18s %8zu %8u %8zu %8ld %8ld %8ld %-5s\n",
 		    name, size, (1 << order), objects, allocated_slabs,
 		    cached_objs, allocated_objs,
Index: kernel/generic/src/printf/printf_core.c
===================================================================
--- kernel/generic/src/printf/printf_core.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/printf/printf_core.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -83,5 +83,6 @@
 	PrintfQualifierLong,
 	PrintfQualifierLongLong,
-	PrintfQualifierPointer
+	PrintfQualifierPointer,
+	PrintfQualifierSize
 } qualifier_t;
 
@@ -553,7 +554,8 @@
  *  - ""   Signed or unsigned int (default value).@n
  *  - "l"  Signed or unsigned long int.@n
- *         If conversion is "c", the character is wchar_t (wide character).@n
+ *         If conversion is "c", the character is wint_t (wide character).@n
  *         If conversion is "s", the string is wchar_t * (wide string).@n
  *  - "ll" Signed or unsigned long long int.@n
+ *  - "z"  Signed or unsigned ssize_t or site_t.@n
  *
  * CONVERSION:@n
@@ -737,4 +739,9 @@
 				}
 				break;
+			case 'z':
+				qualifier = PrintfQualifierSize;
+				i = nxt;
+				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
+				break;
 			default:
 				/* Default type */
@@ -764,5 +771,5 @@
 			case 'c':
 				if (qualifier == PrintfQualifierLong)
-					retval = print_wchar(va_arg(ap, wchar_t), width, flags, ps);
+					retval = print_wchar(va_arg(ap, wint_t), width, flags, ps);
 				else
 					retval = print_char(va_arg(ap, unsigned int), width, flags, ps);
@@ -850,4 +857,8 @@
 				precision = size << 1;
 				number = (uint64_t) (uintptr_t) va_arg(ap, void *);
+				break;
+			case PrintfQualifierSize:
+				size = sizeof(size_t);
+				number = (uint64_t) va_arg(ap, size_t);
 				break;
 			default:
Index: kernel/generic/src/proc/program.c
===================================================================
--- kernel/generic/src/proc/program.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/proc/program.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -145,6 +145,6 @@
 		
 		program_loader = image_addr;
-		LOG("Registered program loader at 0x%" PRIp,
-		    image_addr);
+		LOG("Registered program loader at %p",
+		    (void *) image_addr);
 		
 		return EOK;
@@ -210,5 +210,5 @@
  *
  */
-unative_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
+sysarg_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
 {
 	/* Cap length of name and copy it from userspace. */
@@ -219,5 +219,5 @@
 	int rc = copy_from_uspace(namebuf, uspace_name, name_len);
 	if (rc != 0)
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	
 	namebuf[name_len] = 0;
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/proc/scheduler.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -727,5 +727,5 @@
 		irq_spinlock_lock(&cpus[cpu].lock, true);
 		
-		printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIs "\n",
+		printf("cpu%u: address=%p, nrdy=%" PRIua ", needs_relink=%zu\n",
 		    cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
 		    cpus[cpu].needs_relink);
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/proc/task.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -151,5 +151,4 @@
 	atomic_set(&task->refcount, 0);
 	atomic_set(&task->lifecount, 0);
-	atomic_set(&task->active_calls, 0);
 	
 	irq_spinlock_initialize(&task->lock, "task_t_lock");
@@ -291,13 +290,15 @@
 }
 
-/** Syscall for reading task ID from userspace.
- *
- * @param uspace_task_id Userspace address of 8-byte buffer
- *                       where to store current task ID.
+#ifdef __32_BITS__
+
+/** Syscall for reading task ID from userspace (32 bits)
+ *
+ * @param uspace_taskid Pointer to user-space buffer
+ *                      where to store current task ID.
  *
  * @return Zero on success or an error code from @ref errno.h.
  *
  */
-unative_t sys_task_get_id(task_id_t *uspace_task_id)
+sysarg_t sys_task_get_id(sysarg64_t *uspace_taskid)
 {
 	/*
@@ -305,7 +306,27 @@
 	 * the lifespan of the task.
 	 */
-	return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid,
+	return (sysarg_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
 	    sizeof(TASK->taskid));
 }
+
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+/** Syscall for reading task ID from userspace (64 bits)
+ *
+ * @return Current task ID.
+ *
+ */
+sysarg_t sys_task_get_id(void)
+{
+	/*
+	 * No need to acquire lock on TASK because taskid remains constant for
+	 * the lifespan of the task.
+	 */
+	return TASK->taskid;
+}
+
+#endif  /* __64_BITS__ */
 
 /** Syscall for setting the task name.
@@ -319,5 +340,5 @@
  *
  */
-unative_t sys_task_set_name(const char *uspace_name, size_t name_len)
+sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
 {
 	int rc;
@@ -331,5 +352,5 @@
 	rc = copy_from_uspace(namebuf, uspace_name, name_len);
 	if (rc != 0)
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	
 	namebuf[name_len] = '\0';
@@ -478,6 +499,6 @@
 #ifdef __32_BITS__
 	if (*additional)
-		printf("%-8" PRIu64 " %9lu %7lu", task->taskid,
-		    atomic_get(&task->refcount), atomic_get(&task->active_calls));
+		printf("%-8" PRIu64 " %9" PRIua, task->taskid,
+		    atomic_get(&task->refcount));
 	else
 		printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p"
@@ -489,7 +510,7 @@
 #ifdef __64_BITS__
 	if (*additional)
-		printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9lu %7lu",
-		    task->taskid, ucycles, usuffix, kcycles, ksuffix,
-		    atomic_get(&task->refcount), atomic_get(&task->active_calls));
+		printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c "
+		    "%9" PRIua, task->taskid, ucycles, usuffix, kcycles,
+		    ksuffix, atomic_get(&task->refcount));
 	else
 		printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
@@ -501,5 +522,5 @@
 		for (i = 0; i < IPC_MAX_PHONES; i++) {
 			if (task->phones[i].callee)
-				printf(" %" PRIs ":%p", i, task->phones[i].callee);
+				printf(" %zu:%p", i, task->phones[i].callee);
 		}
 		printf("\n");
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/proc/thread.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -755,5 +755,5 @@
  *
  */
-unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
+sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
     size_t name_len, thread_id_t *uspace_thread_id)
 {
@@ -764,5 +764,5 @@
 	int rc = copy_from_uspace(namebuf, uspace_name, name_len);
 	if (rc != 0)
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	
 	namebuf[name_len] = 0;
@@ -779,5 +779,5 @@
 	if (rc != 0) {
 		free(kernel_uarg);
-		return (unative_t) rc;
+		return (sysarg_t) rc;
 	}
 	
@@ -804,5 +804,5 @@
 				free(kernel_uarg);
 				
-				return (unative_t) rc;
+				return (sysarg_t) rc;
 			 }
 		}
@@ -827,5 +827,5 @@
 		free(kernel_uarg);
 	
-	return (unative_t) ENOMEM;
+	return (sysarg_t) ENOMEM;
 }
 
@@ -833,5 +833,5 @@
  *
  */
-unative_t sys_thread_exit(int uspace_status)
+sysarg_t sys_thread_exit(int uspace_status)
 {
 	thread_exit();
@@ -849,5 +849,5 @@
  *
  */
-unative_t sys_thread_get_id(thread_id_t *uspace_thread_id)
+sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id)
 {
 	/*
@@ -856,10 +856,10 @@
 	 *
 	 */
-	return (unative_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
+	return (sysarg_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
 	    sizeof(THREAD->tid));
 }
 
 /** Syscall wrapper for sleeping. */
-unative_t sys_thread_usleep(uint32_t usec)
+sysarg_t sys_thread_usleep(uint32_t usec)
 {
 	thread_usleep(usec);
Index: kernel/generic/src/security/cap.c
===================================================================
--- kernel/generic/src/security/cap.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/security/cap.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,5 +41,4 @@
 #include <proc/task.h>
 #include <synch/spinlock.h>
-#include <syscall/sysarg64.h>
 #include <syscall/copy.h>
 #include <arch.h>
@@ -79,26 +78,21 @@
  * The calling task must have the CAP_CAP capability.
  *
- * @param uspace_taskid_arg Userspace structure holding destination task ID.
- * @param caps Capabilities to grant.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps)
+ * @param taskid Destination task ID.
+ * @param caps   Capabilities to grant.
+ *
+ * @return Zero on success or an error code from @ref errno.h.
+ *
+ */
+static sysarg_t cap_grant(task_id_t taskid, cap_t caps)
 {
 	if (!(cap_get(TASK) & CAP_CAP))
-		return (unative_t) EPERM;
-	
-	sysarg64_t taskid_arg;
-	int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
-	if (rc != 0)
-		return (unative_t) rc;
+		return (sysarg_t) EPERM;
 	
 	irq_spinlock_lock(&tasks_lock, true);
-	task_t *task = task_find_by_id((task_id_t) taskid_arg.value);
+	task_t *task = task_find_by_id(taskid);
 	
 	if ((!task) || (!context_check(CONTEXT, task->context))) {
 		irq_spinlock_unlock(&tasks_lock, true);
-		return (unative_t) ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 	
@@ -116,23 +110,18 @@
  * attempt to revoke capabilities from itself.
  *
- * @param uspace_taskid_arg Userspace structure holding destination task ID.
- * @param caps Capabilities to revoke.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps)
-{
-	sysarg64_t taskid_arg;
-	int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
-	if (rc != 0)
-		return (unative_t) rc;
-	
+ * @param taskid Destination task ID.
+ * @param caps   Capabilities to revoke.
+ *
+ * @return Zero on success or an error code from @ref errno.h.
+ *
+ */
+static sysarg_t cap_revoke(task_id_t taskid, cap_t caps)
+{
 	irq_spinlock_lock(&tasks_lock, true);
 	
-	task_t *task = task_find_by_id((task_id_t) taskid_arg.value);
+	task_t *task = task_find_by_id(taskid);
 	if ((!task) || (!context_check(CONTEXT, task->context))) {
 		irq_spinlock_unlock(&tasks_lock, true);
-		return (unative_t) ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 	
@@ -147,5 +136,5 @@
 		irq_spinlock_unlock(&TASK->lock, false);
 		irq_spinlock_unlock(&tasks_lock, true);
-		return (unative_t) EPERM;
+		return (sysarg_t) EPERM;
 	}
 	
@@ -157,4 +146,84 @@
 }
 
+#ifdef __32_BITS__
+
+/** Grant capabilities to a task (32 bits)
+ *
+ * The calling task must have the CAP_CAP capability.
+ *
+ * @param uspace_taskid User-space pointer to destination task ID.
+ * @param caps          Capabilities to grant.
+ *
+ * @return Zero on success or an error code from @ref errno.h.
+ *
+ */
+sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps)
+{
+	sysarg64_t taskid;
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
+	
+	return cap_grant((task_id_t) taskid, caps);
+}
+
+/** Revoke capabilities from a task (32 bits)
+ *
+ * The calling task must have the CAP_CAP capability or the caller must
+ * attempt to revoke capabilities from itself.
+ *
+ * @param uspace_taskid User-space pointer to destination task ID.
+ * @param caps          Capabilities to revoke.
+ *
+ * @return Zero on success or an error code from @ref errno.h.
+ *
+ */
+sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps)
+{
+	sysarg64_t taskid;
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
+	
+	return cap_revoke((task_id_t) taskid, caps);
+}
+
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+/** Grant capabilities to a task (64 bits)
+ *
+ * The calling task must have the CAP_CAP capability.
+ *
+ * @param taskid Destination task ID.
+ * @param caps   Capabilities to grant.
+ *
+ * @return Zero on success or an error code from @ref errno.h.
+ *
+ */
+sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps)
+{
+	return cap_grant((task_id_t) taskid, caps);
+}
+
+/** Revoke capabilities from a task (64 bits)
+ *
+ * The calling task must have the CAP_CAP capability or the caller must
+ * attempt to revoke capabilities from itself.
+ *
+ * @param taskid Destination task ID.
+ * @param caps   Capabilities to revoke.
+ *
+ * @return Zero on success or an error code from @ref errno.h.
+ *
+ */
+sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps)
+{
+	return cap_revoke((task_id_t) taskid, caps);
+}
+
+#endif  /* __64_BITS__ */
+
 /** @}
  */
Index: kernel/generic/src/synch/futex.c
===================================================================
--- kernel/generic/src/synch/futex.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/synch/futex.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -60,6 +60,6 @@
 
 static futex_t *futex_find(uintptr_t paddr);
-static size_t futex_ht_hash(unative_t *key);
-static bool futex_ht_compare(unative_t *key, size_t keys, link_t *item);
+static size_t futex_ht_hash(sysarg_t *key);
+static bool futex_ht_compare(sysarg_t *key, size_t keys, link_t *item);
 static void futex_ht_remove_callback(link_t *item);
 
@@ -108,5 +108,5 @@
  *			synch.h.
  */
-unative_t sys_futex_sleep(uintptr_t uaddr)
+sysarg_t sys_futex_sleep(uintptr_t uaddr)
 {
 	futex_t *futex;
@@ -122,5 +122,5 @@
 	if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
 		page_table_unlock(AS, true);
-		return (unative_t) ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 	paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
@@ -136,5 +136,5 @@
 	udebug_stoppable_end();
 #endif
-	return (unative_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -145,5 +145,5 @@
  * @return		ENOENT if there is no physical mapping for uaddr.
  */
-unative_t sys_futex_wakeup(uintptr_t uaddr)
+sysarg_t sys_futex_wakeup(uintptr_t uaddr)
 {
 	futex_t *futex;
@@ -158,5 +158,5 @@
 	if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
 		page_table_unlock(AS, true);
-		return (unative_t) ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 	paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
@@ -235,5 +235,5 @@
  * @return		Index into futex hash table.
  */
-size_t futex_ht_hash(unative_t *key)
+size_t futex_ht_hash(sysarg_t *key)
 {
 	return (*key & (FUTEX_HT_SIZE - 1));
@@ -247,5 +247,5 @@
  * @return		True if the item matches the key. False otherwise.
  */
-bool futex_ht_compare(unative_t *key, size_t keys, link_t *item)
+bool futex_ht_compare(sysarg_t *key, size_t keys, link_t *item)
 {
 	futex_t *futex;
Index: kernel/generic/src/synch/smc.c
===================================================================
--- kernel/generic/src/synch/smc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/synch/smc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -42,7 +42,7 @@
 #include <synch/smc.h>
 
-unative_t sys_smc_coherence(uintptr_t va, size_t size)
+sysarg_t sys_smc_coherence(uintptr_t va, size_t size)
 {
-	if (overlaps(va, size, NULL, PAGE_SIZE))
+	if (overlaps(va, size, (uintptr_t) NULL, PAGE_SIZE))
 		return EINVAL;
 
Index: kernel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/synch/spinlock.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -102,7 +102,7 @@
 		
 		if (i++ > DEADLOCK_THRESHOLD) {
-			printf("cpu%u: looping on spinlock %" PRIp ":%s, "
-			    "caller=%" PRIp "(%s)\n", CPU->id, lock, lock->name,
-			    CALLER, symtab_fmt_name_lookup(CALLER));
+			printf("cpu%u: looping on spinlock %p:%s, "
+			    "caller=%p (%s)\n", CPU->id, lock, lock->name,
+			    (void *) CALLER, symtab_fmt_name_lookup(CALLER));
 			
 			i = 0;
Index: kernel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/syscall/syscall.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -56,6 +56,6 @@
 
 /** Dispatch system call */
-unative_t syscall_handler(unative_t a1, unative_t a2, unative_t a3,
-    unative_t a4, unative_t a5, unative_t a6, unative_t id)
+sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,
+    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
 {
 	/* Do userpace accounting */
@@ -74,5 +74,5 @@
 #endif
 	
-	unative_t rc;
+	sysarg_t rc;
 	if (id < SYSCALL_END) {
 		rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
@@ -147,4 +147,5 @@
 	(syshandler_t) sys_ipc_register_irq,
 	(syshandler_t) sys_ipc_unregister_irq,
+	(syshandler_t) sys_ipc_connect_kbox,
 	
 	/* Event notification syscalls. */
@@ -169,7 +170,5 @@
 	/* Debug calls */
 	(syshandler_t) sys_debug_enable_console,
-	(syshandler_t) sys_debug_disable_console,
-	
-	(syshandler_t) sys_ipc_connect_kbox
+	(syshandler_t) sys_debug_disable_console
 };
 
Index: kernel/generic/src/sysinfo/stats.c
===================================================================
--- kernel/generic/src/sysinfo/stats.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/sysinfo/stats.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -87,5 +87,5 @@
  *
  */
-static unative_t get_stats_uptime(struct sysinfo_item *item)
+static sysarg_t get_stats_uptime(struct sysinfo_item *item)
 {
 	/* This doesn't have to be very accurate */
Index: kernel/generic/src/sysinfo/sysinfo.c
===================================================================
--- kernel/generic/src/sysinfo/sysinfo.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/sysinfo/sysinfo.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -296,5 +296,5 @@
  */
 void sysinfo_set_item_val(const char *name, sysinfo_item_t **root,
-    unative_t val)
+    sysarg_t val)
 {
 	/* Protect sysinfo tree consistency */
@@ -481,5 +481,5 @@
 		sysinfo_indent(depth);
 		
-		unative_t val;
+		sysarg_t val;
 		size_t size;
 		
@@ -494,5 +494,5 @@
 			break;
 		case SYSINFO_VAL_DATA:
-			printf("+ %s (%" PRIs" bytes)\n", cur->name,
+			printf("+ %s (%zu bytes)\n", cur->name,
 			    cur->val.data.size);
 			break;
@@ -505,5 +505,5 @@
 			/* N.B.: No data was actually returned (only a dry run) */
 			(void) cur->val.fn_data(cur, &size, true);
-			printf("+ %s (%" PRIs" bytes) [generated]\n", cur->name,
+			printf("+ %s (%zu bytes) [generated]\n", cur->name,
 			    size);
 			break;
@@ -660,5 +660,5 @@
  *
  */
-unative_t sys_sysinfo_get_tag(void *path_ptr, size_t path_size)
+sysarg_t sys_sysinfo_get_tag(void *path_ptr, size_t path_size)
 {
 	/*
@@ -679,5 +679,5 @@
 		ret.tag = SYSINFO_VAL_DATA;
 	
-	return (unative_t) ret.tag;
+	return (sysarg_t) ret.tag;
 }
 
@@ -696,5 +696,5 @@
  *
  */
-unative_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
     void *value_ptr)
 {
@@ -715,5 +715,5 @@
 		rc = EINVAL;
 	
-	return (unative_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -732,5 +732,5 @@
  *
  */
-unative_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
     void *size_ptr)
 {
@@ -752,5 +752,5 @@
 		rc = EINVAL;
 	
-	return (unative_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -774,5 +774,5 @@
  *
  */
-unative_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
     void *buffer_ptr, size_t buffer_size)
 {
@@ -797,5 +797,5 @@
 		free(ret.data.data);
 	
-	return (unative_t) rc;
+	return (sysarg_t) rc;
 }
 
Index: kernel/generic/src/time/clock.c
===================================================================
--- kernel/generic/src/time/clock.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/time/clock.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -70,5 +70,5 @@
  *
  */
-static unative_t secfrag = 0;
+static sysarg_t secfrag = 0;
 
 /** Initialize realtime clock counter
@@ -100,6 +100,6 @@
 	 *
 	 */
-	sysinfo_set_item_val("clock.cacheable", NULL, (unative_t) true);
-	sysinfo_set_item_val("clock.faddr", NULL, (unative_t) faddr);
+	sysinfo_set_item_val("clock.cacheable", NULL, (sysarg_t) true);
+	sysinfo_set_item_val("clock.faddr", NULL, (sysarg_t) faddr);
 }
 
Index: kernel/generic/src/udebug/udebug.c
===================================================================
--- kernel/generic/src/udebug/udebug.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/udebug/udebug.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -219,6 +219,6 @@
  *
  */
-void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
-    unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc,
+void udebug_syscall_event(sysarg_t a1, sysarg_t a2, sysarg_t a3,
+    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id, sysarg_t rc,
     bool end_variant)
 {
@@ -314,5 +314,5 @@
 	IPC_SET_RETVAL(call->data, 0);
 	IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
-	IPC_SET_ARG2(call->data, (unative_t) thread);
+	IPC_SET_ARG2(call->data, (sysarg_t) thread);
 	
 	/*
Index: kernel/generic/src/udebug/udebug_ipc.c
===================================================================
--- kernel/generic/src/udebug/udebug_ipc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/udebug/udebug_ipc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -210,6 +210,6 @@
 static void udebug_receive_name_read(call_t *call)
 {
-	unative_t uspace_addr;
-	unative_t to_copy;
+	sysarg_t uspace_addr;
+	sysarg_t to_copy;
 	size_t data_size;
 	size_t buf_size;
@@ -257,6 +257,6 @@
 static void udebug_receive_areas_read(call_t *call)
 {
-	unative_t uspace_addr;
-	unative_t to_copy;
+	sysarg_t uspace_addr;
+	sysarg_t to_copy;
 	size_t data_size;
 	size_t buf_size;
@@ -304,5 +304,5 @@
 {
 	thread_t *t;
-	unative_t uspace_addr;
+	sysarg_t uspace_addr;
 	int rc;
 	void *buffer;
@@ -328,5 +328,5 @@
 	   (no way to distinguish method in answer) */
 	IPC_SET_ARG1(call->data, uspace_addr);
-	IPC_SET_ARG2(call->data, 6 * sizeof(unative_t));
+	IPC_SET_ARG2(call->data, 6 * sizeof(sysarg_t));
 	call->buffer = buffer;
 
@@ -341,6 +341,6 @@
 {
 	thread_t *t;
-	unative_t uspace_addr;
-	unative_t to_copy;
+	sysarg_t uspace_addr;
+	sysarg_t to_copy;
 	void *buffer;
 	int rc;
@@ -382,6 +382,6 @@
 static void udebug_receive_mem_read(call_t *call)
 {
-	unative_t uspace_dst;
-	unative_t uspace_src;
+	sysarg_t uspace_dst;
+	sysarg_t uspace_src;
 	unsigned size;
 	void *buffer;
Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -371,5 +371,5 @@
 	
 	/* Allocate a buffer to hold thread IDs */
-	unative_t *id_buffer = malloc(buf_size + 1, 0);
+	sysarg_t *id_buffer = malloc(buf_size + 1, 0);
 	
 	mutex_lock(&TASK->udebug.lock);
@@ -385,5 +385,5 @@
 	/* Copy down the thread IDs */
 	
-	size_t max_ids = buf_size / sizeof(unative_t);
+	size_t max_ids = buf_size / sizeof(sysarg_t);
 	size_t copied_ids = 0;
 	size_t extra_ids = 0;
@@ -404,5 +404,5 @@
 		if (copied_ids < max_ids) {
 			/* Using thread struct pointer as identification hash */
-			id_buffer[copied_ids++] = (unative_t) thread;
+			id_buffer[copied_ids++] = (sysarg_t) thread;
 		} else
 			extra_ids++;
@@ -414,6 +414,6 @@
 	
 	*buffer = id_buffer;
-	*stored = copied_ids * sizeof(unative_t);
-	*needed = (copied_ids + extra_ids) * sizeof(unative_t);
+	*stored = copied_ids * sizeof(sysarg_t);
+	*needed = (copied_ids + extra_ids) * sizeof(sysarg_t);
 	
 	return 0;
@@ -463,5 +463,5 @@
 {
 	/* Prepare a buffer to hold the arguments. */
-	unative_t *arg_buffer = malloc(6 * sizeof(unative_t), 0);
+	sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0);
 	
 	/* On success, this will lock t->udebug.lock. */
@@ -478,5 +478,5 @@
 	
 	/* Copy to a local buffer before releasing the lock. */
-	memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(unative_t));
+	memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(sysarg_t));
 	
 	_thread_op_end(thread);
@@ -539,5 +539,5 @@
  *
  */
-int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer)
+int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
 {
 	/* Verify task state */
Index: kernel/test/avltree/avltree1.c
===================================================================
--- kernel/test/avltree/avltree1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/avltree/avltree1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -202,5 +202,5 @@
 	avltree_create(tree);
 	
-	TPRINTF("Inserting %" PRIs " nodes...", node_count);
+	TPRINTF("Inserting %zu nodes...", node_count);
 	
 	for (i = 0; i < node_count; i++) {
Index: kernel/test/fpu/fpu1_ia64.c
===================================================================
--- kernel/test/fpu/fpu1_ia64.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/fpu/fpu1_ia64.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -85,5 +85,5 @@
 		
 		if ((int) (100000000 * e) != E_10e8) {
-			TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
+			TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (sysarg_t) (100000000 * e), (sysarg_t) E_10e8);
 			atomic_inc(&threads_fault);
 			break;
@@ -118,5 +118,5 @@
 		
 		if ((int) (1000000 * pi) != PI_10e8) {
-			TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100));
+			TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (sysarg_t) (1000000 * pi), (sysarg_t) (PI_10e8 / 100));
 			atomic_inc(&threads_fault);
 			break;
@@ -161,5 +161,6 @@
 	
 	while (atomic_get(&threads_ok) != total) {
-		TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
+		TPRINTF("Threads left: %" PRIua "\n",
+		    total - atomic_get(&threads_ok));
 		thread_sleep(1);
 	}
Index: kernel/test/fpu/fpu1_x86.c
===================================================================
--- kernel/test/fpu/fpu1_x86.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/fpu/fpu1_x86.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -82,5 +82,6 @@
 		
 		if ((int) (100000000 * e) != E_10e8) {
-			TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
+			TPRINTF("tid%" PRIu64 ": e*10e8=%" PRIun " should be %" PRIun "\n",
+			    THREAD->tid, (sysarg_t) (100000000 * e), (sysarg_t) E_10e8);
 			atomic_inc(&threads_fault);
 			break;
@@ -115,5 +116,6 @@
 		
 		if ((int) (100000000 * pi) != PI_10e8) {
-			TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);
+			TPRINTF("tid%" PRIu64 ": pi*10e8=%" PRIun " should be %" PRIun "\n",
+			    THREAD->tid, (sysarg_t) (100000000 * pi), (sysarg_t) PI_10e8);
 			atomic_inc(&threads_fault);
 			break;
@@ -158,5 +160,5 @@
 	
 	while (atomic_get(&threads_ok) != total) {
-		TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
+		TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_ok));
 		thread_sleep(1);
 	}
Index: kernel/test/fpu/mips2.c
===================================================================
--- kernel/test/fpu/mips2.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/fpu/mips2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,5 +48,5 @@
 {
 	int i;
-	int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
+	int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
 	int after_arg __attribute__((aligned(16)));
 	
@@ -80,5 +80,5 @@
 {
 	int i;
-	int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
+	int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
 	int after_arg __attribute__((aligned(16)));
 	
@@ -123,5 +123,5 @@
 		thread_t *t;
 		
-		if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
+		if (!(t = thread_create(testit1, (void *) ((sysarg_t) 2 * i), TASK, 0, "testit1", false))) {
 			TPRINTF("could not create thread %u\n", 2 * i);
 			break;
@@ -130,5 +130,5 @@
 		total++;
 		
-		if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
+		if (!(t = thread_create(testit2, (void *) ((sysarg_t) 2 * i + 1), TASK, 0, "testit2", false))) {
 			TPRINTF("could not create thread %u\n", 2 * i + 1);
 			break;
Index: kernel/test/fpu/sse1.c
===================================================================
--- kernel/test/fpu/sse1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/fpu/sse1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,5 +48,5 @@
 {
 	int i;
-	int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
+	int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
 	int after_arg __attribute__((aligned(16)));
 	
@@ -79,5 +79,5 @@
 {
 	int i;
-	int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
+	int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
 	int after_arg __attribute__((aligned(16)));
 	
@@ -121,5 +121,5 @@
 		thread_t *t;
 		
-		if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
+		if (!(t = thread_create(testit1, (void *) ((sysarg_t) 2 * i), TASK, 0, "testit1", false))) {
 			TPRINTF("could not create thread %u\n", 2 * i);
 			break;
@@ -128,5 +128,5 @@
 		total++;
 		
-		if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
+		if (!(t = thread_create(testit2, (void *) ((sysarg_t) 2 * i + 1), TASK, 0, "testit2", false))) {
 			TPRINTF("could not create thread %u\n", 2 * i + 1);
 			break;
@@ -142,5 +142,5 @@
 	
 	while (atomic_get(&threads_ok) != total) {
-		TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
+		TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_ok));
 		thread_sleep(1);
 	}
Index: kernel/test/mm/falloc1.c
===================================================================
--- kernel/test/mm/falloc1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/mm/falloc1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -64,5 +64,6 @@
 				
 				if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
-					TPRINTF("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10);
+					TPRINTF("Block at address %p (size %dK) is not aligned\n",
+					    (void *) frames[allocated], (FRAME_SIZE << order) >> 10);
 					return "Test failed";
 				}
Index: kernel/test/mm/falloc2.c
===================================================================
--- kernel/test/mm/falloc2.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/mm/falloc2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -85,5 +85,6 @@
 				for (k = 0; k <= (((size_t) FRAME_SIZE << order) - 1); k++) {
 					if (((uint8_t *) frames[i])[k] != val) {
-						TPRINTF("Thread #%" PRIu64 " (cpu%u): Unexpected data (%c) in block %p offset %#" PRIs "\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
+						TPRINTF("Thread #%" PRIu64 " (cpu%u): Unexpected data (%c) in block %p offset %zu\n",
+						    THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
 						atomic_inc(&thread_fail);
 						goto cleanup;
@@ -121,5 +122,5 @@
 	
 	while (atomic_get(&thread_count) > 0) {
-		TPRINTF("Threads left: %ld\n", atomic_get(&thread_count));
+		TPRINTF("Threads left: %" PRIua "\n", atomic_get(&thread_count));
 		thread_sleep(1);
 	}
Index: kernel/test/mm/mapping1.c
===================================================================
--- kernel/test/mm/mapping1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/mm/mapping1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,6 +39,6 @@
 #define PAGE1  (PAGE0 + PAGE_SIZE)
 
-#define VALUE0  0x01234567
-#define VALUE1  0x89abcdef
+#define VALUE0  UINT32_C(0x01234567)
+#define VALUE1  UINT32_C(0x89abcdef)
 
 const char *test_mapping1(void)
@@ -50,20 +50,26 @@
 	frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
 	
-	TPRINTF("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
+	TPRINTF("Writing %#" PRIx32 " to physical address %p.\n",
+	    (uint32_t) VALUE0, (void *) KA2PA(frame0));
 	*((uint32_t *) frame0) = VALUE0;
 	
-	TPRINTF("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
+	TPRINTF("Writing %#" PRIx32 " to physical address %p.\n",
+	    (uint32_t) VALUE1, (void *) KA2PA(frame1));
 	*((uint32_t *) frame1) = VALUE1;
 	
-	TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
+	TPRINTF("Mapping virtual address %p to physical address %p.\n",
+	    (void *) PAGE0, (void *) KA2PA(frame0));
 	page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
 	
-	TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));
+	TPRINTF("Mapping virtual address %p to physical address %p.\n",
+	    (void *) PAGE1, (void *) KA2PA(frame1));
 	page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
 	
 	v0 = *((uint32_t *) PAGE0);
 	v1 = *((uint32_t *) PAGE1);
-	TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, v0);
-	TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, v1);
+	TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
+	    (void *) PAGE0, v0);
+	TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
+	    (void *) PAGE1, v1);
 	
 	if (v0 != VALUE0)
@@ -72,8 +78,10 @@
 		return "Value at v1 not equal to VALUE1";
 	
-	TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE0);
+	TPRINTF("Writing %#" PRIx32 " to virtual address %p.\n",
+	    (uint32_t) 0, (void *) PAGE0);
 	*((uint32_t *) PAGE0) = 0;
 	
-	TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE1);
+	TPRINTF("Writing %#" PRIx32 " to virtual address %p.\n",
+	    (uint32_t) 0, (void *) PAGE1);
 	*((uint32_t *) PAGE1) = 0;
 	
@@ -81,6 +89,8 @@
 	v1 = *((uint32_t *) PAGE1);
 	
-	TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0));	
-	TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
+	TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
+	    (void *) PAGE0, *((uint32_t *) PAGE0));
+	TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
+	    (void *) PAGE1, *((uint32_t *) PAGE1));
 	
 	if (v0 != 0)
Index: kernel/test/mm/slab1.c
===================================================================
--- kernel/test/mm/slab1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/mm/slab1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -123,5 +123,5 @@
 static void slabtest(void *data)
 {
-	int offs = (int) (unative_t) data;
+	int offs = (int) (sysarg_t) data;
 	int i, j;
 	
@@ -156,5 +156,5 @@
 	semaphore_initialize(&thr_sem, 0);
 	for (i = 0; i < THREADS; i++) {  
-		if (!(t = thread_create(slabtest, (void *) (unative_t) i, TASK, 0, "slabtest", false))) {
+		if (!(t = thread_create(slabtest, (void *) (sysarg_t) i, TASK, 0, "slabtest", false))) {
 			TPRINTF("Could not create thread %d\n", i);
 		} else
Index: kernel/test/print/print1.c
===================================================================
--- kernel/test/print/print1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/print/print1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,8 +48,4 @@
 	TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
 	
-	TPRINTF("Testing printf(\"%%s\", NULL):\n");
-	TPRINTF("Expected output: \"(NULL)\"\n");
-	TPRINTF("Real output:     \"%s\"\n\n", NULL);
-	
 	return NULL;
 }
Index: kernel/test/print/print2.c
===================================================================
--- kernel/test/print/print2.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/print/print2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -32,7 +32,7 @@
 const char *test_print2(void)
 {
-	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
-	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
-	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
+	TPRINTF("Testing printf(\"%%c\", 'a'):\n");
+	TPRINTF("Expected output: [a]\n");
+	TPRINTF("Real output:     [%c]\n\n", 'a');
 	
 	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
@@ -48,9 +48,9 @@
 	TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
 	
-	unative_t nat = 0x12345678u;
+	sysarg_t nat = UINTN_C(0x12345678);
 	
-	TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", 0x1234567887654321ll, 0x12345678, 0x1234, 0x12, nat, 0x1234567887654321ull, \"Lovely string\"):\n");
+	TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), \"Lovely string\"):\n");
 	TPRINTF("Expected output: [0x1234567887654321] [0x12345678] [0x1234] [0x12] [0x12345678] [0x1234567887654321] \"Lovely string\"\n");
-	TPRINTF("Real output:     [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", 0x1234567887654321ll, 0x12345678, 0x1234, 0x12, nat, 0x1234567887654321ull, "Lovely string");
+	TPRINTF("Real output:     [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), "Lovely string");
 	
 	return NULL;
Index: kernel/test/print/print4.c
===================================================================
--- kernel/test/print/print4.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/print/print4.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,5 +44,5 @@
 		TPRINTF("  ");
 		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wchar_t) ((group << 5) + index));
+			TPRINTF("%lc", (wint_t) ((group << 5) + index));
 		
 		TPRINTF("\n");
@@ -56,5 +56,5 @@
 		uint8_t index;
 		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wchar_t) ((group << 5) + index));
+			TPRINTF("%lc", (wint_t) ((group << 5) + index));
 		
 		TPRINTF("\n");
Index: kernel/test/print/print5.c
===================================================================
--- kernel/test/print/print5.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ kernel/test/print/print5.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2005 Josef Cejka
+ * 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.
+ */
+
+/*
+ * This test tests several features of the HelenOS
+ * printf() implementation which go beyond the POSIX
+ * specification and GNU printf() behaviour.
+ *
+ * Therefore we disable printf() argument checking by
+ * the GCC compiler in this source file to avoid false
+ * positives.
+ *
+ */
+#define NVERIFY_PRINTF
+
+#include <print.h>
+#include <test.h>
+
+const char *test_print5(void)
+{
+	TPRINTF("Testing printf(\"%%s\", NULL):\n");
+	TPRINTF("Expected output: \"(NULL)\"\n");
+	TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
+	
+	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
+	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
+	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
+	
+	return NULL;
+}
Index: kernel/test/print/print5.def
===================================================================
--- kernel/test/print/print5.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ kernel/test/print/print5.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,6 @@
+{
+	"print5",
+	"Extended printf test",
+	&test_print5,
+	true
+},
Index: kernel/test/synch/semaphore1.c
===================================================================
--- kernel/test/synch/semaphore1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/synch/semaphore1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -88,5 +88,6 @@
 		producers = (4 - i) * PRODUCERS;
 		
-		TPRINTF("Creating %d consumers and %d producers...", consumers, producers);
+		TPRINTF("Creating %" PRIua " consumers and %" PRIua " producers...",
+		    consumers, producers);
 		
 		for (j = 0; j < (CONSUMERS + PRODUCERS) / 2; j++) {
@@ -113,5 +114,6 @@
 		
 		while ((items_consumed.count != consumers) || (items_produced.count != producers)) {
-			TPRINTF("%d consumers remaining, %d producers remaining\n", consumers - items_consumed.count, producers - items_produced.count);
+			TPRINTF("%" PRIua " consumers remaining, %" PRIua " producers remaining\n",
+			    consumers - items_consumed.count, producers - items_produced.count);
 			thread_sleep(1);
 		}
Index: kernel/test/test.c
===================================================================
--- kernel/test/test.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/test.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,4 +57,5 @@
 #include <print/print3.def>
 #include <print/print4.def>
+#include <print/print5.def>
 #include <thread/thread1.def>
 	{
Index: kernel/test/test.h
===================================================================
--- kernel/test/test.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/test.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -76,4 +76,5 @@
 extern const char *test_print3(void);
 extern const char *test_print4(void);
+extern const char *test_print5(void);
 extern const char *test_thread1(void);
 
Index: kernel/test/thread/thread1.c
===================================================================
--- kernel/test/thread/thread1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ kernel/test/thread/thread1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -76,5 +76,5 @@
 	atomic_set(&finish, 0);
 	while (atomic_get(&threads_finished) < total) {
-		TPRINTF("Threads left: %d\n", total - atomic_get(&threads_finished));
+		TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_finished));
 		thread_sleep(1);
 	}
Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ tools/autotool.py	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,22 +49,38 @@
 
 PACKAGE_BINUTILS = "usually part of binutils"
-PACKAGE_GCC = "preferably version 4.4.3 or newer"
+PACKAGE_GCC = "preferably version 4.5.1 or newer"
 PACKAGE_CROSS = "use tools/toolchain.sh to build the cross-compiler toolchain"
 
 COMPILER_FAIL = "The compiler is probably not capable to compile HelenOS."
-
-PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, value) \\
+COMPILER_WARNING = "The compilation of HelenOS might fail."
+
+PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\
 	asm volatile ( \\
-		"AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t%[val]\\n" \\
+		"AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\
 		: \\
 		: [val] "n" (value) \\
 	)
 
-#define DECLARE_INTSIZE(tag, type) \\
-	AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, sizeof(unsigned type)); \\
-	AUTOTOOL_DECLARE("intsize", "signed", tag, #type, sizeof(signed type))
+#define STRING(arg)      STRING_ARG(arg)
+#define STRING_ARG(arg)  #arg
+
+#define DECLARE_BUILTIN_TYPE(tag, type) \\
+	AUTOTOOL_DECLARE("builtin", "", tag, STRING(type), "", "", sizeof(type));
+
+#define DECLARE_INTSIZE(tag, type, strc, conc) \\
+	AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, strc, conc, sizeof(unsigned type)); \\
+	AUTOTOOL_DECLARE("intsize", "signed", tag, #type, strc, conc, sizeof(signed type));
 
 int main(int argc, char *argv[])
 {
+#ifdef __SIZE_TYPE__
+	DECLARE_BUILTIN_TYPE("size", __SIZE_TYPE__);
+#endif
+#ifdef __WCHAR_TYPE__
+	DECLARE_BUILTIN_TYPE("wchar", __WCHAR_TYPE__);
+#endif
+#ifdef __WINT_TYPE__
+	DECLARE_BUILTIN_TYPE("wint", __WINT_TYPE__);
+#endif
 """
 
@@ -96,4 +112,17 @@
 	
 	sys.exit(1)
+
+def print_warning(msg):
+	"Print a bold error message"
+	
+	sys.stderr.write("\n")
+	sys.stderr.write("######################################################################\n")
+	sys.stderr.write("HelenOS build sanity check warning:\n")
+	sys.stderr.write("\n")
+	sys.stderr.write("%s\n" % "\n".join(msg))
+	sys.stderr.write("######################################################################\n")
+	sys.stderr.write("\n")
+	
+	time.sleep(5)
 
 def sandbox_enter():
@@ -186,4 +215,18 @@
 	check_app([common['STRIP'], "--version"], "GNU strip", details)
 
+def decode_value(value):
+	"Decode integer value"
+	
+	base = 10
+	
+	if ((value.startswith('$')) or (value.startswith('#'))):
+		value = value[1:]
+	
+	if (value.startswith('0x')):
+		value = value[2:]
+		base = 16
+	
+	return int(value, base)
+
 def probe_compiler(common, sizes):
 	"Generate, compile and parse probing source"
@@ -195,5 +238,5 @@
 	
 	for typedef in sizes:
-		outf.write("\tDECLARE_INTSIZE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
+		outf.write("\tDECLARE_INTSIZE(\"%s\", %s, %s, %s);\n" % (typedef['tag'], typedef['type'], typedef['strc'], typedef['conc']))
 	
 	outf.write(PROBE_TAIL)
@@ -231,4 +274,12 @@
 	signed_tags = {}
 	
+	unsigned_strcs = {}
+	signed_strcs = {}
+	
+	unsigned_concs = {}
+	signed_concs = {}
+	
+	builtins = {}
+	
 	for j in range(len(lines)):
 		tokens = lines[j].strip().split("\t")
@@ -236,5 +287,5 @@
 		if (len(tokens) > 0):
 			if (tokens[0] == "AUTOTOOL_DECLARE"):
-				if (len(tokens) < 5):
+				if (len(tokens) < 7):
 					print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
 				
@@ -243,33 +294,38 @@
 				tag = tokens[3]
 				name = tokens[4]
-				value = tokens[5]
+				strc = tokens[5]
+				conc = tokens[6]
+				value = tokens[7]
 				
 				if (category == "intsize"):
-					base = 10
-					
-					if ((value.startswith('$')) or (value.startswith('#'))):
-						value = value[1:]
-					
-					if (value.startswith('0x')):
-						value = value[2:]
-						base = 16
-					
 					try:
-						value_int = int(value, base)
+						value_int = decode_value(value)
 					except:
 						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
 					
 					if (subcategory == "unsigned"):
-						unsigned_sizes[name] = value_int
+						unsigned_sizes[value_int] = name
 						unsigned_tags[tag] = value_int
+						unsigned_strcs[value_int] = strc
+						unsigned_concs[value_int] = conc
 					elif (subcategory == "signed"):
-						signed_sizes[name] = value_int
+						signed_sizes[value_int] = name
 						signed_tags[tag] = value_int
+						signed_strcs[value_int] = strc
+						signed_concs[value_int] = conc
 					else:
 						print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL])
-	
-	return {'unsigned_sizes' : unsigned_sizes, 'signed_sizes' : signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags}
-
-def detect_uints(probe, bytes):
+				
+				if (category == "builtin"):
+					try:
+						value_int = decode_value(value)
+					except:
+						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
+					
+					builtins[tag] = {'name': name, 'value': value_int}
+	
+	return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs, 'builtins': builtins}
+
+def detect_uints(probe, bytes, tags):
 	"Detect correct types for fixed-size integer types"
 	
@@ -278,63 +334,111 @@
 	
 	for b in bytes:
+		if (not b in probe['unsigned_sizes']):
+			print_error(['Unable to find appropriate unsigned integer type for %u bytes' % b,
+			             COMPILER_FAIL])
+		
+		if (not b in probe['signed_sizes']):
+			print_error(['Unable to find appropriate signed integer type for %u bytes' % b,
+			             COMPILER_FAIL])
+		
+		if (not b in probe['unsigned_strcs']):
+			print_error(['Unable to find appropriate unsigned printf formatter for %u bytes' % b,
+			             COMPILER_FAIL])
+		
+		if (not b in probe['signed_strcs']):
+			print_error(['Unable to find appropriate signed printf formatter for %u bytes' % b,
+			             COMPILER_FAIL])
+		
+		if (not b in probe['unsigned_concs']):
+			print_error(['Unable to find appropriate unsigned literal macro for %u bytes' % b,
+			             COMPILER_FAIL])
+		
+		if (not b in probe['signed_concs']):
+			print_error(['Unable to find appropriate signed literal macro for %u bytes' % b,
+			             COMPILER_FAIL])
+		
+		typedefs.append({'oldtype': "unsigned %s" % probe['unsigned_sizes'][b], 'newtype': "uint%u_t" % (b * 8)})
+		typedefs.append({'oldtype': "signed %s" % probe['signed_sizes'][b], 'newtype': "int%u_t" % (b * 8)})
+		
+		macros.append({'oldmacro': "\"%so\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIo%u" % (b * 8)})
+		macros.append({'oldmacro': "\"%su\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIu%u" % (b * 8)})
+		macros.append({'oldmacro': "\"%sx\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIx%u" % (b * 8)})
+		macros.append({'oldmacro': "\"%sX\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIX%u" % (b * 8)})
+		macros.append({'oldmacro': "\"%sd\"" % probe['signed_strcs'][b], 'newmacro': "PRId%u" % (b * 8)})
+		
+		name = probe['unsigned_concs'][b]
+		if ((name.startswith('@')) or (name == "")):
+			macros.append({'oldmacro': "c ## U", 'newmacro': "UINT%u_C(c)" % (b * 8)})
+		else:
+			macros.append({'oldmacro': "c ## U%s" % name, 'newmacro': "UINT%u_C(c)" % (b * 8)})
+		
+		name = probe['unsigned_concs'][b]
+		if ((name.startswith('@')) or (name == "")):
+			macros.append({'oldmacro': "c", 'newmacro': "INT%u_C(c)" % (b * 8)})
+		else:
+			macros.append({'oldmacro': "c ## %s" % name, 'newmacro': "INT%u_C(c)" % (b * 8)})
+	
+	for tag in tags:
+		newmacro = "U%s" % tag
+		if (not tag in probe['unsigned_tags']):
+			print_error(['Unable to find appropriate size macro for %s' % newmacro,
+			             COMPILER_FAIL])
+		
+		oldmacro = "UINT%s" % (probe['unsigned_tags'][tag] * 8)
+		macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
+		macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
+		
+		newmacro = tag
+		if (not tag in probe['unsigned_tags']):
+			print_error(['Unable to find appropriate size macro for %s' % newmacro,
+			             COMPILER_FAIL])
+		
+		oldmacro = "INT%s" % (probe['signed_tags'][tag] * 8)
+		macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
+		macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
+	
+	fnd = True
+	
+	if (not 'wchar' in probe['builtins']):
+		print_warning(['The compiler does not provide the macro __WCHAR_TYPE__',
+		               'for defining the compiler-native type wchar_t. We are',
+		               'forced to define wchar_t as a hardwired type int32_t.',
+		               COMPILER_WARNING])
 		fnd = False
-		newtype = "uint%s_t" % (b * 8)
-		
-		for name, value in probe['unsigned_sizes'].items():
-			if (value == b):
-				oldtype = "unsigned %s" % name
-				typedefs.append({'oldtype' : oldtype, 'newtype' : newtype})
-				fnd = True
-				break
-		
-		if (not fnd):
-			print_error(['Unable to find appropriate integer type for %s' % newtype,
-			             COMPILER_FAIL])
-		
-		
+	
+	if (probe['builtins']['wchar']['value'] != 4):
+		print_warning(['The compiler provided macro __WCHAR_TYPE__ for defining',
+		               'the compiler-native type wchar_t is not compliant with',
+		               'HelenOS. We are forced to define wchar_t as a hardwired',
+		               'type int32_t.',
+		               COMPILER_WARNING])
 		fnd = False
-		newtype = "int%s_t" % (b * 8)
-		
-		for name, value in probe['signed_sizes'].items():
-			if (value == b):
-				oldtype = "signed %s" % name
-				typedefs.append({'oldtype' : oldtype, 'newtype' : newtype})
-				fnd = True
-				break
-		
-		if (not fnd):
-			print_error(['Unable to find appropriate integer type for %s' % newtype,
-			             COMPILER_FAIL])
-	
-	for tag in ['CHAR', 'SHORT', 'INT', 'LONG', 'LLONG']:
-		fnd = False;
-		newmacro = "U%s" % tag
-		
-		for name, value in probe['unsigned_tags'].items():
-			if (name == tag):
-				oldmacro = "UINT%s" % (value * 8)
-				macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
-				macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
-				fnd = True
-				break
-		
-		if (not fnd):
-			print_error(['Unable to find appropriate size macro for %s' % newmacro,
-			             COMPILER_FAIL])
-		
-		fnd = False;
-		newmacro = tag
-		
-		for name, value in probe['signed_tags'].items():
-			if (name == tag):
-				oldmacro = "INT%s" % (value * 8)
-				macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
-				macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
-				fnd = True
-				break
-		
-		if (not fnd):
-			print_error(['Unable to find appropriate size macro for %s' % newmacro,
-			             COMPILER_FAIL])
+	
+	if (not fnd):
+		macros.append({'oldmacro': "int32_t", 'newmacro': "wchar_t"})
+	else:
+		macros.append({'oldmacro': "__WCHAR_TYPE__", 'newmacro': "wchar_t"})
+	
+	fnd = True
+	
+	if (not 'wint' in probe['builtins']):
+		print_warning(['The compiler does not provide the macro __WINT_TYPE__',
+		               'for defining the compiler-native type wint_t. We are',
+		               'forced to define wint_t as a hardwired type int32_t.',
+		               COMPILER_WARNING])
+		fnd = False
+	
+	if (probe['builtins']['wint']['value'] != 4):
+		print_warning(['The compiler provided macro __WINT_TYPE__ for defining',
+		               'the compiler-native type wint_t is not compliant with',
+		               'HelenOS. We are forced to define wint_t as a hardwired',
+		               'type int32_t.',
+		               COMPILER_WARNING])
+		fnd = False
+	
+	if (not fnd):
+		macros.append({'oldmacro': "int32_t", 'newmacro': "wint_t"})
+	else:
+		macros.append({'oldmacro': "__WINT_TYPE__", 'newmacro': "wint_t"})
 	
 	return {'macros': macros, 'typedefs': typedefs}
@@ -508,13 +612,13 @@
 		probe = probe_compiler(common,
 			[
-				{'type': 'char', 'tag': 'CHAR'},
-				{'type': 'short int', 'tag': 'SHORT'},
-				{'type': 'int', 'tag': 'INT'},
-				{'type': 'long int', 'tag': 'LONG'},
-				{'type': 'long long int', 'tag': 'LLONG'}
+				{'type': 'long long int', 'tag': 'LLONG', 'strc': '"ll"', 'conc': '"LL"'},
+				{'type': 'long int', 'tag': 'LONG', 'strc': '"l"', 'conc': '"L"'},
+				{'type': 'int', 'tag': 'INT', 'strc': '""', 'conc': '""'},
+				{'type': 'short int', 'tag': 'SHORT', 'strc': '"h"', 'conc': '"@"'},
+				{'type': 'char', 'tag': 'CHAR', 'strc': '"hh"', 'conc': '"@@"'}
 			]
 		)
 		
-		maps = detect_uints(probe, [1, 2, 4, 8])
+		maps = detect_uints(probe, [1, 2, 4, 8], ['CHAR', 'SHORT', 'INT', 'LONG', 'LLONG'])
 		
 	finally:
Index: tools/check.sh
===================================================================
--- tools/check.sh	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ tools/check.sh	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,89 @@
+#! /bin/bash
+
+#
+# Copyright (c) 2010 Jakub Jermar 
+# 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.
+#
+
+if [ $1" " == "-h " ];
+then
+	echo "Perform pre-integration hands-off build of all profiles."
+	echo
+	echo "Syntax:"
+	echo " $0 [-h] [args...]"
+	echo
+	echo " -h        Print this help."
+	echo " args...   All other args are passed to make (e.g. -j 6)"
+	echo
+
+	exit
+fi
+
+FAILED=""
+PASSED=""
+PROFILES=""
+DIRS=`find defaults/ -name Makefile.config | sed 's/^defaults\/\(.*\)\/Makefile.config/\1/' | sort`
+
+for D in $DIRS;
+do
+	for H in $DIRS;
+	do
+		if [ `echo $H | grep "^$D\/.*"`x != "x"  ];
+		then
+			continue 2 
+		fi
+	done
+	PROFILES="$PROFILES $D"
+done
+
+echo ">>> Going to build the following profiles:"
+echo $PROFILES
+
+for P in $PROFILES;
+do
+	echo -n ">>>> Building $P... "
+	( make distclean && make PROFILE=$P HANDS_OFF=y $1 ) >>/dev/null 2>>/dev/null
+	if [ $? -ne 0 ];
+	then
+		FAILED="$FAILED $P"
+		echo "failed."
+	else
+		PASSED="$PASSED $P"
+		echo "ok."
+	fi
+done
+
+echo ">>> Done."
+echo
+
+echo ">>> The following profiles passed:"
+echo $PASSED
+echo
+
+echo ">>> The following profiles failed:"
+echo $FAILED
+echo
+
Index: tools/config.py
===================================================================
--- tools/config.py	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ tools/config.py	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -3,4 +3,5 @@
 # Copyright (c) 2006 Ondrej Palkovsky
 # Copyright (c) 2009 Martin Decky
+# Copyright (c) 2010 Jiri Svoboda
 # All rights reserved.
 #
@@ -40,11 +41,11 @@
 import xtui
 
-INPUT = sys.argv[1]
+RULES_FILE = sys.argv[1]
 MAKEFILE = 'Makefile.config'
 MACROS = 'config.h'
-PRECONF = 'defaults'
-
-def read_defaults(fname, defaults):
-	"Read saved values from last configuration run"
+PRESETS_DIR = 'defaults'
+
+def read_config(fname, config):
+	"Read saved values from last configuration run or a preset file"
 	
 	inf = open(fname, 'r')
@@ -52,18 +53,18 @@
 	for line in inf:
 		res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
-		if (res):
-			defaults[res.group(1)] = res.group(2)
+		if res:
+			config[res.group(1)] = res.group(2)
 	
 	inf.close()
 
-def check_condition(text, defaults, ask_names):
+def check_condition(text, config, rules):
 	"Check that the condition specified on input line is True (only CNF and DNF is supported)"
 	
 	ctype = 'cnf'
 	
-	if ((')|' in text) or ('|(' in text)):
+	if (')|' in text) or ('|(' in text):
 		ctype = 'dnf'
 	
-	if (ctype == 'cnf'):
+	if ctype == 'cnf':
 		conds = text.split('&')
 	else:
@@ -71,23 +72,23 @@
 	
 	for cond in conds:
-		if (cond.startswith('(')) and (cond.endswith(')')):
+		if cond.startswith('(') and cond.endswith(')'):
 			cond = cond[1:-1]
 		
-		inside = check_inside(cond, defaults, ctype)
+		inside = check_inside(cond, config, ctype)
 		
 		if (ctype == 'cnf') and (not inside):
 			return False
 		
-		if (ctype == 'dnf') and (inside):
+		if (ctype == 'dnf') and inside:
 			return True
 	
-	if (ctype == 'cnf'):
+	if ctype == 'cnf':
 		return True
 	return False
 
-def check_inside(text, defaults, ctype):
+def check_inside(text, config, ctype):
 	"Check for condition"
 	
-	if (ctype == 'cnf'):
+	if ctype == 'cnf':
 		conds = text.split('|')
 	else:
@@ -96,5 +97,5 @@
 	for cond in conds:
 		res = re.match(r'^(.*?)(!?=)(.*)$', cond)
-		if (not res):
+		if not res:
 			raise RuntimeError("Invalid condition: %s" % cond)
 		
@@ -103,12 +104,12 @@
 		condval = res.group(3)
 		
-		if (not condname in defaults):
+		if not condname in config:
 			varval = ''
 		else:
-			varval = defaults[condname]
+			varval = config[condname]
 			if (varval == '*'):
 				varval = 'y'
 		
-		if (ctype == 'cnf'):
+		if ctype == 'cnf':
 			if (oper == '=') and (condval == varval):
 				return True
@@ -123,11 +124,11 @@
 				return False
 	
-	if (ctype == 'cnf'):
+	if ctype == 'cnf':
 		return False
 	
 	return True
 
-def parse_config(fname, ask_names):
-	"Parse configuration file"
+def parse_rules(fname, rules):
+	"Parse rules file"
 	
 	inf = open(fname, 'r')
@@ -138,9 +139,9 @@
 	for line in inf:
 		
-		if (line.startswith('!')):
+		if line.startswith('!'):
 			# Ask a question
 			res = re.search(r'!\s*(?:\[(.*?)\])?\s*([^\s]+)\s*\((.*)\)\s*$', line)
 			
-			if (not res):
+			if not res:
 				raise RuntimeError("Weird line: %s" % line)
 			
@@ -149,10 +150,10 @@
 			vartype = res.group(3)
 			
-			ask_names.append((varname, vartype, name, choices, cond))
+			rules.append((varname, vartype, name, choices, cond))
 			name = ''
 			choices = []
 			continue
 		
-		if (line.startswith('@')):
+		if line.startswith('@'):
 			# Add new line into the 'choices' array
 			res = re.match(r'@\s*(?:\[(.*?)\])?\s*"(.*?)"\s*(.*)$', line)
@@ -164,10 +165,10 @@
 			continue
 		
-		if (line.startswith('%')):
+		if line.startswith('%'):
 			# Name of the option
 			name = line[1:].strip()
 			continue
 		
-		if ((line.startswith('#')) or (line == '\n')):
+		if line.startswith('#') or (line == '\n'):
 			# Comment or empty line
 			continue
@@ -181,5 +182,5 @@
 	"Return '*' if yes, ' ' if no"
 	
-	if (default == 'y'):
+	if default == 'y':
 		return '*'
 	
@@ -199,5 +200,5 @@
 	cnt = 0
 	for key, val in choices:
-		if ((default) and (key == default)):
+		if (default) and (key == default):
 			position = cnt
 		
@@ -207,22 +208,141 @@
 	(button, value) = xtui.choice_window(screen, name, 'Choose value', options, position)
 	
-	if (button == 'cancel'):
+	if button == 'cancel':
 		return None
 	
 	return choices[value][0]
 
-def check_choices(defaults, ask_names):
-	"Check whether all accessible variables have a default"
-	
-	for varname, vartype, name, choices, cond in ask_names:
-		if ((cond) and (not check_condition(cond, defaults, ask_names))):
+## Infer and verify configuration values.
+#
+# Augment @a config with values that can be inferred, purge invalid ones
+# and verify that all variables have a value (previously specified or inferred).
+#
+# @param config Configuration to work on
+# @param rules  Rules
+#
+# @return True if configuration is complete and valid, False
+#         otherwise.
+#
+def infer_verify_choices(config, rules):
+	"Infer and verify configuration values."
+	
+	for rule in rules:
+		varname, vartype, name, choices, cond = rule
+		
+		if cond and (not check_condition(cond, config, rules)):
 			continue
 		
-		if (not varname in defaults):
+		if not varname in config:
+			value = None
+		else:
+			value = config[varname]
+		
+		if not validate_rule_value(rule, value):
+			value = None
+		
+		default = get_default_rule(rule)
+
+		#
+		# If we don't have a value but we do have
+		# a default, use it.
+		#
+		if value == None and default != None:
+			value = default
+			config[varname] = default
+		
+		if not varname in config:
 			return False
 	
 	return True
 
-def create_output(mkname, mcname, defaults, ask_names):
+## Get default value from a rule.
+def get_default_rule(rule):
+	varname, vartype, name, choices, cond = rule
+	
+	default = None
+	
+	if vartype == 'choice':
+		# If there is just one option, use it
+		if len(choices) == 1:
+			default = choices[0][0]
+	elif vartype == 'y':
+		default = '*'
+	elif vartype == 'n':
+		default = 'n'
+	elif vartype == 'y/n':
+		default = 'y'
+	elif vartype == 'n/y':
+		default = 'n'
+	else:
+		raise RuntimeError("Unknown variable type: %s" % vartype)
+	
+	return default
+
+## Get option from a rule.
+#
+# @param rule  Rule for a variable
+# @param value Current value of the variable
+#
+# @return Option (string) to ask or None which means not to ask.
+#
+def get_rule_option(rule, value):
+	varname, vartype, name, choices, cond = rule
+	
+	option = None
+	
+	if vartype == 'choice':
+		# If there is just one option, don't ask
+		if len(choices) != 1:
+			if (value == None):
+				option = "?     %s --> " % name
+			else:
+				option = "      %s [%s] --> " % (name, value)
+	elif vartype == 'y':
+		pass
+	elif vartype == 'n':
+		pass
+	elif vartype == 'y/n':
+		option = "  <%s> %s " % (yes_no(value), name)
+	elif vartype == 'n/y':
+		option ="  <%s> %s " % (yes_no(value), name)
+	else:
+		raise RuntimeError("Unknown variable type: %s" % vartype)
+	
+	return option
+
+## Check if variable value is valid.
+#
+# @param rule  Rule for the variable
+# @param value Value of the variable
+#
+# @return True if valid, False if not valid.
+#
+def validate_rule_value(rule, value):
+	varname, vartype, name, choices, cond = rule
+	
+	if value == None:
+		return True
+	
+	if vartype == 'choice':
+		if not value in [choice[0] for choice in choices]:
+			return False
+	elif vartype == 'y':
+		if value != 'y':
+			return False
+	elif vartype == 'n':
+		if value != 'n':
+			return False
+	elif vartype == 'y/n':
+		if not value in ['y', 'n']:
+			return False
+	elif vartype == 'n/y':
+		if not value in ['y', 'n']:
+			return False
+	else:
+		raise RuntimeError("Unknown variable type: %s" % vartype)
+	
+	return True
+
+def create_output(mkname, mcname, config, rules):
 	"Create output configuration"
 	
@@ -238,7 +358,7 @@
 		sys.stderr.write("failed\n")
 	
-	if (len(version) == 3):
+	if len(version) == 3:
 		revision = version[1]
-		if (version[0] != 1):
+		if version[0] != 1:
 			revision += 'M'
 		revision += ' (%s)' % version[2]
@@ -259,26 +379,26 @@
 	defs = 'CONFIG_DEFS ='
 	
-	for varname, vartype, name, choices, cond in ask_names:
-		if ((cond) and (not check_condition(cond, defaults, ask_names))):
+	for varname, vartype, name, choices, cond in rules:
+		if cond and (not check_condition(cond, config, rules)):
 			continue
 		
-		if (not varname in defaults):
-			default = ''
+		if not varname in config:
+			value = ''
 		else:
-			default = defaults[varname]
-			if (default == '*'):
-				default = 'y'
-		
-		outmk.write('# %s\n%s = %s\n\n' % (name, varname, default))
-		
-		if ((vartype == "y") or (vartype == "n") or (vartype == "y/n") or (vartype == "n/y")):
-			if (default == "y"):
+			value = config[varname]
+			if (value == '*'):
+				value = 'y'
+		
+		outmk.write('# %s\n%s = %s\n\n' % (name, varname, value))
+		
+		if vartype in ["y", "n", "y/n", "n/y"]:
+			if value == "y":
 				outmc.write('/* %s */\n#define %s\n\n' % (name, varname))
 				defs += ' -D%s' % varname
 		else:
-			outmc.write('/* %s */\n#define %s %s\n#define %s_%s\n\n' % (name, varname, default, varname, default))
-			defs += ' -D%s=%s -D%s_%s' % (varname, default, varname, default)
-	
-	if (revision is not None):
+			outmc.write('/* %s */\n#define %s %s\n#define %s_%s\n\n' % (name, varname, value, varname, value))
+			defs += ' -D%s=%s -D%s_%s' % (varname, value, varname, value)
+	
+	if revision is not None:
 		outmk.write('REVISION = %s\n' % revision)
 		outmc.write('#define REVISION %s\n' % revision)
@@ -299,5 +419,7 @@
 	return list
 
-def read_preconfigured(root, fname, screen, defaults):
+## Ask user to choose a configuration profile.
+#
+def choose_profile(root, fname, screen, config):
 	options = []
 	opt2path = {}
@@ -309,5 +431,5 @@
 		canon = os.path.join(path, fname)
 		
-		if ((os.path.isdir(path)) and (os.path.exists(canon)) and (os.path.isfile(canon))):
+		if os.path.isdir(path) and os.path.exists(canon) and os.path.isfile(canon):
 			subprofile = False
 			
@@ -317,44 +439,91 @@
 				subcanon = os.path.join(subpath, fname)
 				
-				if ((os.path.isdir(subpath)) and (os.path.exists(subcanon)) and (os.path.isfile(subcanon))):
+				if os.path.isdir(subpath) and os.path.exists(subcanon) and os.path.isfile(subcanon):
 					subprofile = True
 					options.append("%s (%s)" % (name, subname))
-					opt2path[cnt] = (canon, subcanon)
+					opt2path[cnt] = [name, subname]
 					cnt += 1
 			
-			if (not subprofile):
+			if not subprofile:
 				options.append(name)
-				opt2path[cnt] = (canon, None)
+				opt2path[cnt] = [name]
 				cnt += 1
 	
 	(button, value) = xtui.choice_window(screen, 'Load preconfigured defaults', 'Choose configuration profile', options, None)
 	
-	if (button == 'cancel'):
+	if button == 'cancel':
 		return None
 	
-	read_defaults(opt2path[value][0], defaults)
-	if (opt2path[value][1] != None):
-		read_defaults(opt2path[value][1], defaults)
+	return opt2path[value]
+
+## Read presets from a configuration profile.
+#
+# @param profile Profile to load from (a list of string components)
+# @param config  Output configuration
+#
+def read_presets(profile, config):
+	path = os.path.join(PRESETS_DIR, profile[0], MAKEFILE)
+	read_config(path, config)
+	
+	if len(profile) > 1:
+		path = os.path.join(PRESETS_DIR, profile[0], profile[1], MAKEFILE)
+		read_config(path, config)
+
+## Parse profile name (relative OS path) into a list of components.
+#
+# @param profile_name Relative path (using OS separator)
+# @return             List of components
+#
+def parse_profile_name(profile_name):
+	profile = []
+	
+	head, tail = os.path.split(profile_name)
+	if head != '':
+		profile.append(head)
+	
+	profile.append(tail)
+	return profile
 
 def main():
-	defaults = {}
-	ask_names = []
-	
-	# Parse configuration file
-	parse_config(INPUT, ask_names)
-	
-	# Read defaults from previous run
-	if os.path.exists(MAKEFILE):
-		read_defaults(MAKEFILE, defaults)
-	
-	# Default mode: only check defaults and regenerate configuration
-	if ((len(sys.argv) >= 3) and (sys.argv[2] == 'default')):
-		if (check_choices(defaults, ask_names)):
-			create_output(MAKEFILE, MACROS, defaults, ask_names)
+	profile = None
+	config = {}
+	rules = []
+	
+	# Parse rules file
+	parse_rules(RULES_FILE, rules)
+	
+	# Input configuration file can be specified on command line
+	# otherwise configuration from previous run is used.
+	if len(sys.argv) >= 4:
+		profile = parse_profile_name(sys.argv[3])
+		read_presets(profile, config)
+	elif os.path.exists(MAKEFILE):
+		read_config(MAKEFILE, config)
+	
+	# Default mode: check values and regenerate configuration files
+	if (len(sys.argv) >= 3) and (sys.argv[2] == 'default'):
+		if (infer_verify_choices(config, rules)):
+			create_output(MAKEFILE, MACROS, config, rules)
 			return 0
 	
-	# Check mode: only check defaults
-	if ((len(sys.argv) >= 3) and (sys.argv[2] == 'check')):
-		if (check_choices(defaults, ask_names)):
+	# Hands-off mode: check values and regenerate configuration files,
+	# but no interactive fallback
+	if (len(sys.argv) >= 3) and (sys.argv[2] == 'hands-off'):
+		# We deliberately test sys.argv >= 4 because we do not want
+		# to read implicitly any possible previous run configuration
+		if len(sys.argv) < 4:
+			sys.stderr.write("Configuration error: No presets specified\n")
+			return 2
+		
+		if (infer_verify_choices(config, rules)):
+			create_output(MAKEFILE, MACROS, config, rules)
+			return 0
+		
+		sys.stderr.write("Configuration error: The presets are ambiguous\n")
+		return 1
+	
+	# Check mode: only check configuration
+	if (len(sys.argv) >= 3) and (sys.argv[2] == 'check'):
+		if infer_verify_choices(config, rules):
 			return 0
 		return 1
@@ -366,8 +535,8 @@
 		while True:
 			
-			# Cancel out all defaults which have to be deduced
-			for varname, vartype, name, choices, cond in ask_names:
-				if ((vartype == 'y') and (varname in defaults) and (defaults[varname] == '*')):
-					defaults[varname] = None
+			# Cancel out all values which have to be deduced
+			for varname, vartype, name, choices, cond in rules:
+				if (vartype == 'y') and (varname in config) and (config[varname] == '*'):
+					config[varname] = None
 			
 			options = []
@@ -377,50 +546,36 @@
 			options.append("  --- Load preconfigured defaults ... ")
 			
-			for varname, vartype, name, choices, cond in ask_names:
-				
-				if ((cond) and (not check_condition(cond, defaults, ask_names))):
+			for rule in rules:
+				varname, vartype, name, choices, cond = rule
+				
+				if cond and (not check_condition(cond, config, rules)):
 					continue
 				
-				if (varname == selname):
+				if varname == selname:
 					position = cnt
 				
-				if (not varname in defaults):
-					default = None
+				if not varname in config:
+					value = None
 				else:
-					default = defaults[varname]
-				
-				if (vartype == 'choice'):
-					# Check if the default is an acceptable value
-					if ((default) and (not default in [choice[0] for choice in choices])):
-						default = None
-						defaults.pop(varname)
-					
-					# If there is just one option, use it
-					if (len(choices) == 1):
-						defaults[varname] = choices[0][0]
-						continue
-					
-					if (default == None):
-						options.append("?     %s --> " % name)
-					else:
-						options.append("      %s [%s] --> " % (name, default))
-				elif (vartype == 'y'):
-					defaults[varname] = '*'
+					value = config[varname]
+				
+				if not validate_rule_value(rule, value):
+					value = None
+				
+				default = get_default_rule(rule)
+
+				#
+				# If we don't have a value but we do have
+				# a default, use it.
+				#
+				if value == None and default != None:
+					value = default
+					config[varname] = default
+				
+				option = get_rule_option(rule, value)
+				if option != None:
+					options.append(option)
+				else:
 					continue
-				elif (vartype == 'n'):
-					defaults[varname] = 'n'
-					continue
-				elif (vartype == 'y/n'):
-					if (default == None):
-						default = 'y'
-						defaults[varname] = default
-					options.append("  <%s> %s " % (yes_no(default), name))
-				elif (vartype == 'n/y'):
-					if (default == None):
-						default = 'n'
-						defaults[varname] = default
-					options.append("  <%s> %s " % (yes_no(default), name))
-				else:
-					raise RuntimeError("Unknown variable type: %s" % vartype)
 				
 				opt2row[cnt] = (varname, vartype, name, choices)
@@ -433,9 +588,9 @@
 			(button, value) = xtui.choice_window(screen, 'HelenOS configuration', 'Choose configuration option', options, position)
 			
-			if (button == 'cancel'):
+			if button == 'cancel':
 				return 'Configuration canceled'
 			
-			if (button == 'done'):
-				if (check_choices(defaults, ask_names)):
+			if button == 'done':
+				if (infer_verify_choices(config, rules)):
 					break
 				else:
@@ -443,31 +598,33 @@
 					continue
 			
-			if (value == 0):
-				read_preconfigured(PRECONF, MAKEFILE, screen, defaults)
+			if value == 0:
+				profile = choose_profile(PRESETS_DIR, MAKEFILE, screen, config)
+				if profile != None:
+					read_presets(profile, config)
 				position = 1
 				continue
 			
 			position = None
-			if (not value in opt2row):
+			if not value in opt2row:
 				raise RuntimeError("Error selecting value: %s" % value)
 			
 			(selname, seltype, name, choices) = opt2row[value]
 			
-			if (not selname in defaults):
-					default = None
+			if not selname in config:
+				value = None
 			else:
-				default = defaults[selname]
-			
-			if (seltype == 'choice'):
-				defaults[selname] = subchoice(screen, name, choices, default)
-			elif ((seltype == 'y/n') or (seltype == 'n/y')):
-				if (defaults[selname] == 'y'):
-					defaults[selname] = 'n'
+				value = config[selname]
+			
+			if seltype == 'choice':
+				config[selname] = subchoice(screen, name, choices, value)
+			elif (seltype == 'y/n') or (seltype == 'n/y'):
+				if config[selname] == 'y':
+					config[selname] = 'n'
 				else:
-					defaults[selname] = 'y'
+					config[selname] = 'y'
 	finally:
 		xtui.screen_done(screen)
 	
-	create_output(MAKEFILE, MACROS, defaults, ask_names)
+	create_output(MAKEFILE, MACROS, config, rules)
 	return 0
 
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,5 +46,4 @@
 	app/tasks \
 	app/tester \
-	app/test_serial \
 	app/tetris \
 	app/trace \
@@ -54,4 +53,5 @@
 	app/nettest2 \
 	app/ping \
+	app/sysinfo \
 	srv/clip \
 	srv/devmap \
@@ -86,18 +86,15 @@
 	srv/net/tl/tcp \
 	srv/net/net \
-	drv/root
+	drv/root \
+	drv/rootvirt \
+	drv/test1 \
+	drv/test2
 
 ## Networking
 #
 
-ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	LIBN = \
-		srv/net/nil/eth \
-		srv/net/nil/nildummy
-else
-	DIRS += \
-		srv/net/nil/eth \
-		srv/net/nil/nildummy
-endif
+DIRS += \
+	srv/net/nil/eth \
+	srv/net/nil/nildummy
 
 ## Platform-specific hardware support
@@ -109,8 +106,12 @@
 
 ifeq ($(UARCH),amd64)
+	DIRS += drv/rootpc
+	DIRS += drv/pciintel
+	DIRS += drv/isa
+	DIRS += drv/ns8250
 endif
 
 ifeq ($(UARCH),ia32)
-	DIRS += drv/rootia32
+	DIRS += drv/rootpc
 	DIRS += drv/pciintel
 	DIRS += drv/isa
Index: uspace/app/bdsh/cmds/builtins/builtins.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/builtins.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/bdsh/cmds/builtins/builtins.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -10,5 +10,5 @@
 #include "cd/cd_def.h"
 #include "exit/exit_def.h"
-	{NULL, NULL, NULL, NULL, NULL}
+	{NULL, NULL, NULL, NULL, 0}
 };
 
Index: uspace/app/bdsh/cmds/modules/bdd/bdd.c
===================================================================
--- uspace/app/bdsh/cmds/modules/bdd/bdd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/bdsh/cmds/modules/bdd/bdd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,4 +30,5 @@
 #include <stdlib.h>
 #include <str.h>
+#include <sys/typefmt.h>
 #include "config.h"
 #include "util.h"
@@ -122,5 +123,5 @@
 		rc = block_read_direct(handle, ba, 1, blk);
 		if (rc != EOK) {
-			printf("%s: Error reading block %llu\n", cmdname, ba);
+			printf("%s: Error reading block %" PRIuOFF64 "\n", cmdname, ba);
 			free(blk);
 			block_fini(handle);
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -95,5 +95,5 @@
 
 	if (vb)
-		printf("%d bytes to copy\n", total);
+		printf("%" PRIu64 " bytes to copy\n", total);
 
 	lseek(fd1, 0, SEEK_SET);
@@ -130,5 +130,5 @@
 		 */
 		if (res != 0) {
-			printf("\n%d more bytes than actually exist were copied\n", res);
+			printf("\n%zd more bytes than actually exist were copied\n", res);
 			goto err;
 		}
@@ -187,5 +187,5 @@
 			return CMD_SUCCESS;
 		case 'v':
-			printf("%d\n", CP_VERSION);
+			printf("%s\n", CP_VERSION);
 			return CMD_SUCCESS;
 		case 'V':
@@ -223,5 +223,5 @@
 
 	if (verbose)
-		printf("%d bytes copied\n", ret);
+		printf("%" PRId64 " bytes copied\n", ret);
 
 	if (ret >= 0)
Index: uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -168,5 +168,5 @@
 		rc = write(fd, buffer, to_write);
 		if (rc <= 0) {
-			printf("%s: Error writing file (%d).\n", cmdname, rc);
+			printf("%s: Error writing file (%zd).\n", cmdname, rc);
 			close(fd);
 			return CMD_FAILURE;
@@ -177,5 +177,5 @@
 	rc = close(fd);
 	if (rc != 0) {
-		printf("%s: Error writing file (%d).\n", cmdname, rc);
+		printf("%s: Error writing file (%zd).\n", cmdname, rc);
 		return CMD_FAILURE;
 	}
Index: uspace/app/bdsh/cmds/modules/unmount/unmount.c
===================================================================
--- uspace/app/bdsh/cmds/modules/unmount/unmount.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/bdsh/cmds/modules/unmount/unmount.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,5 +47,5 @@
 	} else {
 		help_cmd_unmount(HELP_SHORT);
-		printf("Usage:  %s <mp>\n", cmdname);
+		printf("Usage: %s <mp>\n", cmdname);
 	}
 	return;
@@ -68,5 +68,5 @@
 	rc = unmount(argv[1]);
 	if (rc != EOK) {
-		printf("Unable to unmount %s (rc=%d)\n", argv[1]);
+		printf("Unable to unmount %s (rc=%d)\n", argv[1], rc);
 		return CMD_FAILURE;
 	}
Index: uspace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/bdsh/exec.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -133,5 +133,6 @@
 	rc = task_wait(tid, &texit, &retval);
 	if (rc != EOK) {
-		printf("%s: Failed waiting for command (%s)\n", str_error(rc));
+		printf("%s: Failed waiting for command (%s)\n", progname,
+		    str_error(rc));
 	} else if (texit != TASK_EXIT_NORMAL) {
 		printf("%s: Command failed (unexpectedly terminated)\n", progname);
Index: uspace/app/edit/edit.c
===================================================================
--- uspace/app/edit/edit.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/edit/edit.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -100,6 +100,6 @@
 static bool cursor_visible;
 
-static ipcarg_t scr_rows;
-static ipcarg_t scr_columns;
+static sysarg_t scr_rows;
+static sysarg_t scr_columns;
 
 #define ROW_BUF_SIZE 4096
@@ -684,5 +684,5 @@
 	
 	int i;
-	ipcarg_t j;
+	sysarg_t j;
 	for (i = rows; i < pane.rows; ++i) {
 		console_set_pos(con, 0, i);
@@ -781,5 +781,5 @@
 			c = str_decode(row_buf, &pos, size);
 			if (c != '\t') {
-				printf("%lc", c);
+				printf("%lc", (wint_t) c);
 				s_column += 1;
 			} else {
@@ -830,5 +830,7 @@
 	int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
 	    "Ctrl-E Save As", coord.row, coord.column, fname);
-	printf("%*s", scr_columns - 1 - n, "");
+	
+	int pos = scr_columns - 1 - n;
+	printf("%*s", pos, "");
 	fflush(stdout);
 	console_set_style(con, STYLE_NORMAL);
@@ -1153,5 +1155,7 @@
 	console_set_pos(con, 0, scr_rows - 1);
 	console_set_style(con, STYLE_INVERTED);
-	printf(" %*s ", -(scr_columns - 3), str);
+	
+	int pos = -(scr_columns - 3);
+	printf(" %*s ", pos, str);
 	fflush(stdout);
 	console_set_style(con, STYLE_NORMAL);
Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/init/init.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,6 +57,6 @@
 #define DEVFS_MOUNT_POINT  "/dev"
 
-#define SCRATCH_FS_TYPE      "tmpfs"
-#define SCRATCH_MOUNT_POINT  "/scratch"
+#define TMPFS_FS_TYPE      "tmpfs"
+#define TMPFS_MOUNT_POINT  "/tmp"
 
 #define DATA_FS_TYPE      "fat"
@@ -235,9 +235,9 @@
 }
 
-static bool mount_scratch(void)
-{
-	int rc = mount(SCRATCH_FS_TYPE, SCRATCH_MOUNT_POINT, "", "", 0);
-	return mount_report("Scratch filesystem", SCRATCH_MOUNT_POINT,
-	    SCRATCH_FS_TYPE, NULL, rc);
+static bool mount_tmpfs(void)
+{
+	int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0);
+	return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT,
+	    TMPFS_FS_TYPE, NULL, rc);
 }
 
@@ -271,5 +271,5 @@
 	}
 	
-	mount_scratch();
+	mount_tmpfs();
 	
 	spawn("/srv/fhc");
Index: uspace/app/netecho/netecho.c
===================================================================
--- uspace/app/netecho/netecho.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/netecho/netecho.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -220,5 +220,5 @@
 	// check the buffer size
 	if (size <= 0) {
-		fprintf(stderr, "Receive size too small (%d). Using 1024 bytes instead.\n", size);
+		fprintf(stderr, "Receive size too small (%zu). Using 1024 bytes instead.\n", size);
 		size = 1024;
 	}
@@ -262,5 +262,5 @@
 		// check the backlog
 		if (backlog <= 0) {
-			fprintf(stderr, "Accepted sockets queue size too small (%d). Using 3 instead.\n", size);
+			fprintf(stderr, "Accepted sockets queue size too small (%zu). Using 3 instead.\n", size);
 			backlog = 3;
 		}
@@ -325,5 +325,6 @@
 						break;
 					default:
-						fprintf(stderr, "Address family %d (0x%X) is not supported.\n", address->sa_family);
+						fprintf(stderr, "Address family %u (%#x) is not supported.\n",
+						    address->sa_family, address->sa_family);
 					}
 					// parse the source address
@@ -334,5 +335,6 @@
 						} else {
 							data[length] = '\0';
-							printf("Socket %d received %d bytes from %s:%d\n%s\n", socket_id, length, address_string, port, data);
+							printf("Socket %d received %zu bytes from %s:%d\n%s\n",
+							    socket_id, length, address_string, port, data);
 						}
 					}
Index: uspace/app/netecho/print_error.c
===================================================================
--- uspace/app/netecho/print_error.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/netecho/print_error.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -164,5 +164,5 @@
 	case EDESTADDRREQ:
 		fprintf(output, "Destination address required (%d) error", error_code);
-	case TRY_AGAIN:
+	case EAGAIN:
 		fprintf(output, "Try again (%d) error", error_code);
 	default:
Index: uspace/app/nettest1/nettest1.c
===================================================================
--- uspace/app/nettest1/nettest1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/nettest1/nettest1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -356,5 +356,5 @@
 	/* Check data buffer size */
 	if (size <= 0) {
-		fprintf(stderr, "Data buffer size too small (%d). Using 1024 "
+		fprintf(stderr, "Data buffer size too small (%zu). Using 1024 "
 		    "bytes instead.\n", size);
 		size = 1024;
@@ -388,5 +388,5 @@
 		return ENOMEM;
 	}
-	socket_ids[sockets] = NULL;
+	socket_ids[sockets] = 0;
 
 	if (verbose)
@@ -410,5 +410,5 @@
 	}
 
-	printf("Tested in %d microseconds\n", tv_sub(&time_after,
+	printf("Tested in %ld microseconds\n", tv_sub(&time_after,
 	    &time_before));
 
Index: uspace/app/nettest2/nettest2.c
===================================================================
--- uspace/app/nettest2/nettest2.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/nettest2/nettest2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -302,5 +302,5 @@
 	/* Check data buffer size. */
 	if (size <= 0) {
-		fprintf(stderr, "Data buffer size too small (%d). Using 1024 "
+		fprintf(stderr, "Data buffer size too small (%zu). Using 1024 "
 		    "bytes instead.\n", size);
 		size = 1024;
@@ -336,5 +336,5 @@
 		return ENOMEM;
 	}
-	socket_ids[sockets] = NULL;
+	socket_ids[sockets] = 0;
 
 	if (verbose)
@@ -375,5 +375,5 @@
 		printf("\tOK\n");
 
-	printf("sendto + recvfrom tested in %d microseconds\n",
+	printf("sendto + recvfrom tested in %ld microseconds\n",
 	    tv_sub(&time_after, &time_before));
 
@@ -403,5 +403,5 @@
 		printf("\tOK\n");
 
-	printf("sendto, recvfrom tested in %d microseconds\n",
+	printf("sendto, recvfrom tested in %ld microseconds\n",
 	    tv_sub(&time_after, &time_before));
 
Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/ping/ping.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -337,5 +337,5 @@
 	}
 	
-	printf("PING %s (%s) %u(%u) bytes of data\n", config.dest_addr,
+	printf("PING %s (%s) %zu(%zu) bytes of data\n", config.dest_addr,
 	    config.dest_str, config.size, config.size);
 	
@@ -378,9 +378,9 @@
 		switch (result) {
 		case ICMP_ECHO:
-			printf("%u bytes from ? (?): icmp_seq=%u ttl=? time=%u.%04u\n",
+			printf("%zu bytes from ? (?): icmp_seq=%u ttl=? time=%ld.%04ld\n",
 				config.size, seq, elapsed / 1000, elapsed % 1000);
 			break;
 		case ETIMEOUT:
-			printf("%u bytes from ? (?): icmp_seq=%u Timed out\n",
+			printf("%zu bytes from ? (?): icmp_seq=%u Timed out\n",
 				config.size, seq);
 			break;
Index: uspace/app/redir/redir.c
===================================================================
--- uspace/app/redir/redir.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/redir/redir.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -78,5 +78,5 @@
 {
 	const char **args;
-	task_id_t id;
+	task_id_t id = 0;
 	int rc;
 
Index: uspace/app/stats/stats.c
===================================================================
--- uspace/app/stats/stats.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/stats/stats.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -56,10 +56,12 @@
 	
 	uint64_t sec = time.tv_sec;
-	printf("%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64, (sec % DAY) / HOUR,
-	    (sec % HOUR) / MINUTE, sec % MINUTE);
+	printf("%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64,
+	    (sec % DAY) / HOUR, (sec % HOUR) / MINUTE, sec % MINUTE);
 	
 	sysarg_t uptime = stats_get_uptime();
-	printf(", up %u days, %u hours, %u minutes, %u seconds", uptime / DAY,
-	    (uptime % DAY) / HOUR, (uptime % HOUR) / MINUTE, uptime % MINUTE);
+	printf(", up %" PRIun " days, %" PRIun " hours, "
+	    "%" PRIun " minutes, %" PRIun " seconds",
+	    uptime / DAY, (uptime % DAY) / HOUR,
+	    (uptime % HOUR) / MINUTE, uptime % MINUTE);
 	
 	size_t count;
Index: uspace/app/sysinfo/Makefile
===================================================================
--- uspace/app/sysinfo/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/sysinfo/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2010 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.
+#
+
+USPACE_PREFIX = ../..
+EXTRA_CFLAGS = -Iinclude
+BINARY = sysinfo
+
+SOURCES = \
+	sysinfo.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/sysinfo/sysinfo.c
===================================================================
--- uspace/app/sysinfo/sysinfo.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/sysinfo/sysinfo.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2010 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 sysinfo
+ * @{
+ */
+/** @file sysinfo.c
+ * @brief Print value of item from sysinfo tree.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <sysinfo.h>
+#include <sys/types.h>
+
+static int print_item_val(char *ipath);
+static int print_item_data(char *ipath);
+
+static void dump_bytes_hex(char *data, size_t size);
+static void dump_bytes_text(char *data, size_t size);
+
+static void print_syntax(void);
+
+int main(int argc, char *argv[])
+{
+	int rc;
+	char *ipath;
+	sysinfo_item_tag_t tag;
+
+	if (argc != 2) {
+		print_syntax();
+		return 1;
+	}
+
+	ipath = argv[1];
+
+	tag = sysinfo_get_tag(ipath);
+
+	/* Silence warning */
+	rc = EOK;
+
+	switch (tag) {
+	case SYSINFO_VAL_UNDEFINED:
+		printf("Error: Sysinfo item '%s' not defined.\n", ipath);
+		rc = 2;
+		break;
+	case SYSINFO_VAL_VAL:
+		rc = print_item_val(ipath);
+		break;
+	case SYSINFO_VAL_DATA:
+		rc = print_item_data(ipath);
+		break;
+	}
+
+	return rc;
+}
+
+static int print_item_val(char *ipath)
+{
+	sysarg_t value;
+	int rc;
+
+	rc = sysinfo_get_value(ipath, &value);
+	if (rc != EOK) {
+		printf("Error reading item '%s'.\n", ipath);
+		return rc;
+	}
+
+	printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath,
+	    (uint64_t) value, (uint64_t) value);
+
+	return EOK;
+}
+
+static int print_item_data(char *ipath)
+{
+	void *data;
+	size_t size;
+
+	data = sysinfo_get_data(ipath, &size);
+	if (data == NULL) {
+		printf("Error reading item '%s'.\n", ipath);
+		return -1;
+	}
+
+	printf("%s -> ", ipath);
+	dump_bytes_hex(data, size);
+	fputs(" ('", stdout);
+	dump_bytes_text(data, size);
+	fputs("')\n", stdout);
+
+	return EOK;
+}
+
+static void dump_bytes_hex(char *data, size_t size)
+{
+	size_t i;
+
+	for (i = 0; i < size; ++i) {
+		if (i > 0) putchar(' ');
+		printf("0x%02x", (uint8_t) data[i]);
+	}
+}
+
+static void dump_bytes_text(char *data, size_t size)
+{
+	wchar_t c;
+	size_t offset;
+
+	offset = 0;
+
+	while (offset < size) {
+		c = str_decode(data, &offset, size);
+		printf("%lc", (wint_t) c);
+	}
+}
+
+
+static void print_syntax(void)
+{
+	printf("Syntax: sysinfo <item_path>\n");
+}
+
+/** @}
+ */
Index: uspace/app/taskdump/taskdump.c
===================================================================
--- uspace/app/taskdump/taskdump.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/taskdump/taskdump.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -85,5 +85,5 @@
 	rc = connect_task(task_id);
 	if (rc < 0) {
-		printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
+		printf("Failed connecting to task %" PRIu64 ".\n", task_id);
 		return 1;
 	}
@@ -92,5 +92,5 @@
 	app_symtab = NULL;
 
-	printf("Dumping task '%s' (task ID %" PRIdTASKID ").\n", app_name, task_id);
+	printf("Dumping task '%s' (task ID %" PRIu64 ").\n", app_name, task_id);
 	autoload_syms();
 	putchar('\n');
@@ -126,5 +126,5 @@
 	if (rc < 0) {
 		printf("Error connecting\n");
-		printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
+		printf("ipc_connect_task(%" PRIu64 ") -> %d ", task_id, rc);
 		return rc;
 	}
@@ -168,5 +168,5 @@
 				core_file_name = *argv;
 			} else {
-				printf("Uknown option '%s'\n", arg[0]);
+				printf("Uknown option '%c'\n", arg[0]);
 				print_syntax();
 				return -1;
@@ -240,5 +240,5 @@
 	printf("Threads:\n");
 	for (i = 0; i < n_threads; i++) {
-		printf(" [%d] hash: %p\n", 1+i, thash_buf[i]);
+		printf(" [%zu] hash: %p\n", 1 + i, (void *) thash_buf[i]);
 
 		thread_dump(thash_buf[i]);
@@ -284,10 +284,10 @@
 	printf("Address space areas:\n");
 	for (i = 0; i < n_areas; i++) {
-		printf(" [%d] flags: %c%c%c%c base: %p size: %p\n", 1+i,
+		printf(" [%zu] flags: %c%c%c%c base: %p size: %zu\n", 1 + i,
 		    (ainfo_buf[i].flags & AS_AREA_READ) ? 'R' : '-',
 		    (ainfo_buf[i].flags & AS_AREA_WRITE) ? 'W' : '-',
 		    (ainfo_buf[i].flags & AS_AREA_EXEC) ? 'X' : '-',
 		    (ainfo_buf[i].flags & AS_AREA_CACHEABLE) ? 'C' : '-',
-		    ainfo_buf[i].start_addr, ainfo_buf[i].size);
+		    (void *) ainfo_buf[i].start_addr, ainfo_buf[i].size);
 	}
 
@@ -326,5 +326,6 @@
 
 	sym_pc = fmt_sym_address(pc);
-	printf("Thread %p crashed at %s. FP = %p\n", thash, sym_pc, fp);
+	printf("Thread %p crashed at %s. FP = %p\n", (void *) thash,
+	    sym_pc, (void *) fp);
 	free(sym_pc);
 
@@ -334,5 +335,5 @@
 	while (stacktrace_fp_valid(&st, fp)) {
 		sym_pc = fmt_sym_address(pc);
-		printf("  %p: %s\n", fp, sym_pc);
+		printf("  %p: %s\n", (void *) fp, sym_pc);
 		free(sym_pc);
 
@@ -457,7 +458,7 @@
 
 	if (rc == EOK) {
-		rc = asprintf(&str, "%p (%s+%p)", addr, name, offs);
+		rc = asprintf(&str, "%p (%s+%zu)", (void *) addr, name, offs);
 	} else {
-		rc = asprintf(&str, "%p", addr);
+		rc = asprintf(&str, "%p", (void *) addr);
 	}
 
Index: uspace/app/tasks/tasks.c
===================================================================
--- uspace/app/tasks/tasks.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tasks/tasks.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -77,5 +77,5 @@
 		order_suffix(stats_tasks[i].kcycles, &kcycles, &ksuffix);
 		
-		printf("%8" PRIu64 "%8u %8" PRIu64"%c %12"
+		printf("%8" PRIu64 "%8zu %8" PRIu64 "%c %12"
 		    PRIu64 "%c %12" PRIu64 "%c %s\n", stats_tasks[i].task_id,
 		    stats_tasks[i].threads, virtmem, vmsuffix, ucycles, usuffix,
@@ -160,5 +160,5 @@
 	}
 	
-	printf("%s: %u CPU(s) detected\n", NAME, count);
+	printf("%s: %zu CPU(s) detected\n", NAME, count);
 	
 	size_t i;
Index: pace/app/test_serial/Makefile
===================================================================
--- uspace/app/test_serial/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# 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.
-#
-
-USPACE_PREFIX = ../..
-BINARY = test_serial
-
-SOURCES = \
-	test_serial.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: pace/app/test_serial/test_serial.c
===================================================================
--- uspace/app/test_serial/test_serial.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,166 +1,0 @@
-/*
- * Copyright (c) 2009 Lenka Trochtova
- * 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 test_serial
- * @brief	test the serial port driver - read from the serial port
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <ipc/ipc.h>
-#include <sys/types.h>
-#include <async.h>
-#include <ipc/services.h>
-#include <ipc/devman.h>
-#include <devman.h>
-#include <device/char.h>
-#include <str.h>
-#include <ipc/serial_ctl.h>
-
-#define NAME 		"test serial"
-
-
-static void print_usage(void)
-{
-	printf("Usage: \n test_serial count \n where count is the number of "
-	    "characters to be read\n");
-}
-
-int main(int argc, char *argv[])
-{
-	if (argc != 2) {
-		printf(NAME ": incorrect number of arguments.\n");
-		print_usage();
-		return 0;
-	}
-	
-	long int cnt = strtol(argv[1], NULL, 10);
-	
-	int res;
-	res = devman_get_phone(DEVMAN_CLIENT, IPC_FLAG_BLOCKING);
-	devman_handle_t handle;
-	
-	res = devman_device_get_handle("/hw/pci0/00:01.0/com1", &handle,
-	    IPC_FLAG_BLOCKING);
-	if (EOK != res) {
-		printf(NAME ": could not get the device handle, errno = %d.\n",
-		    -res);
-		return 1;
-	}
-	
-	printf(NAME ": trying to read %d characters from device with handle "
-	    "%d.\n", cnt, handle);
-	
-	int phone = devman_device_connect(handle, IPC_FLAG_BLOCKING);
-	if (0 > phone) {
-		printf(NAME ": could not connect to the device, errno = %d.\n",
-		    -res);
-		devman_hangup_phone(DEVMAN_CLIENT);
-		return 2;
-	}
-	
-	char *buf = (char *) malloc(cnt + 1);
-	if (NULL == buf) {
-		printf(NAME ": failed to allocate the input buffer\n");
-		ipc_hangup(phone);
-		devman_hangup_phone(DEVMAN_CLIENT);
-		return 3;
-	}
-	
-	ipcarg_t old_baud, old_par, old_stop, old_word_size;
-	
-	res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
-	    &old_par, &old_word_size, &old_stop);
-	if (EOK != res) {
-		printf(NAME ": failed to get old communication parameters, "
-		    "errno = %d.\n", -res);
-		devman_hangup_phone(DEVMAN_CLIENT);
-		ipc_hangup(phone);
-		free(buf);
-		return 4;
-	}
-	
-	res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
-	    SERIAL_NO_PARITY, 8, 1);
-	if (EOK != res) {
-		printf(NAME ": failed to set communication parameters, errno = "
-		    "%d.\n", -res);
-		devman_hangup_phone(DEVMAN_CLIENT);
-		ipc_hangup(phone);
-		free(buf);
-		return 4;
-	}
-	
-	int total = 0;
-	int read = 0;
-	while (total < cnt) {
-		read = read_dev(phone, buf, cnt - total);
-		if (0 > read) {
-			printf(NAME ": failed read from device, errno = %d.\n",
-			    -read);
-			ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
-			    old_par, old_word_size, old_stop);
-			ipc_hangup(phone);
-			devman_hangup_phone(DEVMAN_CLIENT);
-			free(buf);
-			return 5;
-		}
-		total += read;
-		if (read > 0) {
-			buf[read] = 0;
-			printf(buf);
-			/*
-			 * Write data back to the device to test the opposite
-			 * direction of data transfer.
-			 */
-			write_dev(phone, buf, read);
-		} else {
-			usleep(100000);
-		}	
-	}
-	
-	const char *the_end = "\n---------\nTHE END\n---------\n";
-	write_dev(phone, (void *)the_end, str_size(the_end));
-	
-	/* restore original communication settings */
-	ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par,
-	    old_word_size, old_stop);
-	devman_hangup_phone(DEVMAN_CLIENT);
-	ipc_hangup(phone);
-	free(buf);
-	
-	return 0;
-}
-
-/** @}
- */
Index: uspace/app/tester/Makefile
===================================================================
--- uspace/app/tester/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,4 +38,5 @@
 	print/print3.c \
 	print/print4.c \
+	print/print5.c \
 	console/console1.c \
 	stdio/stdio1.c \
@@ -46,8 +47,8 @@
 	vfs/vfs1.c \
 	ipc/ping_pong.c \
-	ipc/register.c \
-	ipc/connect.c \
 	loop/loop1.c \
-	mm/malloc1.c
+	mm/malloc1.c \
+	hw/misc/virtchar1.c \
+	hw/serial/serial1.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/tester/hw/misc/virtchar1.c
===================================================================
--- uspace/app/tester/hw/misc/virtchar1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/tester/hw/misc/virtchar1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2010 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 the virtual char driver
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <inttypes.h>
+#include <errno.h>
+#include <str_error.h>
+#include <sys/types.h>
+#include <async.h>
+#include <device/char.h>
+#include <str.h>
+#include <vfs/vfs.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <device/char.h>
+#include "../../tester.h"
+
+#define DEVICE_PATH_NORMAL "/dev/devices/\\virt\\null"
+#define DEVICE_PATH_CLASSES "/dev/class/virt-null\\1"
+#define BUFFER_SIZE 64
+
+static const char *test_virtchar1_internal(const char *path)
+{
+	TPRINTF("Opening `%s'...\n", path);
+	int fd = open(path, O_RDONLY);
+	if (fd < 0) {
+		TPRINTF("   ...error: %s\n", str_error(fd));
+		if (fd == ENOENT) {
+			TPRINTF("   (error was ENOENT: " \
+			    "have you compiled test drivers?)\n");
+		}
+		return "Failed opening devman driver device for reading";
+	}
+	
+	TPRINTF("   ...file handle %d\n", fd);
+
+	TPRINTF(" Asking for phone...\n");
+	int phone = fd_phone(fd);
+	if (phone < 0) {
+		close(fd);
+		TPRINTF("   ...error: %s\n", str_error(phone));
+		return "Failed to get phone to device";
+	}
+	TPRINTF("   ...phone is %d\n", phone);
+	
+	TPRINTF(" Will try to read...\n");
+	size_t i;
+	char buffer[BUFFER_SIZE];
+	read_dev(phone, buffer, BUFFER_SIZE);
+	TPRINTF(" ...verifying that we read zeroes only...\n");
+	for (i = 0; i < BUFFER_SIZE; i++) {
+		if (buffer[i] != 0) {
+			return "Not all bytes are zeroes";
+		}
+	}
+	TPRINTF("   ...data read okay\n");
+	
+	/* Clean-up. */
+	TPRINTF(" Closing phones and file descriptors\n");
+	ipc_hangup(phone);
+	close(fd);
+	
+	return NULL;
+}
+
+const char *test_virtchar1(void)
+{;
+	const char *res;
+
+	res = test_virtchar1_internal(DEVICE_PATH_NORMAL);
+	if (res != NULL) {
+		return res;
+	}
+
+	res = test_virtchar1_internal(DEVICE_PATH_CLASSES);
+	if (res != NULL) {
+		return res;
+	}
+
+	return NULL;
+}
+
+/** @}
+ */
Index: uspace/app/tester/hw/misc/virtchar1.def
===================================================================
--- uspace/app/tester/hw/misc/virtchar1.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/tester/hw/misc/virtchar1.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,6 @@
+{
+	"virtchar1",
+	"Virtual char device test",
+	&test_virtchar1,
+	false
+},
Index: uspace/app/tester/hw/serial/serial1.c
===================================================================
--- uspace/app/tester/hw/serial/serial1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/tester/hw/serial/serial1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2009 Lenka Trochtova
+ * 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 the serial port driver - loopback test
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <inttypes.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ipc/ipc.h>
+#include <sys/types.h>
+#include <async.h>
+#include <ipc/services.h>
+#include <ipc/devman.h>
+#include <devman.h>
+#include <device/char.h>
+#include <str.h>
+#include <ipc/serial_ctl.h>
+#include "../../tester.h"
+
+#define DEFAULT_COUNT  1024
+#define DEFAULT_SLEEP  100000
+#define EOT            "####> End of transfer <####\n"
+
+const char *test_serial1(void)
+{
+	size_t cnt;
+	
+	if (test_argc < 1)
+		cnt = DEFAULT_COUNT;
+	else
+		switch (str_size_t(test_argv[0], NULL, 0, true, &cnt)) {
+		case EOK:
+			break;
+		case EINVAL:
+			return "Invalid argument, unsigned integer expected";
+		case EOVERFLOW:
+			return "Argument size overflow";
+		default:
+			return "Unexpected argument error";
+		}
+	
+	int res = devman_get_phone(DEVMAN_CLIENT, IPC_FLAG_BLOCKING);
+	
+	devman_handle_t handle;
+	res = devman_device_get_handle("/hw/pci0/00:01.0/com1", &handle,
+	    IPC_FLAG_BLOCKING);
+	if (res != EOK)
+		return "Could not get serial device handle";
+	
+	int phone = devman_device_connect(handle, IPC_FLAG_BLOCKING);
+	if (phone < 0) {
+		devman_hangup_phone(DEVMAN_CLIENT);
+		return "Unable to connect to serial device";
+	}
+	
+	char *buf = (char *) malloc(cnt + 1);
+	if (buf == NULL) {
+		ipc_hangup(phone);
+		devman_hangup_phone(DEVMAN_CLIENT);
+		return "Failed to allocate input buffer";
+	}
+	
+	sysarg_t old_baud;
+	sysarg_t old_par;
+	sysarg_t old_stop;
+	sysarg_t old_word_size;
+	
+	res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
+	    &old_par, &old_word_size, &old_stop);
+	if (res != EOK) {
+		free(buf);
+		ipc_hangup(phone);
+		devman_hangup_phone(DEVMAN_CLIENT);
+		return "Failed to get old serial communication parameters";
+	}
+	
+	res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
+	    SERIAL_NO_PARITY, 8, 1);
+	if (EOK != res) {
+		free(buf);
+		ipc_hangup(phone);
+		devman_hangup_phone(DEVMAN_CLIENT);
+		return "Failed to set serial communication parameters";
+	}
+	
+	TPRINTF("Trying to read %zu characters from serial device "
+	    "(handle=%" PRIun ")\n", cnt, handle);
+	
+	size_t total = 0;
+	while (total < cnt) {
+		ssize_t read = read_dev(phone, buf, cnt - total);
+		
+		if (read < 0) {
+			ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
+			    old_par, old_word_size, old_stop);
+			free(buf);
+			ipc_hangup(phone);
+			devman_hangup_phone(DEVMAN_CLIENT);
+			return "Failed read from serial device";
+		}
+		
+		if ((size_t) read > cnt - total) {
+			ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
+			    old_par, old_word_size, old_stop);
+			free(buf);
+			ipc_hangup(phone);
+			devman_hangup_phone(DEVMAN_CLIENT);
+			return "Read more data than expected";
+		}
+		
+		TPRINTF("Read %zd bytes\n", read);
+		
+		if (read == 0)
+			usleep(DEFAULT_SLEEP);
+		else {
+			buf[read] = 0;
+			
+			/*
+			 * Write data back to the device to test the opposite
+			 * direction of data transfer.
+			 */
+			ssize_t written = write_dev(phone, buf, read);
+			
+			if (written < 0) {
+				ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
+				    old_par, old_word_size, old_stop);
+				free(buf);
+				ipc_hangup(phone);
+				devman_hangup_phone(DEVMAN_CLIENT);
+				return "Failed write to serial device";
+			}
+			
+			if (written != read) {
+				ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
+				    old_par, old_word_size, old_stop);
+				free(buf);
+				ipc_hangup(phone);
+				devman_hangup_phone(DEVMAN_CLIENT);
+				return "Written less data than read from serial device";
+			}
+			
+			TPRINTF("Written %zd bytes\n", written);
+		}
+		
+		total += read;
+	}
+	
+	TPRINTF("Trying to write EOT banner to the serial device\n");
+	
+	size_t eot_size = str_size(EOT);
+	ssize_t written = write_dev(phone, (void *) EOT, eot_size);
+	
+	ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
+	    old_par, old_word_size, old_stop);
+	free(buf);
+	ipc_hangup(phone);
+	devman_hangup_phone(DEVMAN_CLIENT);
+	
+	if (written < 0)
+		return "Failed to write EOT banner to serial device";
+	
+	if ((size_t) written != eot_size)
+		return "Written less data than the size of the EOT banner "
+		    "to serial device";
+	
+	return NULL;
+}
+
+/** @}
+ */
Index: uspace/app/tester/hw/serial/serial1.def
===================================================================
--- uspace/app/tester/hw/serial/serial1.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/tester/hw/serial/serial1.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,6 @@
+{
+	"serial1",
+	"Serial loopback test",
+	&test_serial1,
+	false
+},
Index: pace/app/tester/ipc/connect.c
===================================================================
--- uspace/app/tester/ipc/connect.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * 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.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <atomic.h>
-#include "../tester.h"
-
-static atomic_t finish;
-
-static void callback(void *priv, int retval, ipc_call_t *data)
-{
-	atomic_set(&finish, 1);
-}
-
-const char *test_connect(void)
-{
-	TPRINTF("Connecting to %u...", IPC_TEST_SERVICE);
-	int phone = ipc_connect_me_to(PHONE_NS, IPC_TEST_SERVICE, 0, 0);
-	if (phone > 0) {
-		TPRINTF("phoneid %d\n", phone);
-	} else {
-		TPRINTF("\n");
-		return "ipc_connect_me_to() failed";
-	}
-	
-	printf("Sending synchronous message...\n");
-	int retval = ipc_call_sync_0_0(phone, IPC_TEST_METHOD);
-	TPRINTF("Received response to synchronous message\n");
-	
-	TPRINTF("Sending asynchronous message...\n");
-	atomic_set(&finish, 0);
-	ipc_call_async_0(phone, IPC_TEST_METHOD, NULL, callback, 1);
-	while (atomic_get(&finish) != 1)
-		TPRINTF(".");
-	TPRINTF("Received response to asynchronous message\n");
-	
-	TPRINTF("Hanging up...");
-	retval = ipc_hangup(phone);
-	if (retval == 0) {
-		TPRINTF("OK\n");
-	} else {
-		TPRINTF("\n");
-		return "ipc_hangup() failed";
-	}
-	
-	return NULL;
-}
Index: pace/app/tester/ipc/connect.def
===================================================================
--- uspace/app/tester/ipc/connect.def	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"connect",
-	"IPC connection test (connect to other service)",
-	&test_connect,
-	true
-},
Index: uspace/app/tester/ipc/ping_pong.c
===================================================================
--- uspace/app/tester/ipc/ping_pong.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/ipc/ping_pong.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -72,5 +72,5 @@
 	}
 	
-	TPRINTF("OK\nCompleted %llu round trips in %u seconds, %llu rt/s.\n",
+	TPRINTF("OK\nCompleted %" PRIu64 " round trips in %u seconds, %" PRIu64 " rt/s.\n",
 	    count, DURATION_SECS, count / DURATION_SECS);
 	
Index: pace/app/tester/ipc/register.c
===================================================================
--- uspace/app/tester/ipc/register.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * 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.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <async.h>
-#include <errno.h>
-#include "../tester.h"
-
-#define MAX_CONNECTIONS  50
-
-static int connections[MAX_CONNECTIONS];
-
-static void client_connection(ipc_callid_t iid, ipc_call_t *icall)
-{
-	unsigned int i;
-	
-	TPRINTF("Connected phone %#x accepting\n", icall->in_phone_hash);
-	ipc_answer_0(iid, EOK);
-	for (i = 0; i < MAX_CONNECTIONS; i++) {
-		if (!connections[i]) {
-			connections[i] = icall->in_phone_hash;
-			break;
-		}
-	}
-	
-	while (true) {
-		ipc_call_t call;
-		ipc_callid_t callid = async_get_call(&call);
-		int retval;
-		
-		switch (IPC_GET_METHOD(call)) {
-		case IPC_M_PHONE_HUNGUP:
-			TPRINTF("Phone %#x hung up\n", icall->in_phone_hash);
-			retval = 0;
-			break;
-		case IPC_TEST_METHOD:
-			TPRINTF("Received well known message from %#x: %#x\n",
-			    icall->in_phone_hash, callid);
-			ipc_answer_0(callid, EOK);
-			break;
-		default:
-			TPRINTF("Received unknown message from %#x: %#x\n",
-			    icall->in_phone_hash, callid);
-			ipc_answer_0(callid, ENOENT);
-			break;
-		}
-	}
-}
-
-const char *test_register(void)
-{
-	async_set_client_connection(client_connection);
-	
-	ipcarg_t phonead;
-	int res = ipc_connect_to_me(PHONE_NS, IPC_TEST_SERVICE, 0, 0, &phonead);
-	if (res != 0)
-		return "Failed registering IPC service";
-	
-	TPRINTF("Registered as service %u, accepting connections\n", IPC_TEST_SERVICE);
-	async_manager();
-	
-	return NULL;
-}
Index: pace/app/tester/ipc/register.def
===================================================================
--- uspace/app/tester/ipc/register.def	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"register",
-	"IPC registration test",
-	&test_register,
-	true
-},
Index: uspace/app/tester/print/print1.c
===================================================================
--- uspace/app/tester/print/print1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/print/print1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,8 +49,4 @@
 	TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
 	
-	TPRINTF("Testing printf(\"%%s\", NULL):\n");
-	TPRINTF("Expected output: \"(NULL)\"\n");
-	TPRINTF("Real output:     \"%s\"\n\n", NULL);
-	
 	return NULL;
 }
Index: uspace/app/tester/print/print2.c
===================================================================
--- uspace/app/tester/print/print2.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/print/print2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -33,7 +33,7 @@
 const char *test_print2(void)
 {
-	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
-	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
-	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
+	TPRINTF("Testing printf(\"%%c\", 'a'):\n");
+	TPRINTF("Expected output: [a]\n");
+	TPRINTF("Real output:     [%c]\n\n", 'a');
 	
 	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
Index: uspace/app/tester/print/print4.c
===================================================================
--- uspace/app/tester/print/print4.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/print/print4.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -45,5 +45,5 @@
 		TPRINTF("  ");
 		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wchar_t) ((group << 5) + index));
+			TPRINTF("%lc", (wint_t) ((group << 5) + index));
 		
 		TPRINTF("\n");
@@ -57,5 +57,5 @@
 		uint8_t index;
 		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wchar_t) ((group << 5) + index));
+			TPRINTF("%lc", (wint_t) ((group << 5) + index));
 		
 		TPRINTF("\n");
Index: uspace/app/tester/print/print5.c
===================================================================
--- uspace/app/tester/print/print5.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/tester/print/print5.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2005 Josef Cejka
+ * 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.
+ */
+
+/*
+ * This test tests several features of the HelenOS
+ * printf() implementation which go beyond the POSIX
+ * specification and GNU printf() behaviour.
+ *
+ * Therefore we disable printf() argument checking by
+ * the GCC compiler in this source file to avoid false
+ * positives.
+ *
+ */
+#define NVERIFY_PRINTF
+
+#include <stdio.h>
+#include <unistd.h>
+#include "../tester.h"
+
+const char *test_print5(void)
+{
+	TPRINTF("Testing printf(\"%%s\", NULL):\n");
+	TPRINTF("Expected output: \"(NULL)\"\n");
+	TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
+	
+	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
+	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
+	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
+	
+	return NULL;
+}
Index: uspace/app/tester/print/print5.def
===================================================================
--- uspace/app/tester/print/print5.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/app/tester/print/print5.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,6 @@
+{
+	"print1",
+	"String printf test",
+	&test_print1,
+	true
+},
Index: uspace/app/tester/stdio/stdio1.c
===================================================================
--- uspace/app/tester/stdio/stdio1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/stdio/stdio1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -60,5 +60,5 @@
 	
 	buf[cnt] = '\0';
-	TPRINTF("Read %u bytes, string \"%s\"\n", cnt, buf);
+	TPRINTF("Read %zu bytes, string \"%s\"\n", cnt, buf);
 	
 	TPRINTF("Seek to beginning...");
Index: uspace/app/tester/tester.c
===================================================================
--- uspace/app/tester/tester.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/tester.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,4 +51,5 @@
 #include "print/print3.def"
 #include "print/print4.def"
+#include "print/print5.def"
 #include "console/console1.def"
 #include "stdio/stdio1.def"
@@ -59,8 +60,8 @@
 #include "vfs/vfs1.def"
 #include "ipc/ping_pong.def"
-#include "ipc/register.def"
-#include "ipc/connect.def"
 #include "loop/loop1.def"
 #include "mm/malloc1.def"
+#include "hw/serial/serial1.def"
+#include "hw/misc/virtchar1.def"
 	{NULL, NULL, NULL, false}
 };
@@ -110,8 +111,15 @@
 	}
 	
+	unsigned int _len = (unsigned int) len;
+	if ((_len != len) || (((int) _len) < 0)) {
+		printf("Command length overflow\n");
+		return;
+	}
+	
 	for (test = tests; test->name != NULL; test++)
-		printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)"));
+		printf("%-*s %s%s\n", _len, test->name, test->desc,
+		    (test->safe ? "" : " (unsafe)"));
 	
-	printf("%-*s Run all safe tests\n", len, "*");
+	printf("%-*s Run all safe tests\n", _len, "*");
 }
 
Index: uspace/app/tester/tester.h
===================================================================
--- uspace/app/tester/tester.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/tester.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -68,4 +68,5 @@
 extern const char *test_print3(void);
 extern const char *test_print4(void);
+extern const char *test_print5(void);
 extern const char *test_console1(void);
 extern const char *test_stdio1(void);
@@ -76,8 +77,8 @@
 extern const char *test_vfs1(void);
 extern const char *test_ping_pong(void);
-extern const char *test_register(void);
-extern const char *test_connect(void);
 extern const char *test_loop1(void);
 extern const char *test_malloc1(void);
+extern const char *test_serial1(void);
+extern const char *test_virtchar1(void);
 
 extern test_t tests[];
Index: uspace/app/tester/thread/thread1.c
===================================================================
--- uspace/app/tester/thread/thread1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/thread/thread1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,4 +35,5 @@
 #include <stdio.h>
 #include <unistd.h>
+#include <inttypes.h>
 #include "../tester.h"
 
@@ -74,5 +75,6 @@
 	atomic_set(&finish, 0);
 	while (atomic_get(&threads_finished) < total) {
-		TPRINTF("Threads left: %u\n", total - atomic_get(&threads_finished));
+		TPRINTF("Threads left: %" PRIua "\n",
+		    total - atomic_get(&threads_finished));
 		sleep(1);
 	}
Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tester/vfs/vfs1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,10 +40,5 @@
 #include "../tester.h"
 
-#define FS_TYPE      "tmpfs"
-#define MOUNT_POINT  "/tmp"
-#define OPTIONS      ""
-#define FLAGS        0
-
-#define TEST_DIRECTORY  MOUNT_POINT "/testdir"
+#define TEST_DIRECTORY  "/tmp/testdir"
 #define TEST_FILE       TEST_DIRECTORY "/testfile"
 #define TEST_FILE2      TEST_DIRECTORY "/nextfile"
@@ -75,23 +70,9 @@
 const char *test_vfs1(void)
 {
-	if (mkdir(MOUNT_POINT, 0) != 0)
+	int rc;
+	if ((rc = mkdir(TEST_DIRECTORY, 0)) != 0) {
+		TPRINTF("rc=%d\n", rc);
 		return "mkdir() failed";
-	TPRINTF("Created directory %s\n", MOUNT_POINT);
-	
-	int rc = mount(FS_TYPE, MOUNT_POINT, "", OPTIONS, FLAGS);
-	switch (rc) {
-	case EOK:
-		TPRINTF("Mounted %s on %s\n", FS_TYPE, MOUNT_POINT);
-		break;
-	case EBUSY:
-		TPRINTF("(INFO) Filesystem already mounted on %s\n", MOUNT_POINT);
-		break;
-	default:
-		TPRINTF("(ERR) IPC returned errno %d (is tmpfs loaded?)\n", rc);
-		return "mount() failed";
 	}
-	
-	if (mkdir(TEST_DIRECTORY, 0) != 0)
-		return "mkdir() failed";
 	TPRINTF("Created directory %s\n", TEST_DIRECTORY);
 	
@@ -105,5 +86,5 @@
 	if (cnt < 0)
 		return "write() failed";
-	TPRINTF("Written %d bytes\n", cnt);
+	TPRINTF("Written %zd bytes\n", cnt);
 	
 	if (lseek(fd0, 0, SEEK_SET) != 0)
@@ -116,5 +97,11 @@
 			return "read() failed";
 		
-		TPRINTF("Read %d bytes: \".*s\"\n", cnt, cnt, buf);
+		int _cnt = (int) cnt;
+		if (_cnt != cnt) {
+			/* Count overflow, just to be sure. */
+			TPRINTF("Read %zd bytes\n", cnt);
+		} else {
+			TPRINTF("Read %zd bytes: \"%.*s\"\n", cnt, _cnt, buf);
+		}
 	}
 	
Index: uspace/app/tetris/input.c
===================================================================
--- uspace/app/tetris/input.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tetris/input.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -97,5 +97,5 @@
 	struct timeval starttv, endtv, *s;
 	static ipc_call_t charcall;
-	ipcarg_t rc;
+	sysarg_t rc;
 	
 	/*
Index: uspace/app/tetris/screen.c
===================================================================
--- uspace/app/tetris/screen.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tetris/screen.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -120,5 +120,5 @@
 }
 
-void moveto(ipcarg_t r, ipcarg_t c)
+void moveto(sysarg_t r, sysarg_t c)
 {
 	fflush(stdout);
@@ -135,5 +135,5 @@
 static bool get_display_color_sup(void)
 {
-	ipcarg_t ccap;
+	sysarg_t ccap;
 	int rc = console_get_color_cap(fphone(stdout), &ccap);
 	
Index: uspace/app/tetris/screen.h
===================================================================
--- uspace/app/tetris/screen.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/tetris/screen.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -53,11 +53,11 @@
 
 typedef struct {
-	ipcarg_t ws_row;
-	ipcarg_t ws_col;
+	sysarg_t ws_row;
+	sysarg_t ws_col;
 } winsize_t;
 
 extern winsize_t winsize;
 
-extern void moveto(ipcarg_t r, ipcarg_t c);
+extern void moveto(sysarg_t r, sysarg_t c);
 extern void clear_screen(void);
 
Index: uspace/app/top/input.c
===================================================================
--- uspace/app/top/input.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/top/input.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -99,5 +99,5 @@
 	struct timeval starttv, endtv, *s;
 	static ipc_call_t charcall;
-	ipcarg_t rc;
+	sysarg_t rc;
 	
 	/*
Index: uspace/app/top/screen.c
===================================================================
--- uspace/app/top/screen.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/top/screen.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,6 +47,6 @@
 #include "top.h"
 
-static ipcarg_t warn_col = 0;
-static ipcarg_t warn_row = 0;
+static sysarg_t warn_col = 0;
+static sysarg_t warn_row = 0;
 
 static void screen_style_normal(void)
@@ -62,5 +62,5 @@
 }
 
-static void screen_moveto(ipcarg_t col, ipcarg_t row)
+static void screen_moveto(sysarg_t col, sysarg_t row)
 {
 	fflush(stdout);
@@ -68,5 +68,5 @@
 }
 
-static void screen_get_pos(ipcarg_t *col, ipcarg_t *row)
+static void screen_get_pos(sysarg_t *col, sysarg_t *row)
 {
 	fflush(stdout);
@@ -74,5 +74,5 @@
 }
 
-static void screen_get_size(ipcarg_t *col, ipcarg_t *row)
+static void screen_get_size(sysarg_t *col, sysarg_t *row)
 {
 	fflush(stdout);
@@ -94,13 +94,13 @@
 static void screen_newline(void)
 {
-	ipcarg_t cols;
-	ipcarg_t rows;
+	sysarg_t cols;
+	sysarg_t rows;
 	screen_get_size(&cols, &rows);
 	
-	ipcarg_t c;
-	ipcarg_t r;
+	sysarg_t c;
+	sysarg_t r;
 	screen_get_pos(&c, &r);
 	
-	ipcarg_t i;
+	sysarg_t i;
 	for (i = c + 1; i < cols; i++)
 		puts(" ");
@@ -142,19 +142,23 @@
 static void print_string(const char *str)
 {
-	ipcarg_t cols;
-	ipcarg_t rows;
+	sysarg_t cols;
+	sysarg_t rows;
 	screen_get_size(&cols, &rows);
 	
-	ipcarg_t c;
-	ipcarg_t r;
+	sysarg_t c;
+	sysarg_t r;
 	screen_get_pos(&c, &r);
 	
-	if (c < cols)
-		printf("%.*s", cols - c - 1, str);
+	if (c < cols) {
+		int pos = cols - c - 1;
+		printf("%.*s", pos, str);
+	}
 }
 
 static inline void print_global_head(data_t *data)
 {
-	printf("top - %02lu:%02lu:%02lu up %u days, %02u:%02u:%02u, load average:",
+	printf("top - %02lu:%02lu:%02lu up "
+	    "%" PRIun " days, %02" PRIun ":%02" PRIun ":%02" PRIun ", "
+	    "load average:",
 	    data->hours, data->minutes, data->seconds,
 	    data->udays, data->uhours, data->uminutes, data->useconds);
@@ -171,5 +175,5 @@
 static inline void print_task_summary(data_t *data)
 {
-	printf("tasks: %u total", data->tasks_count);
+	printf("tasks: %zu total", data->tasks_count);
 	screen_newline();
 }
@@ -211,6 +215,6 @@
 	}
 	
-	printf("threads: %u total, %u running, %u ready, %u sleeping, %u lingering, "
-	    "%u other, %u invalid",
+	printf("threads: %zu total, %zu running, %zu ready, "
+	    "%zu sleeping, %zu lingering, %zu other, %zu invalid",
 	    total, running, ready, sleeping, lingering, other, invalid);
 	screen_newline();
@@ -278,10 +282,10 @@
 static inline void print_tasks(data_t *data)
 {
-	ipcarg_t cols;
-	ipcarg_t rows;
+	sysarg_t cols;
+	sysarg_t rows;
 	screen_get_size(&cols, &rows);
 	
-	ipcarg_t col;
-	ipcarg_t row;
+	sysarg_t col;
+	sysarg_t row;
 	screen_get_pos(&col, &row);
 	
@@ -295,5 +299,5 @@
 		order_suffix(task->virtmem, &virtmem, &virtmem_suffix);
 		
-		printf("%-8" PRIu64 " %9u %8" PRIu64 "%c ", task->task_id,
+		printf("%-8" PRIu64 " %9zu %8" PRIu64 "%c ", task->task_id,
 		    task->threads, virtmem, virtmem_suffix);
 		print_percent(perc->virtmem, 2);
@@ -325,10 +329,10 @@
 static inline void print_ipc(data_t *data)
 {
-	ipcarg_t cols;
-	ipcarg_t rows;
+	sysarg_t cols;
+	sysarg_t rows;
 	screen_get_size(&cols, &rows);
 	
-	ipcarg_t col;
-	ipcarg_t row;
+	sysarg_t col;
+	sysarg_t row;
 	screen_get_pos(&col, &row);
 	
@@ -392,10 +396,10 @@
 static inline void print_excs(data_t *data)
 {
-	ipcarg_t cols;
-	ipcarg_t rows;
+	sysarg_t cols;
+	sysarg_t rows;
 	screen_get_size(&cols, &rows);
 	
-	ipcarg_t col;
-	ipcarg_t row;
+	sysarg_t col;
+	sysarg_t row;
 	screen_get_pos(&col, &row);
 	
@@ -435,10 +439,10 @@
 static void print_help(void)
 {
-	ipcarg_t cols;
-	ipcarg_t rows;
+	sysarg_t cols;
+	sysarg_t rows;
 	screen_get_size(&cols, &rows);
 	
-	ipcarg_t col;
-	ipcarg_t row;
+	sysarg_t col;
+	sysarg_t row;
 	screen_get_pos(&col, &row);
 	
Index: uspace/app/trace/ipcp.c
===================================================================
--- uspace/app/trace/ipcp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/trace/ipcp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,5 +46,5 @@
 
 typedef struct {
-	ipcarg_t phone_hash;
+	sysarg_t phone_hash;
 	ipc_call_t question;
 	oper_t *oper;
@@ -124,5 +124,5 @@
 }
 
-static void ipc_m_print(proto_t *proto, ipcarg_t method)
+static void ipc_m_print(proto_t *proto, sysarg_t method)
 {
 	oper_t *oper;
@@ -137,9 +137,9 @@
 
 	if (oper != NULL) {
-		printf("%s (%ld)", oper->name, method);
+		printf("%s (%" PRIun ")", oper->name, method);
 		return;
 	}
 
-	printf("%ld", method);
+	printf("%" PRIun, method);
 }
 
@@ -192,5 +192,5 @@
 	unsigned long key[1];
 	oper_t *oper;
-	ipcarg_t *args;
+	sysarg_t *args;
 	int i;
 
@@ -201,10 +201,11 @@
 
 	if ((display_mask & DM_IPC) != 0) {
-		printf("Call ID: %p, phone: %d, proto: %s, method: ", hash,
-			phone, (proto ? proto->name : "n/a"));
-		ipc_m_print(proto, IPC_GET_METHOD(*call));
-		printf(" args: (%" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
-		    ", %" PRIuIPCARG ", %" PRIuIPCARG ")\n", args[1], args[2],
-		    args[3], args[4], args[5]);
+		printf("Call ID: %p, phone: %d, proto: %s, method: ",
+		    (void *) hash, phone,
+		    (proto ? proto->name : "n/a"));
+		ipc_m_print(proto, IPC_GET_IMETHOD(*call));
+		printf(" args: (%" PRIun ", %" PRIun ", %" PRIun ", "
+		    "%" PRIun ", %" PRIun ")\n",
+		    args[1], args[2], args[3], args[4], args[5]);
 	}
 
@@ -213,5 +214,5 @@
 
 		if (proto != NULL) {
-			oper = proto_get_oper(proto, IPC_GET_METHOD(*call));
+			oper = proto_get_oper(proto, IPC_GET_IMETHOD(*call));
 		} else {
 			oper = NULL;
@@ -261,12 +262,12 @@
     ipc_call_t *answer)
 {
-	ipcarg_t phone;
-	ipcarg_t method;
-	ipcarg_t service;
-	ipcarg_t retval;
+	sysarg_t phone;
+	sysarg_t method;
+	sysarg_t service;
+	sysarg_t retval;
 	proto_t *proto;
 	int cphone;
 
-	ipcarg_t *resp;
+	sysarg_t *resp;
 	oper_t *oper;
 	int i;
@@ -275,5 +276,5 @@
 
 	phone = pcall->phone_hash;
-	method = IPC_GET_METHOD(pcall->question);
+	method = IPC_GET_IMETHOD(pcall->question);
 	retval = IPC_GET_RETVAL(*answer);
 
@@ -281,8 +282,7 @@
 
 	if ((display_mask & DM_IPC) != 0) {
-		printf("Response to %p: retval=%ld, args = (%" PRIuIPCARG
-		    ", %" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
-		    ", %" PRIuIPCARG ")\n",
-		    hash, retval, IPC_GET_ARG1(*answer),
+		printf("Response to %p: retval=%" PRIdn ", args = (%" PRIun ", "
+		    "%" PRIun ", %" PRIun ", %" PRIun ", %" PRIun ")\n",
+		    (void *) hash, retval, IPC_GET_ARG1(*answer),
 		    IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
 		    IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
@@ -340,5 +340,5 @@
 		/* Not a response */
 		if ((display_mask & DM_IPC) != 0) {
-			printf("Not a response (hash %p)\n", hash);
+			printf("Not a response (hash %p)\n", (void *) hash);
 		}
 		return;
Index: uspace/app/trace/proto.c
===================================================================
--- uspace/app/trace/proto.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/trace/proto.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -53,5 +53,5 @@
 
 typedef struct {
-	ipcarg_t method;
+	sysarg_t method;
 	oper_t *oper;
 	link_t link;
Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/app/trace/trace.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -161,5 +161,5 @@
 	if (rc < 0) {
 		printf("Error connecting\n");
-		printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
+		printf("ipc_connect_task(%" PRIu64 ") -> %d ", task_id, rc);
 		return rc;
 	}
@@ -200,7 +200,7 @@
 	printf("Threads:");
 	for (i = 0; i < n_threads; i++) {
-		printf(" [%d] (hash %p)", 1+i, thread_hash_buf[i]);
-	}
-	printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t));
+		printf(" [%d] (hash %p)", 1 + i, (void *) thread_hash_buf[i]);
+	}
+	printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t));
 
 	return 0;
@@ -224,5 +224,5 @@
 	case V_HASH:
 	case V_PTR:
-		printf("%p", val);
+		printf("%p", (void *) val);
 		break;
 
@@ -248,5 +248,5 @@
 	case V_CHAR:
 		if (sval >= 0x20 && sval < 0x7f) {
-			printf("'%c'", sval);
+			printf("'%c'", (char) sval);
 		} else {
 			switch (sval) {
@@ -257,5 +257,5 @@
 			case '\t': printf("'\\t'"); break;
 			case '\\': printf("'\\\\'"); break;
-			default: printf("'\\x%02lX'", val); break;
+			default: printf("'\\x%02" PRIxn "'", val); break;
 			}
 		}
@@ -277,7 +277,7 @@
 
 	putchar('(');
-	if (n > 0) printf("%" PRIdSYSARG, sc_args[0]);
+	if (n > 0) printf("%" PRIun, sc_args[0]);
 	for (i = 1; i < n; i++) {
-		printf(", %" PRIdSYSARG, sc_args[i]);
+		printf(", %" PRIun, sc_args[i]);
 	}
 	putchar(')');
@@ -287,5 +287,5 @@
 {
 	ipc_call_t call;
-	ipcarg_t phoneid;
+	sysarg_t phoneid;
 	
 	if (sc_rc == (sysarg_t) IPC_CALLRET_FATAL ||
@@ -295,5 +295,5 @@
 	phoneid = sc_args[0];
 
-	IPC_SET_METHOD(call, sc_args[1]);
+	IPC_SET_IMETHOD(call, sc_args[1]);
 	IPC_SET_ARG1(call, sc_args[2]);
 	IPC_SET_ARG2(call, sc_args[3]);
@@ -331,5 +331,5 @@
 	phoneidx = sc_args[0];
 
-	IPC_SET_METHOD(question, sc_args[1]);
+	IPC_SET_IMETHOD(question, sc_args[1]);
 	IPC_SET_ARG1(question, sc_args[2]);
 	IPC_SET_ARG2(question, sc_args[3]);
@@ -489,5 +489,5 @@
 {
 	async_serialize_start();
-	printf("New thread, hash 0x%lx\n", hash);
+	printf("New thread, hash %p\n", (void *) hash);
 	async_serialize_end();
 
@@ -510,5 +510,6 @@
 	}
 
-	printf("Start tracing thread [%d] (hash %p).\n", thread_id, thread_hash);
+	printf("Start tracing thread [%u] (hash %p).\n",
+	    thread_id, (void *) thread_hash);
 
 	while (!abort_trace) {
@@ -516,5 +517,5 @@
 		fibril_mutex_lock(&state_lock);
 		if (paused) {
-			printf("Thread [%d] paused. Press R to resume.\n",
+			printf("Thread [%u] paused. Press R to resume.\n",
 			    thread_id);
 
@@ -522,5 +523,5 @@
 				fibril_condvar_wait(&state_cv, &state_lock);
 
-			printf("Thread [%d] resumed.\n", thread_id);
+			printf("Thread [%u] resumed.\n", thread_id);
 		}
 		fibril_mutex_unlock(&state_lock);
@@ -554,5 +555,5 @@
 				break;
 			case UDEBUG_EVENT_THREAD_E:
-				printf("Thread %p exited.\n", val0);
+				printf("Thread %" PRIun " exited.\n", val0);
 				fibril_mutex_lock(&state_lock);
 				abort_trace = true;
@@ -927,5 +928,5 @@
 				}
 			} else {
-				printf("Uknown option '%s'\n", arg[0]);
+				printf("Uknown option '%c'\n", arg[0]);
 				print_syntax();
 				return -1;
@@ -984,9 +985,9 @@
 	rc = connect_task(task_id);
 	if (rc < 0) {
-		printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
+		printf("Failed connecting to task %" PRIu64 ".\n", task_id);
 		return 1;
 	}
 
-	printf("Connected to task %" PRIdTASKID ".\n", task_id);
+	printf("Connected to task %" PRIu64 ".\n", task_id);
 
 	if (task_ldr != NULL)
Index: uspace/drv/isa/isa.c
===================================================================
--- uspace/drv/isa/isa.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/drv/isa/isa.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -282,5 +282,6 @@
 
 		printf(NAME ": added io range (addr=0x%x, size=0x%x) to "
-		    "device %s\n", addr, len, dev->name);
+		    "device %s\n", (unsigned int) addr, (unsigned int) len,
+		    dev->name);
 	}
 }
@@ -489,10 +490,10 @@
 static int isa_add_device(device_t *dev)
 {
-	printf(NAME ": isa_add_device, device handle = %d\n", dev->handle);
+	printf(NAME ": isa_add_device, device handle = %d\n",
+	    (int) dev->handle);
 
 	/* Add child devices. */
 	add_legacy_children(dev);
-	printf(NAME ": finished the enumeration of legacy devices\n",
-	    dev->handle);
+	printf(NAME ": finished the enumeration of legacy devices\n");
 
 	return EOK;
Index: uspace/drv/ns8250/ns8250.c
===================================================================
--- uspace/drv/ns8250/ns8250.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/drv/ns8250/ns8250.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -274,7 +274,7 @@
 	
 	/* Gain control over port's registers. */
-	if (pio_enable((void *) data->io_addr, REG_COUNT,
+	if (pio_enable((void *)(uintptr_t) data->io_addr, REG_COUNT,
 	    (void **) &data->port)) {
-		printf(NAME ": error - cannot gain the port %lx for device "
+		printf(NAME ": error - cannot gain the port %#" PRIx32 " for device "
 		    "%s.\n", data->io_addr, dev->name);
 		return false;
@@ -342,13 +342,13 @@
 		printf(NAME ": failed to connect to the parent driver of the "
 		    "device %s.\n", dev->name);
-		ret = EPARTY;	/* FIXME: use another EC */
+		ret = dev->parent_phone;
 		goto failed;
 	}
 	
 	/* Get hw resources. */
-	if (!get_hw_resources(dev->parent_phone, &hw_resources)) {
+	ret = get_hw_resources(dev->parent_phone, &hw_resources);
+	if (ret != EOK) {
 		printf(NAME ": failed to get hw resources for the device "
 		    "%s.\n", dev->name);
-		ret = EPARTY;	/* FIXME: use another EC */
 		goto failed;
 	}
@@ -374,5 +374,5 @@
 				printf(NAME ": i/o range assigned to the device "
 				    "%s is too small.\n", dev->name);
-				ret = EPARTY;	/* FIXME: use another EC */
+				ret = ELIMIT;
 				goto failed;
 			}
@@ -390,5 +390,5 @@
 		printf(NAME ": missing hw resource(s) for the device %s.\n",
 		    dev->name);
-		ret = EPARTY;	/* FIXME: use another EC */
+		ret = ENOENT;
 		goto failed;
 	}
@@ -727,5 +727,5 @@
 {
 	printf(NAME ": ns8250_add_device %s (handle = %d)\n",
-	    dev->name, dev->handle);
+	    dev->name, (int) dev->handle);
 	
 	int res = ns8250_dev_initialize(dev);
@@ -887,5 +887,5 @@
     ipc_call_t *call)
 {
-	ipcarg_t method = IPC_GET_METHOD(*call);
+	sysarg_t method = IPC_GET_IMETHOD(*call);
 	int ret;
 	unsigned int baud_rate, parity, word_length, stop_bits;
Index: uspace/drv/pciintel/pci.c
===================================================================
--- uspace/drv/pciintel/pci.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/drv/pciintel/pci.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -323,6 +323,6 @@
 	if (range_addr != 0) {
 		printf(NAME ": device %s : ", dev->name);
-		printf("address = %x", range_addr);
-		printf(", size = %x\n", range_size);
+		printf("address = %" PRIx64, range_addr);
+		printf(", size = %x\n", (unsigned int) range_size);
 	}
 	
@@ -452,4 +452,6 @@
 static int pci_add_device(device_t *dev)
 {
+	int rc;
+
 	printf(NAME ": pci_add_device\n");
 	
@@ -466,18 +468,19 @@
 		    "parent's driver.\n");
 		delete_pci_bus_data(bus_data);
-		return EPARTY;	/* FIXME: use another EC */
+		return dev->parent_phone;
 	}
 	
 	hw_resource_list_t hw_resources;
 	
-	if (!get_hw_resources(dev->parent_phone, &hw_resources)) {
+	rc = get_hw_resources(dev->parent_phone, &hw_resources);
+	if (rc != EOK) {
 		printf(NAME ": pci_add_device failed to get hw resources for "
 		    "the device.\n");
 		delete_pci_bus_data(bus_data);
 		ipc_hangup(dev->parent_phone);
-		return EPARTY;	/* FIXME: use another EC */
+		return rc;
 	}	
 	
-	printf(NAME ": conf_addr = %x.\n",
+	printf(NAME ": conf_addr = %" PRIx64 ".\n",
 	    hw_resources.resources[0].res.io_range.address);
 	
@@ -489,5 +492,5 @@
 	    (uint32_t) hw_resources.resources[0].res.io_range.address;
 	
-	if (pio_enable((void *)bus_data->conf_io_addr, 8,
+	if (pio_enable((void *)(uintptr_t)bus_data->conf_io_addr, 8,
 	    &bus_data->conf_addr_port)) {
 		printf(NAME ": failed to enable configuration ports.\n");
Index: uspace/drv/root/root.c
===================================================================
--- uspace/drv/root/root.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/drv/root/root.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2010 Lenka Trochtova
+ * Copyright (c) 2010 Vojtech Horky
  * All rights reserved.
  *
@@ -45,4 +46,6 @@
 #include <ctype.h>
 #include <macros.h>
+#include <inttypes.h>
+#include <sysinfo.h>
 
 #include <driver.h>
@@ -51,4 +54,12 @@
 
 #define NAME "root"
+
+#define PLATFORM_DEVICE_NAME "hw"
+#define PLATFORM_DEVICE_MATCH_ID_FMT "platform/%s"
+#define PLATFORM_DEVICE_MATCH_SCORE 100
+
+#define VIRTUAL_DEVICE_NAME "virt"
+#define VIRTUAL_DEVICE_MATCH_ID "rootvirt"
+#define VIRTUAL_DEVICE_MATCH_SCORE 100
 
 static int root_add_device(device_t *dev);
@@ -65,4 +76,21 @@
 };
 
+/** Create the device which represents the root of virtual device tree.
+ *
+ * @param parent Parent of the newly created device.
+ * @return Error code.
+ */
+static int add_virtual_root_child(device_t *parent)
+{
+	printf(NAME ": adding new child for virtual devices.\n");
+	printf(NAME ":   device node is `%s' (%d %s)\n", VIRTUAL_DEVICE_NAME,
+	    VIRTUAL_DEVICE_MATCH_SCORE, VIRTUAL_DEVICE_MATCH_ID);
+
+	int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME,
+	    VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE);
+
+	return res;
+}
+
 /** Create the device which represents the root of HW device tree.
  *
@@ -72,48 +100,42 @@
 static int add_platform_child(device_t *parent)
 {
+	char *match_id;
+	char *platform;
+	size_t platform_size;
+	int res;
+
+	/* Get platform name from sysinfo. */
+
+	platform = sysinfo_get_data("platform", &platform_size);
+	if (platform == NULL) {
+		printf(NAME ": Failed to obtain platform name.\n");
+		return ENOENT;
+	}
+
+	/* Null-terminate string. */
+	platform = realloc(platform, platform_size + 1);
+	if (platform == NULL) {
+		printf(NAME ": Memory allocation failed.\n");
+		return ENOMEM;
+	}
+
+	platform[platform_size] = '\0';
+
+	/* Construct match ID. */
+
+	if (asprintf(&match_id, PLATFORM_DEVICE_MATCH_ID_FMT, platform) == -1) {
+		printf(NAME ": Memory allocation failed.\n");
+		return ENOMEM;
+	}
+
+	/* Add child. */
+
 	printf(NAME ": adding new child for platform device.\n");
-	
-	int res = EOK;
-	device_t *platform = NULL;
-	match_id_t *match_id = NULL;
-	
-	/* Create new device. */
-	platform = create_device();
-	if (NULL == platform) {
-		res = ENOMEM;
-		goto failure;
-	}	
-	
-	platform->name = "hw";
-	printf(NAME ": the new device's name is %s.\n", platform->name);
-	
-	/* Initialize match id list. */
-	match_id = create_match_id();
-	if (NULL == match_id) {
-		res = ENOMEM;
-		goto failure;
-	}
-	
-	/* TODO - replace this with some better solution (sysinfo ?) */
-	match_id->id = STRING(UARCH);
-	match_id->score = 100;
-	add_match_id(&platform->match_ids, match_id);
-	
-	/* Register child device. */
-	res = child_device_register(platform, parent);
-	if (EOK != res)
-		goto failure;
-	
-	return res;
-	
-failure:
-	if (NULL != match_id)
-		match_id->id = NULL;
-	
-	if (NULL != platform) {
-		platform->name = NULL;
-		delete_device(platform);
-	}
-	
+	printf(NAME ":   device node is `%s' (%d %s)\n", PLATFORM_DEVICE_NAME,
+	    PLATFORM_DEVICE_MATCH_SCORE, match_id);
+
+	res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME,
+	    match_id, PLATFORM_DEVICE_MATCH_SCORE);
+
 	return res;
 }
@@ -126,6 +148,14 @@
 static int root_add_device(device_t *dev)
 {
-	printf(NAME ": root_add_device, device handle = %d\n", dev->handle);
+	printf(NAME ": root_add_device, device handle=%" PRIun "\n",
+	    dev->handle);
 	
+	/*
+	 * Register virtual devices root.
+	 * We ignore error occurrence because virtual devices shall not be
+	 * vital for the system.
+	 */
+	add_virtual_root_child(dev);
+
 	/* Register root device's children. */
 	int res = add_platform_child(dev);
Index: pace/drv/rootia32/Makefile
===================================================================
--- uspace/drv/rootia32/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# 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.
-#
-
-USPACE_PREFIX = ../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
-BINARY = rootia32
-
-SOURCES = \
-	rootia32.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: pace/drv/rootia32/rootia32.c
===================================================================
--- uspace/drv/rootia32/rootia32.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,204 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * 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.
- */
-
-/**
- * @defgroup root_ia32 Root HW device driver for ia32 platform.
- * @brief HelenOS root HW device driver for ia32 platform.
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <driver.h>
-#include <devman.h>
-#include <ipc/devman.h>
-#include <ipc/dev_iface.h>
-#include <resource.h>
-#include <device/hw_res.h>
-
-#define NAME "rootia32"
-
-typedef struct rootia32_child_dev_data {
-	hw_resource_list_t hw_resources;
-} rootia32_child_dev_data_t;
-
-static int rootia32_add_device(device_t *dev);
-static void root_ia32_init(void);
-
-/** The root device driver's standard operations. */
-static driver_ops_t rootia32_ops = {
-	.add_device = &rootia32_add_device
-};
-
-/** The root device driver structure. */
-static driver_t rootia32_driver = {
-	.name = NAME,
-	.driver_ops = &rootia32_ops
-};
-
-static hw_resource_t pci_conf_regs = {
-	.type = IO_RANGE,
-	.res.io_range = {
-		.address = 0xCF8,
-		.size = 8,
-		.endianness = LITTLE_ENDIAN
-	}
-};
-
-static rootia32_child_dev_data_t pci_data = {
-	.hw_resources = {
-		1,
-		&pci_conf_regs
-	}
-};
-
-static hw_resource_list_t *rootia32_get_child_resources(device_t *dev)
-{
-	rootia32_child_dev_data_t *data;
-	
-	data = (rootia32_child_dev_data_t *) dev->driver_data;
-	if (NULL == data)
-		return NULL;
-	
-	return &data->hw_resources;
-}
-
-static bool rootia32_enable_child_interrupt(device_t *dev)
-{
-	/* TODO */
-	
-	return false;
-}
-
-static resource_iface_t child_res_iface = {
-	&rootia32_get_child_resources,
-	&rootia32_enable_child_interrupt
-};
-
-/* Initialized in root_ia32_init() function. */
-static device_ops_t rootia32_child_ops;
-
-static bool
-rootia32_add_child(device_t *parent, const char *name, const char *str_match_id,
-    rootia32_child_dev_data_t *drv_data)
-{
-	printf(NAME ": adding new child device '%s'.\n", name);
-	
-	device_t *child = NULL;
-	match_id_t *match_id = NULL;
-	
-	/* Create new device. */
-	child = create_device();
-	if (NULL == child)
-		goto failure;
-	
-	child->name = name;
-	child->driver_data = drv_data;
-	
-	/* Initialize match id list */
-	match_id = create_match_id();
-	if (NULL == match_id)
-		goto failure;
-	
-	match_id->id = str_match_id;
-	match_id->score = 100;
-	add_match_id(&child->match_ids, match_id);
-	
-	/* Set provided operations to the device. */
-	child->ops = &rootia32_child_ops;
-	
-	/* Register child device. */
-	if (EOK != child_device_register(child, parent))
-		goto failure;
-	
-	return true;
-	
-failure:
-	if (NULL != match_id)
-		match_id->id = NULL;
-	
-	if (NULL != child) {
-		child->name = NULL;
-		delete_device(child);
-	}
-	
-	printf(NAME ": failed to add child device '%s'.\n", name);
-	
-	return false;
-}
-
-static bool rootia32_add_children(device_t *dev)
-{
-	return rootia32_add_child(dev, "pci0", "intel_pci", &pci_data);
-}
-
-/** Get the root device.
- *
- * @param dev		The device which is root of the whole device tree (both
- *			of HW and pseudo devices).
- * @return		Zero on success, negative error number otherwise.
- */
-static int rootia32_add_device(device_t *dev)
-{
-	printf(NAME ": rootia32_add_device, device handle = %d\n", dev->handle);
-	
-	/* Register child devices. */
-	if (!rootia32_add_children(dev)) {
-		printf(NAME ": failed to add child devices for platform "
-		    "ia32.\n");
-	}
-	
-	return EOK;
-}
-
-static void root_ia32_init(void)
-{
-	rootia32_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS rootia32 device driver\n");
-	root_ia32_init();
-	return driver_main(&rootia32_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/rootia32/rootia32.ma
===================================================================
--- uspace/drv/rootia32/rootia32.ma	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 ia32
Index: uspace/drv/rootpc/Makefile
===================================================================
--- uspace/drv/rootpc/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootpc/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2010 Lenka Trochtova
+# 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.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBDRV_PREFIX)/libdrv.a
+EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
+BINARY = rootpc
+
+SOURCES = \
+	rootpc.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/rootpc/rootpc.c
===================================================================
--- uspace/drv/rootpc/rootpc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootpc/rootpc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2010 Lenka Trochtova
+ * 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.
+ */
+
+/**
+ * @defgroup root_pc PC platform driver.
+ * @brief HelenOS PC platform driver.
+ * @{
+ */
+
+/** @file
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include <bool.h>
+#include <fibril_synch.h>
+#include <stdlib.h>
+#include <str.h>
+#include <ctype.h>
+#include <macros.h>
+
+#include <driver.h>
+#include <devman.h>
+#include <ipc/devman.h>
+#include <ipc/dev_iface.h>
+#include <resource.h>
+#include <device/hw_res.h>
+
+#define NAME "rootpc"
+
+typedef struct rootpc_child_dev_data {
+	hw_resource_list_t hw_resources;
+} rootpc_child_dev_data_t;
+
+static int rootpc_add_device(device_t *dev);
+static void root_pc_init(void);
+
+/** The root device driver's standard operations. */
+static driver_ops_t rootpc_ops = {
+	.add_device = &rootpc_add_device
+};
+
+/** The root device driver structure. */
+static driver_t rootpc_driver = {
+	.name = NAME,
+	.driver_ops = &rootpc_ops
+};
+
+static hw_resource_t pci_conf_regs = {
+	.type = IO_RANGE,
+	.res.io_range = {
+		.address = 0xCF8,
+		.size = 8,
+		.endianness = LITTLE_ENDIAN
+	}
+};
+
+static rootpc_child_dev_data_t pci_data = {
+	.hw_resources = {
+		1,
+		&pci_conf_regs
+	}
+};
+
+static hw_resource_list_t *rootpc_get_child_resources(device_t *dev)
+{
+	rootpc_child_dev_data_t *data;
+	
+	data = (rootpc_child_dev_data_t *) dev->driver_data;
+	if (NULL == data)
+		return NULL;
+	
+	return &data->hw_resources;
+}
+
+static bool rootpc_enable_child_interrupt(device_t *dev)
+{
+	/* TODO */
+	
+	return false;
+}
+
+static resource_iface_t child_res_iface = {
+	&rootpc_get_child_resources,
+	&rootpc_enable_child_interrupt
+};
+
+/* Initialized in root_pc_init() function. */
+static device_ops_t rootpc_child_ops;
+
+static bool
+rootpc_add_child(device_t *parent, const char *name, const char *str_match_id,
+    rootpc_child_dev_data_t *drv_data)
+{
+	printf(NAME ": adding new child device '%s'.\n", name);
+	
+	device_t *child = NULL;
+	match_id_t *match_id = NULL;
+	
+	/* Create new device. */
+	child = create_device();
+	if (NULL == child)
+		goto failure;
+	
+	child->name = name;
+	child->driver_data = drv_data;
+	
+	/* Initialize match id list */
+	match_id = create_match_id();
+	if (NULL == match_id)
+		goto failure;
+	
+	match_id->id = str_match_id;
+	match_id->score = 100;
+	add_match_id(&child->match_ids, match_id);
+	
+	/* Set provided operations to the device. */
+	child->ops = &rootpc_child_ops;
+	
+	/* Register child device. */
+	if (EOK != child_device_register(child, parent))
+		goto failure;
+	
+	return true;
+	
+failure:
+	if (NULL != match_id)
+		match_id->id = NULL;
+	
+	if (NULL != child) {
+		child->name = NULL;
+		delete_device(child);
+	}
+	
+	printf(NAME ": failed to add child device '%s'.\n", name);
+	
+	return false;
+}
+
+static bool rootpc_add_children(device_t *dev)
+{
+	return rootpc_add_child(dev, "pci0", "intel_pci", &pci_data);
+}
+
+/** Get the root device.
+ *
+ * @param dev		The device which is root of the whole device tree (both
+ *			of HW and pseudo devices).
+ * @return		Zero on success, negative error number otherwise.
+ */
+static int rootpc_add_device(device_t *dev)
+{
+	printf(NAME ": rootpc_add_device, device handle = %d\n",
+	    (int)dev->handle);
+	
+	/* Register child devices. */
+	if (!rootpc_add_children(dev)) {
+		printf(NAME ": failed to add child devices for PC platform.\n");
+	}
+	
+	return EOK;
+}
+
+static void root_pc_init(void)
+{
+	rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
+}
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": HelenOS PC platform driver\n");
+	root_pc_init();
+	return driver_main(&rootpc_driver);
+}
+
+/**
+ * @}
+ */
Index: uspace/drv/rootpc/rootpc.ma
===================================================================
--- uspace/drv/rootpc/rootpc.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootpc/rootpc.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,1 @@
+10 platform/pc
Index: uspace/drv/rootvirt/Makefile
===================================================================
--- uspace/drv/rootvirt/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootvirt/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2010 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.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBDRV_PREFIX)/libdrv.a
+EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
+BINARY = rootvirt
+
+SOURCES = \
+	rootvirt.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/rootvirt/devices.def
===================================================================
--- uspace/drv/rootvirt/devices.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootvirt/devices.def	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,23 @@
+/*
+ * Add list of virtual devices you want to launch driver for here.
+ *
+ * Unless the list is empty, the last item shall be followed by a comma.
+ */
+#ifdef CONFIG_TEST_DRIVERS
+{
+	.name = "test1",
+	.match_id = "virtual&test1"
+},
+{
+	.name = "test2alpha",
+	.match_id = "virtual&test2"
+},
+{
+	.name = "test2bravo",
+	.match_id = "virtual&test2"
+},
+{
+	.name = "null",
+	.match_id = "virtual&test1"
+},
+#endif
Index: uspace/drv/rootvirt/rootvirt.c
===================================================================
--- uspace/drv/rootvirt/rootvirt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootvirt/rootvirt.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+/**
+ * @defgroup rootvirt Root device driver for virtual devices.
+ * @{
+ */
+
+/** @file
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include <str_error.h>
+#include <driver.h>
+
+#define NAME "rootvirt"
+
+/** Virtual device entry. */
+typedef struct {
+	/** Device name. */
+	const char *name;
+	/** Device match id. */
+	const char *match_id;
+} virtual_device_t;
+
+/** List of existing virtual devices. */
+virtual_device_t virtual_devices[] = {
+#include "devices.def"
+	/* Terminating item. */
+	{
+		.name = NULL,
+		.match_id = NULL
+	}
+};
+
+static int add_device(device_t *dev);
+
+static driver_ops_t rootvirt_ops = {
+	.add_device = &add_device
+};
+
+static driver_t rootvirt_driver = {
+	.name = NAME,
+	.driver_ops = &rootvirt_ops
+};
+
+/** Add child device.
+ *
+ * @param parent Parent device.
+ * @param virt_dev Virtual device to add.
+ * @return Error code.
+ */
+static int add_child(device_t *parent, virtual_device_t *virt_dev)
+{
+	printf(NAME ": registering child device `%s' (match \"%s\")\n",
+	    virt_dev->name, virt_dev->match_id);
+
+	int rc = child_device_register_wrapper(parent, virt_dev->name,
+	    virt_dev->match_id, 10);
+
+	if (rc == EOK) {
+		printf(NAME ": registered child device `%s'\n",
+		    virt_dev->name);
+	} else {
+		printf(NAME ": failed to register child device `%s': %s\n",
+		    virt_dev->name, str_error(rc));
+	}
+
+	return rc;
+}
+
+static int add_device(device_t *dev)
+{
+	static int instances = 0;
+
+	/*
+	 * Allow only single instance of root virtual device.
+	 */
+	instances++;
+	if (instances > 1) {
+		return ELIMIT;
+	}
+
+	printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
+	    dev->name, (int)dev->handle);
+	
+	/*
+	 * Go through all virtual devices and try to add them.
+	 * We silently ignore failures.
+	 */
+	virtual_device_t *virt_dev = virtual_devices;
+	while (virt_dev->name != NULL) {
+		(void) add_child(dev, virt_dev);
+		virt_dev++;
+	}
+
+	return EOK;
+}
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": HelenOS virtual devices root driver\n");
+	return driver_main(&rootvirt_driver);
+}
+
+/**
+ * @}
+ */
+
Index: uspace/drv/rootvirt/rootvirt.ma
===================================================================
--- uspace/drv/rootvirt/rootvirt.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/rootvirt/rootvirt.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,1 @@
+10 rootvirt
Index: uspace/drv/test1/Makefile
===================================================================
--- uspace/drv/test1/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test1/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2010 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.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBDRV_PREFIX)/libdrv.a
+EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
+BINARY = test1
+
+SOURCES = \
+	char.c \
+	test1.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/test1/char.c
===================================================================
--- uspace/drv/test1/char.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test1/char.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+/** @file
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <mem.h>
+#include <char.h>
+
+#include "test1.h"
+
+static int impl_char_read(device_t *dev, char *buf, size_t count) {
+	memset(buf, 0, count);
+	return count;
+}
+
+static int imp_char_write(device_t *dev, char *buf, size_t count) {
+	return count;
+}
+
+static char_iface_t char_interface = {
+	.read = &impl_char_read,
+	.write = &imp_char_write
+};
+
+device_ops_t char_device_ops = {
+	.interfaces[CHAR_DEV_IFACE] = &char_interface
+};
+
Index: uspace/drv/test1/test1.c
===================================================================
--- uspace/drv/test1/test1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test1/test1.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+/** @file
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include <str_error.h>
+#include "test1.h"
+
+static int add_device(device_t *dev);
+
+static driver_ops_t driver_ops = {
+	.add_device = &add_device
+};
+
+static driver_t the_driver = {
+	.name = NAME,
+	.driver_ops = &driver_ops
+};
+
+/** Register child and inform user about it.
+ *
+ * @param parent Parent device.
+ * @param message Message for the user.
+ * @param name Device name.
+ * @param match_id Device match id.
+ * @param score Device match score.
+ */
+static void register_child_verbose(device_t *parent, const char *message,
+    const char *name, const char *match_id, int match_score)
+{
+	printf(NAME ": registering child device `%s': %s.\n",
+	   name, message);
+
+	int rc = child_device_register_wrapper(parent, name,
+	    match_id, match_score);
+
+	if (rc == EOK) {
+		printf(NAME ": registered child device `%s'.\n", name);
+	} else {
+		printf(NAME ": failed to register child `%s' (%s).\n",
+		    name, str_error(rc));
+	}
+}
+
+/** Callback when new device is passed to this driver.
+ * This function is the body of the test: it shall register new child
+ * (named `clone') that shall be driven by the same task. When the clone
+ * is added, it registers another child (named `child') that is also driven
+ * by this task. The conditions ensure that we do not recurse indefinitely.
+ * When successful, the device tree shall contain following fragment:
+ *
+ * /virtual/test1
+ * /virtual/test1/clone
+ * /virtual/test1/clone/child
+ *
+ * and devman shall not deadlock.
+ *
+ *
+ * @param dev New device.
+ * @return Error code reporting success of the operation.
+ */
+static int add_device(device_t *dev)
+{
+	printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
+	    dev->name, (int) dev->handle);
+
+	add_device_to_class(dev, "virtual");
+
+	if (str_cmp(dev->name, "null") == 0) {
+		dev->ops = &char_device_ops;
+		add_device_to_class(dev, "virt-null");
+	} else if (dev->parent == NULL) {
+		register_child_verbose(dev, "cloning myself ;-)", "clone",
+		    "virtual&test1", 10);
+	} else if (str_cmp(dev->name, "clone") == 0) {
+		register_child_verbose(dev, "run by the same task", "child",
+		    "virtual&test1&child", 10);
+	}
+
+	printf(NAME ": device `%s' accepted.\n", dev->name);
+
+	return EOK;
+}
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": HelenOS test1 virtual device driver\n");
+	return driver_main(&the_driver);
+}
+
Index: uspace/drv/test1/test1.h
===================================================================
--- uspace/drv/test1/test1.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test1/test1.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+/** @file
+ */
+#ifndef DRV_TEST1_TEST1_H_
+#define DRV_TEST1_TEST1_H_
+
+#include <driver.h>
+
+#define NAME "test1"
+
+extern device_ops_t char_device_ops;
+
+#endif
Index: uspace/drv/test1/test1.ma
===================================================================
--- uspace/drv/test1/test1.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test1/test1.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,2 @@
+10 virtual&test1
+10 virtual&test1&child
Index: uspace/drv/test2/Makefile
===================================================================
--- uspace/drv/test2/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test2/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2010 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.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBDRV_PREFIX)/libdrv.a
+EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
+BINARY = test2
+
+SOURCES = \
+	test2.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/test2/test2.c
===================================================================
--- uspace/drv/test2/test2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test2/test2.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+/** @file
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include <str_error.h>
+#include <driver.h>
+
+#define NAME "test2"
+
+static int add_device(device_t *dev);
+
+static driver_ops_t driver_ops = {
+	.add_device = &add_device
+};
+
+static driver_t the_driver = {
+	.name = NAME,
+	.driver_ops = &driver_ops
+};
+
+/** Register child and inform user about it.
+ *
+ * @param parent Parent device.
+ * @param message Message for the user.
+ * @param name Device name.
+ * @param match_id Device match id.
+ * @param score Device match score.
+ */
+static void register_child_verbose(device_t *parent, const char *message,
+    const char *name, const char *match_id, int match_score)
+{
+	printf(NAME ": registering child device `%s': %s.\n",
+	   name, message);
+
+	int rc = child_device_register_wrapper(parent, name,
+	    match_id, match_score);
+
+	if (rc == EOK) {
+		printf(NAME ": registered child device `%s'.\n", name);
+	} else {
+		printf(NAME ": failed to register child `%s' (%s).\n",
+		    name, str_error(rc));
+	}
+}
+
+/** Add child devices after some sleep.
+ *
+ * @param arg Parent device structure (device_t *).
+ * @return Always EOK.
+ */
+static int postponed_birth(void *arg)
+{
+	device_t *dev = (device_t *) arg;
+
+	async_usleep(1000);
+
+	register_child_verbose(dev, "child driven by the same task",
+	    "child", "virtual&test2", 10);
+	register_child_verbose(dev, "child driven by test1",
+	    "test1", "virtual&test1", 10);
+
+	add_device_to_class(dev, "virtual");
+
+	return EOK;
+}
+
+
+static int add_device(device_t *dev)
+{
+	printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
+	    dev->name, (int) dev->handle);
+
+	if (dev->parent == NULL) {
+		fid_t postpone = fibril_create(postponed_birth, dev);
+		fibril_add_ready(postpone);
+	} else {
+		register_child_verbose(dev, "child without available driver",
+		    "ERROR", "non-existent.match.id", 10);
+	}
+
+	return EOK;
+}
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": HelenOS test2 virtual device driver\n");
+	return driver_main(&the_driver);
+}
+
+
Index: uspace/drv/test2/test2.ma
===================================================================
--- uspace/drv/test2/test2.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
+++ uspace/drv/test2/test2.ma	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -0,0 +1,1 @@
+10 virtual&test2
Index: uspace/lib/block/libblock.c
===================================================================
--- uspace/lib/block/libblock.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/block/libblock.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -66,4 +66,5 @@
 	fibril_mutex_t lock;
 	size_t lblock_size;		/**< Logical block size. */
+	unsigned blocks_cluster;	/**< Physical blocks per block_t */
 	unsigned block_count;		/**< Total number of blocks. */
 	unsigned blocks_cached;		/**< Number of cached blocks. */
@@ -90,4 +91,5 @@
 static int get_block_size(int dev_phone, size_t *bsize);
 static int get_num_blocks(int dev_phone, aoff64_t *nblocks);
+static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba);
 
 static devcon_t *devcon_search(devmap_handle_t devmap_handle)
@@ -259,5 +261,5 @@
 {
 	block_t *b = hash_table_get_instance(item, block_t, hash_link);
-	return b->boff == *key;
+	return b->lba == *key;
 }
 
@@ -292,6 +294,9 @@
 	cache->mode = mode;
 
-	/* No block size translation a.t.m. */
-	assert(cache->lblock_size == devcon->pblock_size);
+	/* Allow 1:1 or small-to-large block size translation */
+	if (cache->lblock_size % devcon->pblock_size != 0)
+		return ENOTSUP;
+
+	cache->blocks_cluster = cache->lblock_size / devcon->pblock_size;
 
 	if (!hash_table_create(&cache->block_hash, CACHE_BUCKETS, 1,
@@ -329,10 +334,10 @@
 		if (b->dirty) {
 			memcpy(devcon->comm_area, b->data, b->size);
-			rc = write_blocks(devcon, b->boff, 1);
+			rc = write_blocks(devcon, b->pba, cache->blocks_cluster);
 			if (rc != EOK)
 				return rc;
 		}
 
-		unsigned long key = b->boff;
+		unsigned long key = b->lba;
 		hash_table_remove(&cache->block_hash, &key, 1);
 		
@@ -375,5 +380,5 @@
  * 				block pointer on success.
  * @param devmap_handle		Device handle of the block device.
- * @param boff			Block offset.
+ * @param ba			Block address (logical).
  * @param flags			If BLOCK_FLAGS_NOREAD is specified, block_get()
  * 				will not read the contents of the block from the
@@ -382,5 +387,5 @@
  * @return			EOK on success or a negative error code.
  */
-int block_get(block_t **block, devmap_handle_t devmap_handle, aoff64_t boff, int flags)
+int block_get(block_t **block, devmap_handle_t devmap_handle, aoff64_t ba, int flags)
 {
 	devcon_t *devcon;
@@ -388,5 +393,5 @@
 	block_t *b;
 	link_t *l;
-	unsigned long key = boff;
+	unsigned long key = ba;
 	int rc;
 	
@@ -465,5 +470,6 @@
 				fibril_mutex_lock(&devcon->comm_area_lock);
 				memcpy(devcon->comm_area, b->data, b->size);
-				rc = write_blocks(devcon, b->boff, 1);
+				rc = write_blocks(devcon, b->pba,
+				    cache->blocks_cluster);
 				fibril_mutex_unlock(&devcon->comm_area_lock);
 				if (rc != EOK) {
@@ -495,5 +501,5 @@
 			 */
 			list_remove(&b->free_link);
-			temp_key = b->boff;
+			temp_key = b->lba;
 			hash_table_remove(&cache->block_hash, &temp_key, 1);
 		}
@@ -502,5 +508,6 @@
 		b->devmap_handle = devmap_handle;
 		b->size = cache->lblock_size;
-		b->boff = boff;
+		b->lba = ba;
+		b->pba = ba_ltop(devcon, b->lba);
 		hash_table_insert(&cache->block_hash, &key, &b->hash_link);
 
@@ -519,5 +526,5 @@
 			 */
 			fibril_mutex_lock(&devcon->comm_area_lock);
-			rc = read_blocks(devcon, b->boff, 1);
+			rc = read_blocks(devcon, b->pba, cache->blocks_cluster);
 			memcpy(b->data, devcon->comm_area, cache->lblock_size);
 			fibril_mutex_unlock(&devcon->comm_area_lock);
@@ -580,5 +587,5 @@
 		fibril_mutex_lock(&devcon->comm_area_lock);
 		memcpy(devcon->comm_area, block->data, block->size);
-		rc = write_blocks(devcon, block->boff, 1);
+		rc = write_blocks(devcon, block->pba, cache->blocks_cluster);
 		fibril_mutex_unlock(&devcon->comm_area_lock);
 		block->dirty = false;
@@ -614,5 +621,5 @@
 			 * Take the block out of the cache and free it.
 			 */
-			unsigned long key = block->boff;
+			unsigned long key = block->lba;
 			hash_table_remove(&cache->block_hash, &key, 1);
 			free(block);
@@ -712,5 +719,5 @@
  *
  * @param devmap_handle	Device handle of the block device.
- * @param ba		Address of first block.
+ * @param ba		Address of first block (physical).
  * @param cnt		Number of blocks.
  * @param src		Buffer for storing the data.
@@ -740,5 +747,5 @@
  *
  * @param devmap_handle	Device handle of the block device.
- * @param ba		Address of first block.
+ * @param ba		Address of first block (physical).
  * @param cnt		Number of blocks.
  * @param src		The data to be written.
@@ -816,6 +823,6 @@
 	    UPPER32(ba), cnt);
 	if (rc != EOK) {
-		printf("Error %d reading %d blocks starting at block %" PRIuOFF64
-		    " from device handle %d\n", rc, cnt, ba,
+		printf("Error %d reading %zu blocks starting at block %" PRIuOFF64
+		    " from device handle %" PRIun "\n", rc, cnt, ba,
 		    devcon->devmap_handle);
 #ifndef NDEBUG
@@ -843,6 +850,6 @@
 	    UPPER32(ba), cnt);
 	if (rc != EOK) {
-		printf("Error %d writing %d blocks starting at block %" PRIuOFF64
-		    " to device handle %d\n", rc, cnt, ba, devcon->devmap_handle);
+		printf("Error %d writing %zu blocks starting at block %" PRIuOFF64
+		    " to device handle %" PRIun "\n", rc, cnt, ba, devcon->devmap_handle);
 #ifndef NDEBUG
 		stacktrace_print();
@@ -855,5 +862,5 @@
 static int get_block_size(int dev_phone, size_t *bsize)
 {
-	ipcarg_t bs;
+	sysarg_t bs;
 	int rc;
 
@@ -868,5 +875,5 @@
 static int get_num_blocks(int dev_phone, aoff64_t *nblocks)
 {
-	ipcarg_t nb_l, nb_h;
+	sysarg_t nb_l, nb_h;
 	int rc;
 
@@ -879,4 +886,11 @@
 }
 
+/** Convert logical block address to physical block address. */
+static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba)
+{
+	assert(devcon->cache != NULL);
+	return lba * devcon->cache->blocks_cluster;
+}
+
 /** @}
  */
Index: uspace/lib/block/libblock.h
===================================================================
--- uspace/lib/block/libblock.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/block/libblock.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -73,6 +73,8 @@
 	/** Handle of the device where the block resides. */
 	devmap_handle_t devmap_handle;
-	/** Block offset on the block device. Counted in 'size'-byte blocks. */
-	aoff64_t boff;
+	/** Logical block address */
+	aoff64_t lba;
+	/** Physical block address */
+	aoff64_t pba;
 	/** Size of the block. */
 	size_t size;
Index: uspace/lib/c/arch/abs32le/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/abs32le/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -34,33 +34,8 @@
 #define LIBC_abs32le_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "d"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "o"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "u"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "x"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "X"
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/abs32le/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/stacktrace.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/abs32le/src/stacktrace.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -56,10 +56,10 @@
 uintptr_t stacktrace_fp_get(void)
 {
-	return NULL;
+	return (uintptr_t) NULL;
 }
 
 uintptr_t stacktrace_pc_get(void)
 {
-	return NULL;
+	return (uintptr_t) NULL;
 }
 
Index: uspace/lib/c/arch/abs32le/src/tls.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/tls.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/abs32le/src/tls.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,5 +46,5 @@
 uintptr_t __aeabi_read_tp(void)
 {
-	return NULL;
+	return (uintptr_t) NULL;
 }
 
Index: uspace/lib/c/arch/amd64/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/amd64/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/amd64/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_amd64_INTTYPES_H_
 #define LIBC_amd64_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "lld"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "llo"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "llu"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "llx"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "llX"
+#define PRIdn  PRId64  /**< Format for native_t. */
+#define PRIun  PRIu64  /**< Format for sysarg_t. */
+#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/arm32/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/arm32/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/arm32/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_arm32_INTTYPES_H_
 #define LIBC_arm32_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "d"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "o"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "u"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "x"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "X"
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/ia32/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/ia32/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/ia32/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_ia32_INTTYPES_H_
 #define LIBC_ia32_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "d"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "o"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "u"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "x"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "X"
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/ia64/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/ia64/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/ia64/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_ia64_INTTYPES_H_
 #define LIBC_ia64_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "ld"
-#define PRIdPTR "ld"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "lo"
-#define PRIoPTR "lo"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "lu"
-#define PRIuPTR "lu"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "lx"
-#define PRIxPTR "lx"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "lX"
-#define PRIXPTR "lX"
+#define PRIdn  PRId64  /**< Format for native_t. */
+#define PRIun  PRIu64  /**< Format for sysarg_t. */
+#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/mips32/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/mips32/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/mips32/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_mips32_INTTYPES_H_
 #define LIBC_mips32_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "d"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "o"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "u"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "x"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "x"
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/ppc32/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/ppc32/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_ppc32_INTTYPES_H_
 #define LIBC_ppc32_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "d"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "o"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "u"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "x"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "X"
+#define PRIdn  PRId32  /**< Format for native_t. */
+#define PRIun  PRIu32  /**< Format for sysarg_t. */
+#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/arch/sparc64/include/inttypes.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/inttypes.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/arch/sparc64/include/inttypes.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -30,44 +30,12 @@
  * @{
  */
-/** @file Macros for format specifiers.
- *
- * Macros for formatting stdint types as specified in section
- * 7.8.1 Macros for format specifiers of the C99 draft specification
- * (ISO/IEC 9899:201x). Only some macros from the specification are
- * implemented.
- */
 
 #ifndef LIBC_sparc64_INTTYPES_H_
 #define LIBC_sparc64_INTTYPES_H_
 
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "lld"
-#define PRIdPTR "lld"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "llo"
-#define PRIoPTR "llo"
-
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "llu"
-#define PRIuPTR "llu"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "llx"
-#define PRIxPTR "llx"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "llX"
-#define PRIXPTR "llX"
+#define PRIdn  PRId64  /**< Format for native_t. */
+#define PRIun  PRIu64  /**< Format for sysarg_t. */
+#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: uspace/lib/c/generic/adt/char_map.c
===================================================================
--- uspace/lib/c/generic/adt/char_map.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/adt/char_map.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -90,8 +90,8 @@
 	}
 
-	map->items[map->next]->c = * identifier;
-	++ identifier;
-	++ map->next;
-	if ((length > 1) || ((length == 0) && (*identifier))) {
+	map->items[map->next]->c = *identifier;
+	identifier++;
+	map->next++;
+	if ((length > 1) || ((length == 0) && *identifier)) {
 		map->items[map->next - 1]->value = CHAR_MAP_NULL;
 		return char_map_add_item(map->items[map->next - 1], identifier,
@@ -142,14 +142,13 @@
     const int value)
 {
-	if (char_map_is_valid(map) && (identifier) &&
-	    ((length) || (*identifier))) {
+	if (char_map_is_valid(map) && identifier && (length || *identifier)) {
 		int index;
 
-		for (index = 0; index < map->next; ++ index) {
+		for (index = 0; index < map->next; index++) {
 			if (map->items[index]->c != *identifier)
 				continue;
 				
-			++ identifier;
-			if((length > 1) || ((length == 0) && (*identifier))) {
+			identifier++;
+			if((length > 1) || ((length == 0) && *identifier)) {
 				return char_map_add(map->items[index],
 				    identifier, length ? length - 1 : 0, value);
@@ -178,5 +177,5 @@
 
 		map->magic = 0;
-		for (index = 0; index < map->next; ++index)
+		for (index = 0; index < map->next; index++)
 			char_map_destroy(map->items[index]);
 
@@ -207,10 +206,10 @@
 		return NULL;
 
-	if (length || (*identifier)) {
+	if (length || *identifier) {
 		int index;
 
-		for (index = 0; index < map->next; ++index) {
+		for (index = 0; index < map->next; index++) {
 			if (map->items[index]->c == *identifier) {
-				++identifier;
+				identifier++;
 				if (length == 1)
 					return map->items[index];
Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/async.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -120,5 +120,5 @@
 	ipc_call_t *dataptr;
 	
-	ipcarg_t retval;
+	sysarg_t retval;
 } amsg_t;
 
@@ -140,5 +140,5 @@
 	
 	/** Incoming phone hash. */
-	ipcarg_t in_phone_hash;
+	sysarg_t in_phone_hash;
 	
 	/** Messages that should be delivered to this fibril. */
@@ -288,5 +288,5 @@
 	list_append(&msg->link, &conn->msg_queue);
 	
-	if (IPC_GET_METHOD(*call) == IPC_M_PHONE_HUNGUP)
+	if (IPC_GET_IMETHOD(*call) == IPC_M_PHONE_HUNGUP)
 		conn->close_callid = callid;
 	
@@ -401,5 +401,5 @@
 			 */
 			memset(call, 0, sizeof(ipc_call_t));
-			IPC_SET_METHOD(*call, IPC_M_PHONE_HUNGUP);
+			IPC_SET_IMETHOD(*call, IPC_M_PHONE_HUNGUP);
 			futex_up(&async_futex);
 			return conn->close_callid;
@@ -529,5 +529,5 @@
  *
  */
-fid_t async_new_connection(ipcarg_t in_phone_hash, ipc_callid_t callid,
+fid_t async_new_connection(sysarg_t in_phone_hash, ipc_callid_t callid,
     ipc_call_t *call, void (*cfibril)(ipc_callid_t, ipc_call_t *))
 {
@@ -536,5 +536,5 @@
 		if (callid)
 			ipc_answer_0(callid, ENOMEM);
-		return NULL;
+		return (uintptr_t) NULL;
 	}
 	
@@ -556,5 +556,5 @@
 		if (callid)
 			ipc_answer_0(callid, ENOMEM);
-		return NULL;
+		return (uintptr_t) NULL;
 	}
 	
@@ -588,5 +588,5 @@
 	}
 	
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_CONNECT_ME:
 	case IPC_M_CONNECT_ME_TO:
@@ -807,6 +807,6 @@
  *
  */
-aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr)
+aid_t async_send_fast(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
 {
 	amsg_t *msg = malloc(sizeof(*msg));
@@ -846,6 +846,6 @@
  *
  */
-aid_t async_send_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
+aid_t async_send_slow(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
     ipc_call_t *dataptr)
 {
@@ -875,5 +875,5 @@
  *
  */
-void async_wait_for(aid_t amsgid, ipcarg_t *retval)
+void async_wait_for(aid_t amsgid, sysarg_t *retval)
 {
 	amsg_t *msg = (amsg_t *) amsgid;
@@ -911,5 +911,5 @@
  *
  */
-int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, suseconds_t timeout)
+int async_wait_timeout(aid_t amsgid, sysarg_t *retval, suseconds_t timeout)
 {
 	amsg_t *msg = (amsg_t *) amsgid;
@@ -1023,7 +1023,7 @@
  *
  */
-ipcarg_t async_req_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t *r1, ipcarg_t *r2,
-    ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5)
+sysarg_t async_req_fast(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
+    sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
 {
 	ipc_call_t result;
@@ -1031,5 +1031,5 @@
 	    &result);
 	
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(eid, &rc);
 	
@@ -1072,7 +1072,7 @@
  *
  */
-ipcarg_t async_req_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *r1,
-    ipcarg_t *r2, ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5)
+sysarg_t async_req_slow(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
+    sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
 {
 	ipc_call_t result;
@@ -1080,5 +1080,5 @@
 	    &result);
 	
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(eid, &rc);
 	
@@ -1113,8 +1113,8 @@
  */
 int
-async_connect_me_to(int phoneid, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3)
+async_connect_me_to(int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
 {
 	int rc;
-	ipcarg_t newphid;
+	sysarg_t newphid;
 
 	rc = async_req_3_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3, NULL,
@@ -1140,9 +1140,9 @@
  */
 int
-async_connect_me_to_blocking(int phoneid, ipcarg_t arg1, ipcarg_t arg2,
-    ipcarg_t arg3)
+async_connect_me_to_blocking(int phoneid, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3)
 {
 	int rc;
-	ipcarg_t newphid;
+	sysarg_t newphid;
 
 	rc = async_req_4_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
@@ -1166,11 +1166,11 @@
  * @return		Zero on success or a negative error code from errno.h.
  */
-int async_share_in_start(int phoneid, void *dst, size_t size, ipcarg_t arg,
+int async_share_in_start(int phoneid, void *dst, size_t size, sysarg_t arg,
     int *flags)
 {
 	int res;
 	sysarg_t tmp_flags;
-	res = async_req_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
-	    (ipcarg_t) size, arg, NULL, &tmp_flags);
+	res = async_req_3_2(phoneid, IPC_M_SHARE_IN, (sysarg_t) dst,
+	    (sysarg_t) size, arg, NULL, &tmp_flags);
 	if (flags)
 		*flags = tmp_flags;
@@ -1199,5 +1199,5 @@
 
 	*callid = async_get_call(&data);
-	if (IPC_GET_METHOD(data) != IPC_M_SHARE_IN)
+	if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_IN)
 		return 0;
 	*size = (size_t) IPC_GET_ARG2(data);
@@ -1231,6 +1231,6 @@
 int async_share_out_start(int phoneid, void *src, int flags)
 {
-	return async_req_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
-	    (ipcarg_t) flags);
+	return async_req_3_0(phoneid, IPC_M_SHARE_OUT, (sysarg_t) src, 0,
+	    (sysarg_t) flags);
 }
 
@@ -1259,5 +1259,5 @@
 
 	*callid = async_get_call(&data);
-	if (IPC_GET_METHOD(data) != IPC_M_SHARE_OUT)
+	if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_OUT)
 		return 0;
 	*size = (size_t) IPC_GET_ARG2(data);
@@ -1292,6 +1292,6 @@
 int async_data_read_start(int phoneid, void *dst, size_t size)
 {
-	return async_req_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
-	    (ipcarg_t) size);
+	return async_req_2_0(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
+	    (sysarg_t) size);
 }
 
@@ -1317,5 +1317,5 @@
 
 	*callid = async_get_call(&data);
-	if (IPC_GET_METHOD(data) != IPC_M_DATA_READ)
+	if (IPC_GET_IMETHOD(data) != IPC_M_DATA_READ)
 		return 0;
 	if (size)
@@ -1345,6 +1345,6 @@
  *
  */
-int async_data_read_forward_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr)
+int async_data_read_forward_fast(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
 {
 	ipc_callid_t callid;
@@ -1369,5 +1369,5 @@
 	}
 	
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
@@ -1386,6 +1386,6 @@
 int async_data_write_start(int phoneid, const void *src, size_t size)
 {
-	return async_req_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
-	    (ipcarg_t) size);
+	return async_req_2_0(phoneid, IPC_M_DATA_WRITE, (sysarg_t) src,
+	    (sysarg_t) size);
 }
 
@@ -1412,5 +1412,5 @@
 	
 	*callid = async_get_call(&data);
-	if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE)
+	if (IPC_GET_IMETHOD(data) != IPC_M_DATA_WRITE)
 		return 0;
 	
@@ -1531,6 +1531,6 @@
  *
  */
-int async_data_write_forward_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr)
+int async_data_write_forward_fast(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
 {
 	ipc_callid_t callid;
@@ -1555,5 +1555,5 @@
 	}
 	
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
Index: uspace/lib/c/generic/async_rel.c
===================================================================
--- uspace/lib/c/generic/async_rel.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/async_rel.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -239,5 +239,5 @@
 		 */
 retry:
-		rel_phone = ipc_connect_me_to(key_phone, 0, 0, 0);
+		rel_phone = async_connect_me_to(key_phone, 0, 0, 0);
 		if (rel_phone >= 0) {
 			/* success, do nothing */
Index: uspace/lib/c/generic/cap.c
===================================================================
--- uspace/lib/c/generic/cap.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/cap.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -31,6 +31,6 @@
  */
 /**
- * @file	cap.c
- * @brief	Functions to grant/revoke capabilities to/from a task.
+ * @file  cap.c
+ * @brief Functions to grant/revoke capabilities to/from a task.
  */
 
@@ -38,36 +38,43 @@
 #include <task.h>
 #include <libc.h>
-#include <kernel/syscall/sysarg64.h>
 
 /** Grant capabilities to a task.
  *
- * @param id Destination task ID.
+ * @param id   Destination task ID.
  * @param caps Capabilities to grant.
  *
  * @return Zero on success or a value from @ref errno.h on failure.
+ *
  */
 int cap_grant(task_id_t id, unsigned int caps)
 {
-	sysarg64_t arg;
+#ifdef __32_BITS__
+	sysarg64_t arg = (sysarg64_t) id;
+	return __SYSCALL2(SYS_CAP_GRANT, (sysarg_t) &arg, (sysarg_t) caps);
+#endif
 	
-	arg.value = (unsigned long long) id;
-
-	return __SYSCALL2(SYS_CAP_GRANT, (sysarg_t) &arg, (sysarg_t) caps);
+#ifdef __64_BITS__
+	return __SYSCALL2(SYS_CAP_GRANT, (sysarg_t) id, (sysarg_t) caps);
+#endif
 }
 
 /** Revoke capabilities from a task.
  *
- * @param id Destination task ID.
+ * @param id   Destination task ID.
  * @param caps Capabilities to revoke.
  *
  * @return Zero on success or a value from @ref errno.h on failure.
+ *
  */
 int cap_revoke(task_id_t id, unsigned int caps)
 {
-	sysarg64_t arg;
+#ifdef __32_BITS__
+	sysarg64_t arg = (sysarg64_t) id;
+	return __SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) &arg, (sysarg_t) caps);
+#endif
 	
-	arg.value = (unsigned long long) id;
-
-	return __SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) &arg, (sysarg_t) caps);
+#ifdef __64_BITS__
+	return __SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) id, (sysarg_t) caps);
+#endif
 }
 
Index: uspace/lib/c/generic/clipboard.c
===================================================================
--- uspace/lib/c/generic/clipboard.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/clipboard.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -75,5 +75,5 @@
 		clip_connect();
 		
-		ipcarg_t rc = async_req_1_0(clip_phone, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_NONE);
+		sysarg_t rc = async_req_1_0(clip_phone, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_NONE);
 		
 		async_serialize_end();
@@ -85,7 +85,7 @@
 		
 		aid_t req = async_send_1(clip_phone, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_DATA, NULL);
-		ipcarg_t rc = async_data_write_start(clip_phone, (void *) str, size);
+		sysarg_t rc = async_data_write_start(clip_phone, (void *) str, size);
 		if (rc != EOK) {
-			ipcarg_t rc_orig;
+			sysarg_t rc_orig;
 			async_wait_for(req, &rc_orig);
 			async_serialize_end();
@@ -119,7 +119,7 @@
 		clip_connect();
 		
-		ipcarg_t size;
-		ipcarg_t tag;
-		ipcarg_t rc = async_req_0_2(clip_phone, CLIPBOARD_CONTENT, &size, &tag);
+		sysarg_t size;
+		sysarg_t tag;
+		sysarg_t rc = async_req_0_2(clip_phone, CLIPBOARD_CONTENT, &size, &tag);
 		
 		async_serialize_end();
@@ -158,5 +158,5 @@
 			
 			if (rc != EOK) {
-				ipcarg_t rc_orig;
+				sysarg_t rc_orig;
 				async_wait_for(req, &rc_orig);
 				async_serialize_end();
Index: uspace/lib/c/generic/device/char.c
===================================================================
--- uspace/lib/c/generic/device/char.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/device/char.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
  /** @addtogroup libc
  * @{
@@ -40,44 +40,48 @@
 #include <stdio.h>
 
-/** Read to or write from the device using its character interface.
- * 
- * Helper function.
- * 
- * @param dev_phone phone to the device.
- * @param buf the buffer for the data read from or written to the device.
- * @param len the maximum length of the data to be read or written.
- * @param read read from the device if true, write to it otherwise.
- * 
- * @return non-negative number of bytes actually read from or written to the device on success,
- * negative error number otherwise.
- * 
+/** Read to or write from device.
+ *
+ * Helper function to read to or write from a device
+ * using its character interface.
+ *
+ * @param dev_phone Phone to the device.
+ * @param buf       Buffer for the data read
+ *                  from or written to the device.
+ * @param len       Maximum length of the data to be
+ *                  read or written.
+ * @param read      Read from the device if true,
+ *                  write to it otherwise.
+ *
+ * @return Non-negative number of bytes actually read
+ *         from or written to the device on success,
+ *         negative error number otherwise.
+ *
  */
-static int rw_dev(int dev_phone, void *buf, size_t len, bool read) 
+static ssize_t rw_dev(int dev_phone, void *buf, size_t len, bool read)
 {
-	ipc_call_t answer;
-	
 	async_serialize_start();
 	
+	ipc_call_t answer;
 	aid_t req;
 	int ret;
 	
 	if (read) {
-		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE), CHAR_READ_DEV, &answer);
-		ret = async_data_read_start(dev_phone, buf, len);		
+		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE),
+		    CHAR_READ_DEV, &answer);
+		ret = async_data_read_start(dev_phone, buf, len);
 	} else {
-		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE), CHAR_WRITE_DEV, &answer);
+		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE),
+		    CHAR_WRITE_DEV, &answer);
 		ret = async_data_write_start(dev_phone, buf, len);
 	}
 	
-	ipcarg_t rc;
-	if (ret != EOK) {		
+	sysarg_t rc;
+	if (ret != EOK) {
 		async_wait_for(req, &rc);
 		async_serialize_end();
-		if (rc == EOK) {
-			return ret;
-		}
-		else {
-			return (int) rc;
-		}
+		if (rc == EOK)
+			return (ssize_t) ret;
+			
+		return (ssize_t) rc;
 	}
 	
@@ -85,39 +89,45 @@
 	async_serialize_end();
 	
-	ret = (int)rc;
-	if (EOK != ret) {
-		return ret;
-	}
+	ret = (int) rc;
+	if (ret != EOK)
+		return (ssize_t) ret;
 	
-	return IPC_GET_ARG1(answer);	
+	return (ssize_t) IPC_GET_ARG1(answer);
 }
 
-/** Read from the device using its character interface.
- * 
- * @param dev_phone phone to the device.
- * @param buf the output buffer for the data read from the device.
- * @param len the maximum length of the data to be read.
- * 
- * @return non-negative number of bytes actually read from the device on success, negative error number otherwise.
+/** Read from device using its character interface.
+ *
+ * @param dev_phone Phone to the device.
+ * @param buf       Output buffer for the data
+ *                  read from the device.
+ * @param len       Maximum length of the data to be read.
+ *
+ * @return Non-negative number of bytes actually read
+ *         from the device on success, negative error
+ *         number otherwise.
+ *
  */
-int read_dev(int dev_phone, void *buf, size_t len)
-{	
+ssize_t read_dev(int dev_phone, void *buf, size_t len)
+{
 	return rw_dev(dev_phone, buf, len, true);
 }
 
-/** Write to the device using its character interface.
- * 
- * @param dev_phone phone to the device.
- * @param buf the input buffer containg the data to be written to the device.
- * @param len the maximum length of the data to be written.
- * 
- * @return non-negative number of bytes actually written to the device on success, negative error number otherwise.
+/** Write to device using its character interface.
+ *
+ * @param dev_phone Phone to the device.
+ * @param buf       Input buffer containg the data
+ *                  to be written to the device.
+ * @param len       Maximum length of the data to be written.
+ *
+ * @return Non-negative number of bytes actually written
+ *         to the device on success, negative error number
+ *         otherwise.
+ *
  */
-int write_dev(int dev_phone, void *buf, size_t len)
+ssize_t write_dev(int dev_phone, void *buf, size_t len)
 {
 	return rw_dev(dev_phone, buf, len, false);
 }
 
-  
- /** @}
+/** @}
  */
Index: uspace/lib/c/generic/device/hw_res.c
===================================================================
--- uspace/lib/c/generic/device/hw_res.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/device/hw_res.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,27 +38,25 @@
 #include <malloc.h>
 
-bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)
+int get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)
 {
-	ipcarg_t count = 0;
+	sysarg_t count = 0;
 	int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count);
 	hw_resources->count = count;
-	if (EOK != rc) {
-		return false;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	size_t size = count * sizeof(hw_resource_t);
 	hw_resources->resources = (hw_resource_t *)malloc(size);
-	if (NULL == hw_resources->resources) {
-		return false;
-	}
+	if (!hw_resources->resources)
+		return ENOMEM;
 	
 	rc = async_data_read_start(dev_phone, hw_resources->resources, size);
-	if (EOK != rc) {
+	if (rc != EOK) {
 		free(hw_resources->resources);
 		hw_resources->resources = NULL;
-		return false;
+		return rc;
 	}
 	 	 
-	return true;	 
+	return EOK;
 }
 
Index: uspace/lib/c/generic/devman.c
===================================================================
--- uspace/lib/c/generic/devman.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/devman.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -95,5 +95,5 @@
 	aid_t req = async_send_2(phone, DEVMAN_DRIVER_REGISTER, 0, 0, &answer);
 	
-	ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
+	sysarg_t retval = async_data_write_start(phone, name, str_size(name));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -104,5 +104,5 @@
 	async_set_client_connection(conn);
 	
-	ipcarg_t callback_phonehash;
+	sysarg_t callback_phonehash;
 	ipc_connect_to_me(phone, 0, 0, 0, &callback_phonehash);
 	async_wait_for(req, &retval);
@@ -116,7 +116,8 @@
 {
 	ipc_call_t answer;
-	async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer);
+	aid_t req = async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer);
 	int retval = async_data_write_start(phone, match_id->id, str_size(match_id->id));
-	return retval;	
+	async_wait_for(req, NULL);
+	return retval;
 }
 
@@ -154,5 +155,5 @@
 	aid_t req = async_send_2(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, match_count, &answer);
 
-	ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
+	sysarg_t retval = async_data_write_start(phone, name, str_size(name));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -191,5 +192,5 @@
 	aid_t req = async_send_1(phone, DEVMAN_ADD_DEVICE_TO_CLASS, devman_handle, &answer);
 	
-	ipcarg_t retval = async_data_write_start(phone, class_name, str_size(class_name));
+	sysarg_t retval = async_data_write_start(phone, class_name, str_size(class_name));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -267,5 +268,5 @@
 	    &answer);
 	
-	ipcarg_t retval = async_data_write_start(phone, pathname, str_size(pathname));
+	sysarg_t retval = async_data_write_start(phone, pathname, str_size(pathname));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
Index: uspace/lib/c/generic/devmap.c
===================================================================
--- uspace/lib/c/generic/devmap.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/devmap.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -107,5 +107,5 @@
 	aid_t req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer);
 	
-	ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
+	sysarg_t retval = async_data_write_start(phone, name, str_size(name));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -116,5 +116,5 @@
 	async_set_client_connection(conn);
 	
-	ipcarg_t callback_phonehash;
+	sysarg_t callback_phonehash;
 	ipc_connect_to_me(phone, 0, 0, 0, &callback_phonehash);
 	async_wait_for(req, &retval);
@@ -127,5 +127,54 @@
 /** Register new device.
  *
- * @param namespace Namespace name.
+ * The @p interface is used when forwarding connection to the driver.
+ * If not 0, the first argument is the interface and the second argument
+ * is the devmap handle of the device.
+ * When the interface is zero (default), the first argument is directly
+ * the handle (to ensure backward compatibility).
+ *
+ * @param fqdn Fully qualified device name.
+ * @param[out] handle Handle to the created instance of device.
+ * @param interface Interface when forwarding.
+ *
+ */
+int devmap_device_register_with_iface(const char *fqdn,
+    devmap_handle_t *handle, sysarg_t interface)
+{
+	int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
+	
+	if (phone < 0)
+		return phone;
+	
+	async_serialize_start();
+	
+	ipc_call_t answer;
+	aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, interface, 0,
+	    &answer);
+	
+	sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
+	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 = -1;
+		return retval;
+	}
+	
+	if (handle != NULL)
+		*handle = (devmap_handle_t) IPC_GET_ARG1(answer);
+	
+	return retval;
+}
+
+/** Register new device.
+ *
  * @param fqdn      Fully qualified device name.
  * @param handle    Output: Handle to the created instance of device.
@@ -134,37 +183,7 @@
 int devmap_device_register(const char *fqdn, devmap_handle_t *handle)
 {
-	int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
-	
-	if (phone < 0)
-		return phone;
-	
-	async_serialize_start();
-	
-	ipc_call_t answer;
-	aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, 0, 0,
-	    &answer);
-	
-	ipcarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
-	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 = -1;
-		return retval;
-	}
-	
-	if (handle != NULL)
-		*handle = (devmap_handle_t) IPC_GET_ARG1(answer);
-	
-	return retval;
-}
+	return devmap_device_register_with_iface(fqdn, handle, 0);
+}
+
 
 int devmap_device_get_handle(const char *fqdn, devmap_handle_t *handle, unsigned int flags)
@@ -181,5 +200,5 @@
 	    &answer);
 	
-	ipcarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
+	sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -217,5 +236,5 @@
 	    &answer);
 	
-	ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
+	sysarg_t retval = async_data_write_start(phone, name, str_size(name));
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -247,5 +266,5 @@
 		return phone;
 	
-	ipcarg_t type;
+	sysarg_t type;
 	int retval = async_req_1_1(phone, DEVMAP_HANDLE_PROBE, handle, &type);
 	if (retval != EOK)
@@ -260,8 +279,8 @@
 	
 	if (flags & IPC_FLAG_BLOCKING) {
-		phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
+		phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
 		    DEVMAP_CONNECT_TO_DEVICE, handle);
 	} else {
-		phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
+		phone = async_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
 		    DEVMAP_CONNECT_TO_DEVICE, handle);
 	}
@@ -277,5 +296,5 @@
 		return -1;
 	
-	ipcarg_t null_id;
+	sysarg_t null_id;
 	int retval = async_req_0_1(phone, DEVMAP_NULL_CREATE, &null_id);
 	if (retval != EOK)
@@ -292,10 +311,10 @@
 		return;
 	
-	async_req_1_0(phone, DEVMAP_NULL_DESTROY, (ipcarg_t) null_id);
+	async_req_1_0(phone, DEVMAP_NULL_DESTROY, (sysarg_t) null_id);
 }
 
 static size_t devmap_count_namespaces_internal(int phone)
 {
-	ipcarg_t count;
+	sysarg_t count;
 	int retval = async_req_0_1(phone, DEVMAP_GET_NAMESPACE_COUNT, &count);
 	if (retval != EOK)
@@ -307,5 +326,5 @@
 static size_t devmap_count_devices_internal(int phone, devmap_handle_t ns_handle)
 {
-	ipcarg_t count;
+	sysarg_t count;
 	int retval = async_req_1_1(phone, DEVMAP_GET_DEVICE_COUNT, ns_handle, &count);
 	if (retval != EOK)
@@ -375,5 +394,5 @@
 		}
 		
-		ipcarg_t retval;
+		sysarg_t retval;
 		async_wait_for(req, &retval);
 		async_serialize_end();
@@ -427,5 +446,5 @@
 		}
 		
-		ipcarg_t retval;
+		sysarg_t retval;
 		async_wait_for(req, &retval);
 		async_serialize_end();
Index: uspace/lib/c/generic/event.c
===================================================================
--- uspace/lib/c/generic/event.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/event.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,5 +49,5 @@
  * @return Value returned by the kernel.
  */
-int event_subscribe(event_type_t e, ipcarg_t method)
+int event_subscribe(event_type_t e, sysarg_t method)
 {
 	return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) e, (sysarg_t) method);
Index: uspace/lib/c/generic/fibril_synch.c
===================================================================
--- uspace/lib/c/generic/fibril_synch.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/fibril_synch.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -139,5 +139,4 @@
 static void _fibril_mutex_unlock_unsafe(fibril_mutex_t *fm)
 {
-	assert(fm->counter <= 0);
 	if (fm->counter++ < 0) {
 		link_t *tmp;
@@ -165,7 +164,20 @@
 void fibril_mutex_unlock(fibril_mutex_t *fm)
 {
+	assert(fibril_mutex_is_locked(fm));
 	futex_down(&async_futex);
 	_fibril_mutex_unlock_unsafe(fm);
 	futex_up(&async_futex);
+}
+
+bool fibril_mutex_is_locked(fibril_mutex_t *fm)
+{
+	bool locked = false;
+	
+	futex_down(&async_futex);
+	if (fm->counter <= 0) 
+		locked = true;
+	futex_up(&async_futex);
+	
+	return locked;
 }
 
@@ -230,5 +242,4 @@
 {
 	futex_down(&async_futex);
-	assert(frw->readers || (frw->writers == 1));
 	if (frw->readers) {
 		if (--frw->readers) {
@@ -296,4 +307,5 @@
 void fibril_rwlock_read_unlock(fibril_rwlock_t *frw)
 {
+	assert(fibril_rwlock_is_read_locked(frw));
 	_fibril_rwlock_common_unlock(frw);
 }
@@ -301,5 +313,38 @@
 void fibril_rwlock_write_unlock(fibril_rwlock_t *frw)
 {
+	assert(fibril_rwlock_is_write_locked(frw));
 	_fibril_rwlock_common_unlock(frw);
+}
+
+bool fibril_rwlock_is_read_locked(fibril_rwlock_t *frw)
+{
+	bool locked = false;
+
+	futex_down(&async_futex);
+	if (frw->readers)
+		locked = true;
+	futex_up(&async_futex);
+
+	return locked;
+}
+
+bool fibril_rwlock_is_write_locked(fibril_rwlock_t *frw)
+{
+	bool locked = false;
+
+	futex_down(&async_futex);
+	if (frw->writers) {
+		assert(frw->writers == 1);
+		locked = true;
+	}
+	futex_up(&async_futex);
+
+	return locked;
+}
+
+bool fibril_rwlock_is_locked(fibril_rwlock_t *frw)
+{
+	return fibril_rwlock_is_read_locked(frw) ||
+	    fibril_rwlock_is_write_locked(frw);
 }
 
@@ -314,4 +359,6 @@
 {
 	awaiter_t wdata;
+
+	assert(fibril_mutex_is_locked(fm));
 
 	if (timeout < 0)
Index: uspace/lib/c/generic/io/console.c
===================================================================
--- uspace/lib/c/generic/io/console.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/io/console.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -45,5 +45,5 @@
 }
 
-int console_get_size(int phone, ipcarg_t *cols, ipcarg_t *rows)
+int console_get_size(int phone, sysarg_t *cols, sysarg_t *rows)
 {
 	return async_req_0_2(phone, CONSOLE_GET_SIZE, cols, rows);
@@ -71,5 +71,5 @@
 }
 
-int console_get_color_cap(int phone, ipcarg_t *ccap)
+int console_get_color_cap(int phone, sysarg_t *ccap)
 {
 	return async_req_0_1(phone, CONSOLE_GET_COLOR_CAP, ccap);
@@ -81,10 +81,10 @@
 }
 
-int console_get_pos(int phone, ipcarg_t *col, ipcarg_t *row)
+int console_get_pos(int phone, sysarg_t *col, sysarg_t *row)
 {
 	return async_req_0_2(phone, CONSOLE_GET_POS, col, row);
 }
 
-void console_set_pos(int phone, ipcarg_t col, ipcarg_t row)
+void console_set_pos(int phone, sysarg_t col, sysarg_t row)
 {
 	async_msg_2(phone, CONSOLE_GOTO, col, row);
@@ -93,8 +93,8 @@
 bool console_get_event(int phone, console_event_t *event)
 {
-	ipcarg_t type;
-	ipcarg_t key;
-	ipcarg_t mods;
-	ipcarg_t c;
+	sysarg_t type;
+	sysarg_t key;
+	sysarg_t mods;
+	sysarg_t c;
 	
 	int rc = async_req_0_4(phone, CONSOLE_GET_EVENT, &type, &key, &mods, &c);
Index: uspace/lib/c/generic/io/klog.c
===================================================================
--- uspace/lib/c/generic/io/klog.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/io/klog.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,5 +52,5 @@
 void klog_update(void)
 {
-	(void) __SYSCALL3(SYS_KLOG, 1, NULL, 0);
+	(void) __SYSCALL3(SYS_KLOG, 1, (uintptr_t) NULL, 0);
 }
 
Index: uspace/lib/c/generic/io/printf_core.c
===================================================================
--- uspace/lib/c/generic/io/printf_core.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/io/printf_core.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -82,5 +82,6 @@
 	PrintfQualifierLong,
 	PrintfQualifierLongLong,
-	PrintfQualifierPointer
+	PrintfQualifierPointer,
+	PrintfQualifierSize
 } qualifier_t;
 
@@ -552,7 +553,8 @@
  *  - ""   Signed or unsigned int (default value).@n
  *  - "l"  Signed or unsigned long int.@n
- *         If conversion is "c", the character is wchar_t (wide character).@n
+ *         If conversion is "c", the character is wint_t (wide character).@n
  *         If conversion is "s", the string is wchar_t * (wide string).@n
  *  - "ll" Signed or unsigned long long int.@n
+ *  - "z"  Signed or unsigned ssize_t or site_t.@n
  *
  * CONVERSION:@n
@@ -736,4 +738,9 @@
 				}
 				break;
+			case 'z':
+				qualifier = PrintfQualifierSize;
+				i = nxt;
+				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
+				break;
 			default:
 				/* Default type */
@@ -763,5 +770,5 @@
 			case 'c':
 				if (qualifier == PrintfQualifierLong)
-					retval = print_wchar(va_arg(ap, wchar_t), width, flags, ps);
+					retval = print_wchar(va_arg(ap, wint_t), width, flags, ps);
 				else
 					retval = print_char(va_arg(ap, unsigned int), width, flags, ps);
@@ -849,4 +856,8 @@
 				precision = size << 1;
 				number = (uint64_t) (uintptr_t) va_arg(ap, void *);
+				break;
+			case PrintfQualifierSize:
+				size = sizeof(size_t);
+				number = (uint64_t) va_arg(ap, size_t);
 				break;
 			default:
Index: uspace/lib/c/generic/io/screenbuffer.c
===================================================================
--- uspace/lib/c/generic/io/screenbuffer.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/io/screenbuffer.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -67,6 +67,6 @@
  *
  */
-screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, ipcarg_t size_x,
-    ipcarg_t size_y)
+screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, sysarg_t size_x,
+    sysarg_t size_y)
 {
 	scr->buffer = (keyfield_t *) malloc(sizeof(keyfield_t) * size_x * size_y);
@@ -110,7 +110,7 @@
  *
  */
-void screenbuffer_clear_line(screenbuffer_t *scr, ipcarg_t line)
+void screenbuffer_clear_line(screenbuffer_t *scr, sysarg_t line)
 {
-	ipcarg_t x;
+	sysarg_t x;
 	
 	for (x = 0; x < scr->size_x; x++) {
@@ -141,5 +141,5 @@
  *
  */
-void screenbuffer_goto(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y)
+void screenbuffer_goto(screenbuffer_t *scr, sysarg_t x, sysarg_t y)
 {
 	scr->position_x = x % scr->size_x;
Index: uspace/lib/c/generic/ipc.c
===================================================================
--- uspace/lib/c/generic/ipc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/ipc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,5 +38,5 @@
  */
 /** @file
- */ 
+ */
 
 #include <ipc/ipc.h>
@@ -104,7 +104,7 @@
  */
 int
-ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
-    ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3,
-    ipcarg_t *result4, ipcarg_t *result5)
+ipc_call_sync_fast(int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3, sysarg_t *result1, sysarg_t *result2, sysarg_t *result3,
+    sysarg_t *result4, sysarg_t *result5)
 {
 	ipc_call_t resdata;
@@ -131,29 +131,29 @@
 /** Make a synchronous call transmitting 5 arguments of payload.
  *
- * @param phoneid	Phone handle for the call.
- * @param method	Requested method.
- * @param arg1		Service-defined payload argument.
- * @param arg2		Service-defined payload argument.
- * @param arg3		Service-defined payload argument.
- * @param arg4		Service-defined payload argument.
- * @param arg5		Service-defined payload argument.
- * @param result1	If non-NULL, storage for the first return argument.
- * @param result2	If non-NULL, storage for the second return argument.
- * @param result3	If non-NULL, storage for the third return argument.
- * @param result4	If non-NULL, storage for the fourth return argument.
- * @param result5	If non-NULL, storage for the fifth return argument.
- *
- * @return		Negative value means IPC error.
- *			Otherwise the RETVAL of the answer.
+ * @param phoneid Phone handle for the call.
+ * @param imethod Requested interface and method.
+ * @param arg1    Service-defined payload argument.
+ * @param arg2    Service-defined payload argument.
+ * @param arg3    Service-defined payload argument.
+ * @param arg4    Service-defined payload argument.
+ * @param arg5    Service-defined payload argument.
+ * @param result1 If non-NULL, storage for the first return argument.
+ * @param result2 If non-NULL, storage for the second return argument.
+ * @param result3 If non-NULL, storage for the third return argument.
+ * @param result4 If non-NULL, storage for the fourth return argument.
+ * @param result5 If non-NULL, storage for the fifth return argument.
+ *
+ * @return Negative value means IPC error.
+ *         Otherwise the RETVAL of the answer.
+ *
  */
 int
-ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
-    ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *result1,
-    ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5)
+ipc_call_sync_slow(int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *result1,
+    sysarg_t *result2, sysarg_t *result3, sysarg_t *result4, sysarg_t *result5)
 {
 	ipc_call_t data;
-	int callres;
-
-	IPC_SET_METHOD(data, method);
+	
+	IPC_SET_IMETHOD(data, imethod);
 	IPC_SET_ARG1(data, arg1);
 	IPC_SET_ARG2(data, arg2);
@@ -161,10 +161,10 @@
 	IPC_SET_ARG4(data, arg4);
 	IPC_SET_ARG5(data, arg5);
-
-	callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, (sysarg_t) &data,
-	    (sysarg_t) &data);
+	
+	int callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid,
+	    (sysarg_t) &data, (sysarg_t) &data);
 	if (callres)
 		return callres;
-
+	
 	if (result1)
 		*result1 = IPC_GET_ARG1(data);
@@ -177,5 +177,5 @@
 	if (result5)
 		*result5 = IPC_GET_ARG5(data);
-
+	
 	return IPC_GET_RETVAL(data);
 }
@@ -183,8 +183,9 @@
 /** Syscall to send asynchronous message.
  *
- * @param phoneid	Phone handle for the call.
- * @param data		Call data with the request.
- *
- * @return		Hash of the call or an error code.
+ * @param phoneid Phone handle for the call.
+ * @param data    Call data with the request.
+ *
+ * @return Hash of the call or an error code.
+ *
  */
 static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data)
@@ -277,23 +278,23 @@
  * If the call cannot be temporarily made, queue it.
  *
- * @param phoneid	Phone handle for the call.
- * @param method	Requested method.
- * @param arg1		Service-defined payload argument.
- * @param arg2		Service-defined payload argument.
- * @param arg3		Service-defined payload argument.
- * @param arg4		Service-defined payload argument.
- * @param private	Argument to be passed to the answer/error callback.
- * @param callback	Answer or error callback.
- * @param can_preempt	If non-zero, the current fibril will be preempted in
- *			case the kernel temporarily refuses to accept more
- *			asynchronous calls.
- */
-void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private,
+ * @param phoneid     Phone handle for the call.
+ * @param imethod     Requested interface and method.
+ * @param arg1        Service-defined payload argument.
+ * @param arg2        Service-defined payload argument.
+ * @param arg3        Service-defined payload argument.
+ * @param arg4        Service-defined payload argument.
+ * @param private     Argument to be passed to the answer/error callback.
+ * @param callback    Answer or error callback.
+ * @param can_preempt If non-zero, the current fibril will be preempted in
+ *                    case the kernel temporarily refuses to accept more
+ *                    asynchronous calls.
+ *
+ */
+void ipc_call_async_fast(int phoneid, sysarg_t imethod, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, void *private,
     ipc_async_callback_t callback, int can_preempt)
 {
 	async_call_t *call = NULL;
-	ipc_callid_t callid;
-
+	
 	if (callback) {
 		call = ipc_prepare_async(private, callback);
@@ -301,5 +302,5 @@
 			return;
 	}
-
+	
 	/*
 	 * We need to make sure that we get callid before another thread
@@ -307,7 +308,7 @@
 	 */
 	futex_down(&ipc_futex);
-	callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
-	    arg2, arg3, arg4);
-
+	ipc_callid_t callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid,
+	    imethod, arg1, arg2, arg3, arg4);
+	
 	if (callid == (ipc_callid_t) IPC_CALLRET_TEMPORARY) {
 		if (!call) {
@@ -316,5 +317,5 @@
 				return;
 		}
-		IPC_SET_METHOD(call->u.msg.data, method);
+		IPC_SET_IMETHOD(call->u.msg.data, imethod);
 		IPC_SET_ARG1(call->u.msg.data, arg1);
 		IPC_SET_ARG2(call->u.msg.data, arg2);
@@ -337,20 +338,20 @@
  * If the call cannot be temporarily made, queue it.
  *
- * @param phoneid	Phone handle for the call.
- * @param method	Requested method.
- * @param arg1		Service-defined payload argument.
- * @param arg2		Service-defined payload argument.
- * @param arg3		Service-defined payload argument.
- * @param arg4		Service-defined payload argument.
- * @param arg5		Service-defined payload argument.
- * @param private	Argument to be passed to the answer/error callback.
- * @param callback	Answer or error callback.
- * @param can_preempt	If non-zero, the current fibril will be preempted in
- *			case the kernel temporarily refuses to accept more
- *			asynchronous calls.
- *
- */
-void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private,
+ * @param phoneid     Phone handle for the call.
+ * @param imethod     Requested interface and method.
+ * @param arg1        Service-defined payload argument.
+ * @param arg2        Service-defined payload argument.
+ * @param arg3        Service-defined payload argument.
+ * @param arg4        Service-defined payload argument.
+ * @param arg5        Service-defined payload argument.
+ * @param private     Argument to be passed to the answer/error callback.
+ * @param callback    Answer or error callback.
+ * @param can_preempt If non-zero, the current fibril will be preempted in
+ *                    case the kernel temporarily refuses to accept more
+ *                    asynchronous calls.
+ *
+ */
+void ipc_call_async_slow(int phoneid, sysarg_t imethod, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, void *private,
     ipc_async_callback_t callback, int can_preempt)
 {
@@ -362,5 +363,5 @@
 		return;
 
-	IPC_SET_METHOD(call->u.msg.data, method);
+	IPC_SET_IMETHOD(call->u.msg.data, imethod);
 	IPC_SET_ARG1(call->u.msg.data, arg1);
 	IPC_SET_ARG2(call->u.msg.data, arg2);
@@ -393,6 +394,6 @@
  * @return		Zero on success or a value from @ref errno.h on failure.
  */
-ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4)
+sysarg_t ipc_answer_fast(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
 	return __SYSCALL6(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2, arg3,
@@ -412,6 +413,6 @@
  * @return		Zero on success or a value from @ref errno.h on failure.
  */
-ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5)
+sysarg_t ipc_answer_slow(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
 {
 	ipc_call_t data;
@@ -585,5 +586,5 @@
  */
 int ipc_connect_to_me(int phoneid, int arg1, int arg2, int arg3, 
-    ipcarg_t *phonehash)
+    sysarg_t *phonehash)
 {
 	return ipc_call_sync_3_5(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2,
@@ -602,5 +603,5 @@
 int ipc_connect_me_to(int phoneid, int arg1, int arg2, int arg3)
 {
-	ipcarg_t newphid;
+	sysarg_t newphid;
 	int res;
 
@@ -626,5 +627,5 @@
 int ipc_connect_me_to_blocking(int phoneid, int arg1, int arg2, int arg3)
 {
-	ipcarg_t newphid;
+	sysarg_t newphid;
 	int res;
 
@@ -676,12 +677,12 @@
 /** Forward a received call to another destination.
  *
- * @param callid	Hash of the call to forward.
- * @param phoneid	Phone handle to use for forwarding.
- * @param method	New method for the forwarded call.
- * @param arg1		New value of the first argument for the forwarded call.
- * @param arg2		New value of the second argument for the forwarded call.
- * @param mode		Flags specifying mode of the forward operation.
- *
- * @return		Zero on success or an error code.
+ * @param callid  Hash of the call to forward.
+ * @param phoneid Phone handle to use for forwarding.
+ * @param imethod New interface and method for the forwarded call.
+ * @param arg1    New value of the first argument for the forwarded call.
+ * @param arg2    New value of the second argument for the forwarded call.
+ * @param mode    Flags specifying mode of the forward operation.
+ *
+ * @return Zero on success or an error code.
  *
  * For non-system methods, the old method, arg1 and arg2 are rewritten by the
@@ -690,19 +691,19 @@
  * methods are forwarded verbatim.
  */
-int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
-    ipcarg_t arg1, ipcarg_t arg2, int mode)
-{
-	return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1, 
+int ipc_forward_fast(ipc_callid_t callid, int phoneid, int imethod,
+    sysarg_t arg1, sysarg_t arg2, int mode)
+{
+	return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, imethod, arg1,
 	    arg2, mode);
 }
 
 
-int ipc_forward_slow(ipc_callid_t callid, int phoneid, int method,
-    ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
+int ipc_forward_slow(ipc_callid_t callid, int phoneid, int imethod,
+    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
     int mode)
 {
 	ipc_call_t data;
-
-	IPC_SET_METHOD(data, method);
+	
+	IPC_SET_IMETHOD(data, imethod);
 	IPC_SET_ARG1(data, arg1);
 	IPC_SET_ARG2(data, arg2);
@@ -710,5 +711,5 @@
 	IPC_SET_ARG4(data, arg4);
 	IPC_SET_ARG5(data, arg5);
-
+	
 	return __SYSCALL4(SYS_IPC_FORWARD_SLOW, callid, phoneid, (sysarg_t) &data, mode);
 }
@@ -725,10 +726,10 @@
  * @return		Zero on success or a negative error code from errno.h.
  */
-int ipc_share_in_start(int phoneid, void *dst, size_t size, ipcarg_t arg,
+int ipc_share_in_start(int phoneid, void *dst, size_t size, sysarg_t arg,
     int *flags)
 {
 	sysarg_t tmp_flags = 0;
-	int res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
-	    (ipcarg_t) size, arg, NULL, &tmp_flags);
+	int res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (sysarg_t) dst,
+	    (sysarg_t) size, arg, NULL, &tmp_flags);
 	
 	if (flags)
@@ -751,5 +752,5 @@
 int ipc_share_in_finalize(ipc_callid_t callid, void *src, int flags)
 {
-	return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) flags);
+	return ipc_answer_2(callid, EOK, (sysarg_t) src, (sysarg_t) flags);
 }
 
@@ -764,6 +765,6 @@
 int ipc_share_out_start(int phoneid, void *src, int flags)
 {
-	return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
-	    (ipcarg_t) flags);
+	return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (sysarg_t) src, 0,
+	    (sysarg_t) flags);
 }
 
@@ -780,5 +781,5 @@
 int ipc_share_out_finalize(ipc_callid_t callid, void *dst)
 {
-	return ipc_answer_1(callid, EOK, (ipcarg_t) dst);
+	return ipc_answer_1(callid, EOK, (sysarg_t) dst);
 }
 
@@ -794,6 +795,6 @@
 int ipc_data_read_start(int phoneid, void *dst, size_t size)
 {
-	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
-	    (ipcarg_t) size);
+	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
+	    (sysarg_t) size);
 }
 
@@ -812,5 +813,5 @@
 int ipc_data_read_finalize(ipc_callid_t callid, const void *src, size_t size)
 {
-	return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) size);
+	return ipc_answer_2(callid, EOK, (sysarg_t) src, (sysarg_t) size);
 }
 
@@ -825,6 +826,6 @@
 int ipc_data_write_start(int phoneid, const void *src, size_t size)
 {
-	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
-	    (ipcarg_t) size);
+	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_WRITE, (sysarg_t) src,
+	    (sysarg_t) size);
 }
 
@@ -842,19 +843,22 @@
 int ipc_data_write_finalize(ipc_callid_t callid, void *dst, size_t size)
 {
-	return ipc_answer_2(callid, EOK, (ipcarg_t) dst, (ipcarg_t) size);
-}
-
-#include <kernel/syscall/sysarg64.h>
+	return ipc_answer_2(callid, EOK, (sysarg_t) dst, (sysarg_t) size);
+}
+
 /** Connect to a task specified by id.
+ *
  */
 int ipc_connect_kbox(task_id_t id)
 {
-	sysarg64_t arg;
-
-	arg.value = (unsigned long long) id;
-
+#ifdef __32_BITS__
+	sysarg64_t arg = (sysarg64_t) id;
 	return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg);
-}
- 
+#endif
+	
+#ifdef __64_BITS__
+	return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) id);
+#endif
+}
+
 /** @}
  */
Index: uspace/lib/c/generic/loader.c
===================================================================
--- uspace/lib/c/generic/loader.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/loader.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -96,5 +96,5 @@
 	}
 	
-	ipcarg_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	return (int) retval;
@@ -131,5 +131,5 @@
 	}
 	
-	ipcarg_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	return (int) retval;
@@ -166,5 +166,5 @@
 	free(pa);
 	
-	ipcarg_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	return (int) retval;
@@ -213,5 +213,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(ldr->phone_id, LOADER_SET_ARGS, &answer);
-	ipcarg_t rc = async_data_write_start(ldr->phone_id, (void *) arg_buf, buffer_size);
+	sysarg_t rc = async_data_write_start(ldr->phone_id, (void *) arg_buf, buffer_size);
 	if (rc != EOK) {
 		async_wait_for(req, NULL);
@@ -267,5 +267,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(ldr->phone_id, LOADER_SET_FILES, &answer);
-	ipcarg_t rc = async_data_write_start(ldr->phone_id, (void *) files_buf,
+	sysarg_t rc = async_data_write_start(ldr->phone_id, (void *) files_buf,
 	    count * sizeof(fdi_node_t));
 	if (rc != EOK) {
Index: uspace/lib/c/generic/net/icmp_api.c
===================================================================
--- uspace/lib/c/generic/net/icmp_api.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/net/icmp_api.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -81,5 +81,5 @@
 {
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 
 	if (addrlen <= 0)
@@ -87,5 +87,5 @@
 
 	message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl,
-	    tos, (ipcarg_t) dont_fragment, NULL);
+	    tos, (sysarg_t) dont_fragment, NULL);
 
 	// send the address
Index: uspace/lib/c/generic/net/modules.c
===================================================================
--- uspace/lib/c/generic/net/modules.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/net/modules.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -67,21 +67,21 @@
 		switch (answer_count) {
 		case 0:
-			ipc_answer_0(callid, (ipcarg_t) result);
+			ipc_answer_0(callid, (sysarg_t) result);
 			break;
 		case 1:
-			ipc_answer_1(callid, (ipcarg_t) result,
+			ipc_answer_1(callid, (sysarg_t) result,
 			    IPC_GET_ARG1(*answer));
 			break;
 		case 2:
-			ipc_answer_2(callid, (ipcarg_t) result,
+			ipc_answer_2(callid, (sysarg_t) result,
 			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer));
 			break;
 		case 3:
-			ipc_answer_3(callid, (ipcarg_t) result,
+			ipc_answer_3(callid, (sysarg_t) result,
 			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
 			    IPC_GET_ARG3(*answer));
 			break;
 		case 4:
-			ipc_answer_4(callid, (ipcarg_t) result,
+			ipc_answer_4(callid, (sysarg_t) result,
 			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
 			    IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer));
@@ -89,5 +89,5 @@
 		case 5:
 		default:
-			ipc_answer_5(callid, (ipcarg_t) result,
+			ipc_answer_5(callid, (sysarg_t) result,
 			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
 			    IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer),
@@ -111,5 +111,5 @@
  *			function.
  */
-int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3,
+int bind_service(services_t need, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     async_client_conn_t client_receiver)
 {
@@ -134,6 +134,6 @@
  *
  */
-int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2,
-    ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)
+int bind_service_timeout(services_t need, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)
 {
 	int rc;
@@ -143,5 +143,5 @@
 	if (phone >= 0) {
 		/* Request the bidirectional connection */
-		ipcarg_t phonehash;
+		sysarg_t phonehash;
 		
 		rc = ipc_connect_to_me(phone, arg1, arg2, arg3, &phonehash);
@@ -196,44 +196,4 @@
 		timeout -= MODULE_WAIT_TIME;
 	}
-}
-
-/** Receives data from the other party.
- *
- * The received data buffer is allocated and returned.
- *
- * @param[out] data	The data buffer to be filled.
- * @param[out] length	The buffer length.
- * @return		EOK on success.
- * @return		EBADMEM if the data or the length parameter is NULL.
- * @return		EINVAL if the client does not send data.
- * @return		ENOMEM if there is not enough memory left.
- * @return		Other error codes as defined for the
- *			async_data_write_finalize() function.
- */
-int data_receive(void **data, size_t *length)
-{
-	ipc_callid_t callid;
-	int rc;
-
-	if (!data || !length)
-		return EBADMEM;
-
-	// fetch the request
-	if (!async_data_write_receive(&callid, length))
-		return EINVAL;
-
-	// allocate the buffer
-	*data = malloc(*length);
-	if (!*data)
-		return ENOMEM;
-
-	// fetch the data
-	rc = async_data_write_finalize(callid, *data, *length);
-	if (rc != EOK) {
-		free(data);
-		return rc;
-	}
-
-	return EOK;
 }
 
@@ -283,5 +243,5 @@
 		IPC_SET_RETVAL(*answer, 0);
 		// just to be precize
-		IPC_SET_METHOD(*answer, 0);
+		IPC_SET_IMETHOD(*answer, 0);
 		IPC_SET_ARG1(*answer, 0);
 		IPC_SET_ARG2(*answer, 0);
Index: uspace/lib/c/generic/net/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/net/packet.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,5 +62,5 @@
 
 /** Type definition of the packet map page. */
-typedef packet_t packet_map_t[PACKET_MAP_SIZE];
+typedef packet_t *packet_map_t[PACKET_MAP_SIZE];
 
 /** Packet map.
@@ -104,8 +104,8 @@
  * @return		NULL if the mapping does not exist.
  */
-packet_t pm_find(packet_id_t packet_id)
+packet_t *pm_find(packet_id_t packet_id)
 {
 	packet_map_t *map;
-	packet_t packet;
+	packet_t *packet;
 
 	if (!packet_id)
@@ -135,5 +135,5 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-int pm_add(packet_t packet)
+int pm_add(packet_t *packet)
 {
 	packet_map_t *map;
@@ -178,5 +178,5 @@
 	int index;
 	packet_map_t *map;
-	packet_t packet;
+	packet_t *packet;
 
 	fibril_rwlock_write_lock(&pm_globals.lock);
@@ -209,7 +209,7 @@
  * @return		EINVAL if the packet is not valid.
  */
-int pq_add(packet_t * first, packet_t packet, size_t order, size_t metric)
-{
-	packet_t item;
+int pq_add(packet_t **first, packet_t *packet, size_t order, size_t metric)
+{
+	packet_t *item;
 
 	if (!first || !packet_is_valid(packet))
@@ -253,7 +253,7 @@
  * @return		NULL if the packet is not found.
  */
-packet_t pq_find(packet_t packet, size_t order)
-{
-	packet_t item;
+packet_t *pq_find(packet_t *packet, size_t order)
+{
+	packet_t *item;
 
 	if (!packet_is_valid(packet))
@@ -278,7 +278,7 @@
  * @return		EINVAL if etiher of the packets is invalid.
  */
-int pq_insert_after(packet_t packet, packet_t new_packet)
-{
-	packet_t item;
+int pq_insert_after(packet_t *packet, packet_t *new_packet)
+{
+	packet_t *item;
 
 	if (!packet_is_valid(packet) || !packet_is_valid(new_packet))
@@ -303,8 +303,8 @@
  * @return		NULL if the packet is not valid.
  */
-packet_t pq_detach(packet_t packet)
-{
-	packet_t next;
-	packet_t previous;
+packet_t *pq_detach(packet_t *packet)
+{
+	packet_t *next;
+	packet_t *previous;
 
 	if (!packet_is_valid(packet))
@@ -331,5 +331,5 @@
  * @return		EINVAL if the packet is invalid.
  */
-int pq_set_order(packet_t packet, size_t order, size_t metric)
+int pq_set_order(packet_t *packet, size_t order, size_t metric)
 {
 	if (!packet_is_valid(packet))
@@ -349,5 +349,5 @@
  * @return		EINVAL if the packet is invalid.
  */
-int pq_get_order(packet_t packet, size_t *order, size_t *metric)
+int pq_get_order(packet_t *packet, size_t *order, size_t *metric)
 {
 	if (!packet_is_valid(packet))
@@ -372,8 +372,8 @@
  *			packets after its detachment.
  */
-void pq_destroy(packet_t first, void (*packet_release)(packet_t packet))
-{
-	packet_t actual;
-	packet_t next;
+void pq_destroy(packet_t *first, void (*packet_release)(packet_t *packet))
+{
+	packet_t *actual;
+	packet_t *next;
 
 	actual = first;
@@ -395,5 +395,5 @@
  * @return		NULL if the packet is not valid.
  */
-packet_t pq_next(packet_t packet)
+packet_t *pq_next(packet_t *packet)
 {
 	if (!packet_is_valid(packet))
@@ -410,5 +410,5 @@
  * @return		NULL if the packet is not valid.
  */
-packet_t pq_previous(packet_t packet)
+packet_t *pq_previous(packet_t *packet)
 {
 	if (!packet_is_valid(packet))
Index: uspace/lib/c/generic/net/socket_client.c
===================================================================
--- uspace/lib/c/generic/net/socket_client.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/net/socket_client.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -214,5 +214,5 @@
 	callid = async_get_call(&call);
 
-	switch (IPC_GET_METHOD(call)) {
+	switch (IPC_GET_IMETHOD(call)) {
 	case NET_SOCKET_RECEIVED:
 	case NET_SOCKET_ACCEPTED:
@@ -229,5 +229,5 @@
 		}
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case NET_SOCKET_RECEIVED:
 			fibril_mutex_lock(&socket->receive_lock);
@@ -278,5 +278,5 @@
 	}
 
-	ipc_answer_0(callid, (ipcarg_t) rc);
+	ipc_answer_0(callid, (sysarg_t) rc);
 	goto loop;
 }
@@ -404,6 +404,6 @@
 	int socket_id;
 	services_t service;
-	ipcarg_t fragment_size;
-	ipcarg_t header_size;
+	sysarg_t fragment_size;
+	sysarg_t header_size;
 	int rc;
 
@@ -494,5 +494,5 @@
 		dyn_fifo_destroy(&socket->accepted);
 		free(socket);
-		async_msg_3(phone, NET_SOCKET_CLOSE, (ipcarg_t) socket_id, 0,
+		async_msg_3(phone, NET_SOCKET_CLOSE, (sysarg_t) socket_id, 0,
 		    service);
 		return rc;
@@ -516,10 +516,10 @@
  */
 static int
-socket_send_data(int socket_id, ipcarg_t message, ipcarg_t arg2,
+socket_send_data(int socket_id, sysarg_t message, sysarg_t arg2,
     const void *data, size_t datalength)
 {
 	socket_t *socket;
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 
 	if (!data)
@@ -540,5 +540,5 @@
 	// request the message
 	message_id = async_send_3(socket->phone, message,
-	    (ipcarg_t) socket->socket_id, arg2, socket->service, NULL);
+	    (sysarg_t) socket->socket_id, arg2, socket->service, NULL);
 	// send the address
 	async_data_write_start(socket->phone, data, datalength);
@@ -600,5 +600,5 @@
 	// request listen backlog change
 	result = (int) async_req_3_0(socket->phone, NET_SOCKET_LISTEN,
-	    (ipcarg_t) socket->socket_id, (ipcarg_t) backlog, socket->service);
+	    (sysarg_t) socket->socket_id, (sysarg_t) backlog, socket->service);
 
 	fibril_rwlock_read_unlock(&socket_globals.lock);
@@ -625,5 +625,5 @@
 	socket_t *new_socket;
 	aid_t message_id;
-	ipcarg_t ipc_result;
+	sysarg_t ipc_result;
 	int result;
 	ipc_call_t answer;
@@ -683,5 +683,5 @@
 	// request accept
 	message_id = async_send_5(socket->phone, NET_SOCKET_ACCEPT,
-	    (ipcarg_t) socket->socket_id, 0, socket->service, 0,
+	    (sysarg_t) socket->socket_id, 0, socket->service, 0,
 	    new_socket->socket_id, &answer);
 
@@ -782,5 +782,5 @@
 	// request close
 	rc = (int) async_req_3_0(socket->phone, NET_SOCKET_CLOSE,
-	    (ipcarg_t) socket->socket_id, 0, socket->service);
+	    (sysarg_t) socket->socket_id, 0, socket->service);
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&socket_globals.lock);
@@ -815,5 +815,5 @@
  */
 static int
-sendto_core(ipcarg_t message, int socket_id, const void *data,
+sendto_core(sysarg_t message, int socket_id, const void *data,
     size_t datalength, int flags, const struct sockaddr *toaddr,
     socklen_t addrlen)
@@ -821,5 +821,5 @@
 	socket_t *socket;
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 	size_t fragments;
 	ipc_call_t answer;
@@ -855,7 +855,7 @@
 	// request send
 	message_id = async_send_5(socket->phone, message,
-	    (ipcarg_t) socket->socket_id,
+	    (sysarg_t) socket->socket_id,
 	    (fragments == 1 ? datalength : socket->data_fragment_size),
-	    socket->service, (ipcarg_t) flags, fragments, &answer);
+	    socket->service, (sysarg_t) flags, fragments, &answer);
 
 	// send the address if given
@@ -973,10 +973,10 @@
  */
 static int
-recvfrom_core(ipcarg_t message, int socket_id, void *data, size_t datalength,
+recvfrom_core(sysarg_t message, int socket_id, void *data, size_t datalength,
     int flags, struct sockaddr *fromaddr, socklen_t *addrlen)
 {
 	socket_t *socket;
 	aid_t message_id;
-	ipcarg_t ipc_result;
+	sysarg_t ipc_result;
 	int result;
 	size_t fragments;
@@ -1031,6 +1031,6 @@
 		// request packet data
 		message_id = async_send_4(socket->phone, message,
-		    (ipcarg_t) socket->socket_id, 0, socket->service,
-		    (ipcarg_t) flags, &answer);
+		    (sysarg_t) socket->socket_id, 0, socket->service,
+		    (sysarg_t) flags, &answer);
 
 		// read the address if desired
@@ -1060,6 +1060,6 @@
 		// request packet data
 		message_id = async_send_4(socket->phone, message,
-		    (ipcarg_t) socket->socket_id, 0, socket->service,
-		    (ipcarg_t) flags, &answer);
+		    (sysarg_t) socket->socket_id, 0, socket->service,
+		    (sysarg_t) flags, &answer);
 
 		// read the address if desired
@@ -1160,5 +1160,5 @@
 	socket_t *socket;
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 
 	if (!value || !optlen)
@@ -1179,5 +1179,5 @@
 	// request option value
 	message_id = async_send_3(socket->phone, NET_SOCKET_GETSOCKOPT,
-	    (ipcarg_t) socket->socket_id, (ipcarg_t) optname, socket->service,
+	    (sysarg_t) socket->socket_id, (sysarg_t) optname, socket->service,
 	    NULL);
 
@@ -1214,5 +1214,5 @@
 	// send the value
 	return socket_send_data(socket_id, NET_SOCKET_SETSOCKOPT,
-	    (ipcarg_t) optname, value, optlen);
+	    (sysarg_t) optname, value, optlen);
 }
 
Index: uspace/lib/c/generic/stacktrace.c
===================================================================
--- uspace/lib/c/generic/stacktrace.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/stacktrace.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -50,5 +50,5 @@
 
 	while (stacktrace_fp_valid(&st, fp)) {
-		printf("%p: %p()\n", fp, pc);
+		printf("%p: %p()\n", (void *) fp, (void *) pc);
 		(void) stacktrace_ra_get(&st, fp, &pc);
 		(void) stacktrace_fp_prev(&st, fp, &nfp);
Index: uspace/lib/c/generic/str.c
===================================================================
--- uspace/lib/c/generic/str.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/str.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1005,4 +1005,210 @@
 	*end = '\0';
 	return start;
+}
+
+/** Convert string to uint64_t (internal variant).
+ *
+ * @param nptr   Pointer to string.
+ * @param endptr Pointer to the first invalid character is stored here.
+ * @param base   Zero or number between 2 and 36 inclusive.
+ * @param neg    Indication of unary minus is stored here.
+ * @apram result Result of the conversion.
+ *
+ * @return EOK if conversion was successful.
+ *
+ */
+static int str_uint(const char *nptr, char **endptr, unsigned int base,
+    bool *neg, uint64_t *result)
+{
+	assert(endptr != NULL);
+	assert(neg != NULL);
+	assert(result != NULL);
+	
+	*neg = false;
+	const char *str = nptr;
+	
+	/* Ignore leading whitespace */
+	while (isspace(*str))
+		str++;
+	
+	if (*str == '-') {
+		*neg = true;
+		str++;
+	} else if (*str == '+')
+		str++;
+	
+	if (base == 0) {
+		/* Decode base if not specified */
+		base = 10;
+		
+		if (*str == '0') {
+			base = 8;
+			str++;
+			
+			switch (*str) {
+			case 'b':
+			case 'B':
+				base = 2;
+				str++;
+				break;
+			case 'o':
+			case 'O':
+				base = 8;
+				str++;
+				break;
+			case 'd':
+			case 'D':
+			case 't':
+			case 'T':
+				base = 10;
+				str++;
+				break;
+			case 'x':
+			case 'X':
+				base = 16;
+				str++;
+				break;
+			default:
+				str--;
+			}
+		}
+	} else {
+		/* Check base range */
+		if ((base < 2) || (base > 36)) {
+			*endptr = (char *) str;
+			return EINVAL;
+		}
+	}
+	
+	*result = 0;
+	const char *startstr = str;
+	
+	while (*str != 0) {
+		unsigned int digit;
+		
+		if ((*str >= 'a') && (*str <= 'z'))
+			digit = *str - 'a' + 10;
+		else if ((*str >= 'A') && (*str <= 'Z'))
+			digit = *str - 'A' + 10;
+		else if ((*str >= '0') && (*str <= '9'))
+			digit = *str - '0';
+		else
+			break;
+		
+		if (digit >= base)
+			break;
+		
+		uint64_t prev = *result;
+		*result = (*result) * base + digit;
+		
+		if (*result < prev) {
+			/* Overflow */
+			*endptr = (char *) str;
+			return EOVERFLOW;
+		}
+		
+		str++;
+	}
+	
+	if (str == startstr) {
+		/*
+		 * No digits were decoded => first invalid character is
+		 * the first character of the string.
+		 */
+		str = nptr;
+	}
+	
+	*endptr = (char *) str;
+	
+	if (str == nptr)
+		return EINVAL;
+	
+	return EOK;
+}
+
+/** Convert string to uint64_t.
+ *
+ * @param nptr   Pointer to string.
+ * @param endptr If not NULL, pointer to the first invalid character
+ *               is stored here.
+ * @param base   Zero or number between 2 and 36 inclusive.
+ * @param strict Do not allow any trailing characters.
+ * @param result Result of the conversion.
+ *
+ * @return EOK if conversion was successful.
+ *
+ */
+int str_uint64(const char *nptr, char **endptr, unsigned int base,
+    bool strict, uint64_t *result)
+{
+	assert(result != NULL);
+	
+	bool neg;
+	char *lendptr;
+	int ret = str_uint(nptr, &lendptr, base, &neg, result);
+	
+	if (endptr != NULL)
+		*endptr = (char *) lendptr;
+	
+	if (ret != EOK)
+		return ret;
+	
+	/* Do not allow negative values */
+	if (neg)
+		return EINVAL;
+	
+	/* Check whether we are at the end of
+	   the string in strict mode */
+	if ((strict) && (*lendptr != 0))
+		return EINVAL;
+	
+	return EOK;
+}
+
+/** Convert string to size_t.
+ *
+ * @param nptr   Pointer to string.
+ * @param endptr If not NULL, pointer to the first invalid character
+ *               is stored here.
+ * @param base   Zero or number between 2 and 36 inclusive.
+ * @param strict Do not allow any trailing characters.
+ * @param result Result of the conversion.
+ *
+ * @return EOK if conversion was successful.
+ *
+ */
+int str_size_t(const char *nptr, char **endptr, unsigned int base,
+    bool strict, size_t *result)
+{
+	assert(result != NULL);
+	
+	bool neg;
+	char *lendptr;
+	uint64_t res;
+	int ret = str_uint(nptr, &lendptr, base, &neg, &res);
+	
+	if (endptr != NULL)
+		*endptr = (char *) lendptr;
+	
+	if (ret != EOK)
+		return ret;
+	
+	/* Do not allow negative values */
+	if (neg)
+		return EINVAL;
+	
+	/* Check whether we are at the end of
+	   the string in strict mode */
+	if ((strict) && (*lendptr != 0))
+		return EINVAL;
+	
+	/* Check for overflow */
+	size_t _res = (size_t) res;
+	if (_res != res)
+		return EOVERFLOW;
+	
+	*result = _res;
+	
+	return EOK;
 }
 
Index: uspace/lib/c/generic/task.c
===================================================================
--- uspace/lib/c/generic/task.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/task.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,8 +47,14 @@
 task_id_t task_get_id(void)
 {
+#ifdef __32_BITS__
 	task_id_t task_id;
 	(void) __SYSCALL1(SYS_TASK_GET_ID, (sysarg_t) &task_id);
 	
 	return task_id;
+#endif  /* __32_BITS__ */
+	
+#ifdef __64_BITS__
+	return (task_id_t) __SYSCALL0(SYS_TASK_GET_ID);
+#endif  /* __64_BITS__ */
 }
 
@@ -211,5 +217,5 @@
 int task_wait(task_id_t id, task_exit_t *texit, int *retval)
 {
-	ipcarg_t te, rv;
+	sysarg_t te, rv;
 	int rc;
 
Index: uspace/lib/c/generic/udebug.c
===================================================================
--- uspace/lib/c/generic/udebug.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/udebug.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,5 +57,5 @@
 	size_t *copied, size_t *needed)
 {
-	ipcarg_t a_copied, a_needed;
+	sysarg_t a_copied, a_needed;
 	int rc;
 
@@ -72,5 +72,5 @@
 	size_t *copied, size_t *needed)
 {
-	ipcarg_t a_copied, a_needed;
+	sysarg_t a_copied, a_needed;
 	int rc;
 
@@ -87,5 +87,5 @@
 	size_t *copied, size_t *needed)
 {
-	ipcarg_t a_copied, a_needed;
+	sysarg_t a_copied, a_needed;
 	int rc;
 
@@ -120,5 +120,5 @@
     sysarg_t *val0, sysarg_t *val1)
 {
-	ipcarg_t a_ev_type;
+	sysarg_t a_ev_type;
 	int rc;
 
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -158,7 +158,7 @@
 	vfs_connect();
 	
-	ipcarg_t rc_orig;
+	sysarg_t rc_orig;
 	aid_t req = async_send_2(vfs_phone, VFS_IN_MOUNT, devmap_handle, flags, NULL);
-	ipcarg_t rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size);
+	sysarg_t rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size);
 	if (rc != EOK) {
 		async_wait_for(req, &rc_orig);
@@ -238,6 +238,6 @@
 int unmount(const char *mp)
 {
-	ipcarg_t rc;
-	ipcarg_t rc_orig;
+	sysarg_t rc;
+	sysarg_t rc_orig;
 	aid_t req;
 	size_t mpa_size;
@@ -282,8 +282,8 @@
 	ipc_call_t answer;
 	aid_t req = async_send_3(vfs_phone, VFS_IN_OPEN, lflag, oflag, 0, &answer);
-	ipcarg_t rc = async_data_write_start(vfs_phone, abs, abs_size);
-	
-	if (rc != EOK) {
-		ipcarg_t rc_orig;
+	sysarg_t rc = async_data_write_start(vfs_phone, abs, abs_size);
+	
+	if (rc != EOK) {
+		sysarg_t rc_orig;
 		async_wait_for(req, &rc_orig);
 		
@@ -330,5 +330,5 @@
 	    node->devmap_handle, node->index, oflag, &answer);
 	
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	async_serialize_end();
@@ -343,5 +343,5 @@
 int close(int fildes)
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	
 	futex_down(&vfs_phone_futex);
@@ -359,5 +359,5 @@
 ssize_t read(int fildes, void *buf, size_t nbyte) 
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	ipc_call_t answer;
 	aid_t req;
@@ -370,5 +370,5 @@
 	rc = async_data_read_start(vfs_phone, (void *)buf, nbyte);
 	if (rc != EOK) {
-		ipcarg_t rc_orig;
+		sysarg_t rc_orig;
 	
 		async_wait_for(req, &rc_orig);
@@ -391,5 +391,5 @@
 ssize_t write(int fildes, const void *buf, size_t nbyte) 
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	ipc_call_t answer;
 	aid_t req;
@@ -402,5 +402,5 @@
 	rc = async_data_write_start(vfs_phone, (void *)buf, nbyte);
 	if (rc != EOK) {
-		ipcarg_t rc_orig;
+		sysarg_t rc_orig;
 	
 		async_wait_for(req, &rc_orig);
@@ -427,5 +427,5 @@
 	vfs_connect();
 	
-	ipcarg_t rc = async_req_1_0(vfs_phone, VFS_IN_SYNC, fildes);
+	sysarg_t rc = async_req_1_0(vfs_phone, VFS_IN_SYNC, fildes);
 	
 	async_serialize_end();
@@ -441,7 +441,7 @@
 	vfs_connect();
 	
-	ipcarg_t newoff_lo;
-	ipcarg_t newoff_hi;
-	ipcarg_t rc = async_req_4_2(vfs_phone, VFS_IN_SEEK, fildes,
+	sysarg_t newoff_lo;
+	sysarg_t newoff_hi;
+	sysarg_t rc = async_req_4_2(vfs_phone, VFS_IN_SEEK, fildes,
 	    LOWER32(offset), UPPER32(offset), whence,
 	    &newoff_lo, &newoff_hi);
@@ -458,5 +458,5 @@
 int ftruncate(int fildes, aoff64_t length)
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	
 	futex_down(&vfs_phone_futex);
@@ -474,5 +474,5 @@
 int fstat(int fildes, struct stat *stat)
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	aid_t req;
 
@@ -484,5 +484,5 @@
 	rc = async_data_read_start(vfs_phone, (void *) stat, sizeof(struct stat));
 	if (rc != EOK) {
-		ipcarg_t rc_orig;
+		sysarg_t rc_orig;
 		
 		async_wait_for(req, &rc_orig);
@@ -503,6 +503,6 @@
 int stat(const char *path, struct stat *stat)
 {
-	ipcarg_t rc;
-	ipcarg_t rc_orig;
+	sysarg_t rc;
+	sysarg_t rc_orig;
 	aid_t req;
 	
@@ -593,5 +593,5 @@
 int mkdir(const char *path, mode_t mode)
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	aid_t req;
 	
@@ -608,5 +608,5 @@
 	rc = async_data_write_start(vfs_phone, pa, pa_size);
 	if (rc != EOK) {
-		ipcarg_t rc_orig;
+		sysarg_t rc_orig;
 	
 		async_wait_for(req, &rc_orig);
@@ -628,5 +628,5 @@
 static int _unlink(const char *path, int lflag)
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	aid_t req;
 	
@@ -643,5 +643,5 @@
 	rc = async_data_write_start(vfs_phone, pa, pa_size);
 	if (rc != EOK) {
-		ipcarg_t rc_orig;
+		sysarg_t rc_orig;
 
 		async_wait_for(req, &rc_orig);
@@ -673,6 +673,6 @@
 int rename(const char *old, const char *new)
 {
-	ipcarg_t rc;
-	ipcarg_t rc_orig;
+	sysarg_t rc;
+	sysarg_t rc_orig;
 	aid_t req;
 	
@@ -810,6 +810,6 @@
 	vfs_connect();
 	
-	ipcarg_t ret;
-	ipcarg_t rc = async_req_2_1(vfs_phone, VFS_IN_DUP, oldfd, newfd, &ret);
+	sysarg_t ret;
+	sysarg_t rc = async_req_2_1(vfs_phone, VFS_IN_DUP, oldfd, newfd, &ret);
 	
 	async_serialize_end();
Index: uspace/lib/c/include/adt/generic_field.h
===================================================================
--- uspace/lib/c/include/adt/generic_field.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/adt/generic_field.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -91,5 +91,5 @@
 			} \
 			field->items[field->next] = value; \
-			++field->next; \
+			field->next++; \
 			field->items[field->next] = NULL; \
 			return field->next - 1; \
@@ -108,5 +108,5 @@
 			int index; \
 			field->magic = 0; \
-			for (index = 0; index < field->next; ++ index) { \
+			for (index = 0; index < field->next; index++) { \
 				if (field->items[index]) \
 					free(field->items[index]); \
Index: uspace/lib/c/include/assert.h
===================================================================
--- uspace/lib/c/include/assert.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/assert.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,15 +51,19 @@
 
 #ifndef NDEBUG
-#	define assert(expr) \
-		do { \
-			if (!(expr)) { \
-				printf("Assertion failed (%s) at file '%s', " \
-				    "line %d.\n", #expr, __FILE__, __LINE__); \
-				abort(); \
-			} \
-		} while (0)
-#else
-#	define assert(expr)
-#endif
+
+#define assert(expr) \
+	do { \
+		if (!(expr)) { \
+			printf("Assertion failed (%s) at file '%s', " \
+			    "line %d.\n", #expr, __FILE__, __LINE__); \
+			abort(); \
+		} \
+	} while (0)
+
+#else /* NDEBUG */
+
+#define assert(expr)
+
+#endif /* NDEBUG */
 
 #endif
Index: uspace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/async.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -84,14 +84,14 @@
 	    (arg5), (dataptr))
 
-extern aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr);
-extern aid_t async_send_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
+extern aid_t async_send_fast(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr);
+extern aid_t async_send_slow(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
     ipc_call_t *dataptr);
-extern void async_wait_for(aid_t amsgid, ipcarg_t *result);
-extern int async_wait_timeout(aid_t amsgid, ipcarg_t *retval,
+extern void async_wait_for(aid_t amsgid, sysarg_t *result);
+extern int async_wait_timeout(aid_t amsgid, sysarg_t *retval,
     suseconds_t timeout);
 
-extern fid_t async_new_connection(ipcarg_t in_phone_hash, ipc_callid_t callid,
+extern fid_t async_new_connection(sysarg_t in_phone_hash, ipc_callid_t callid,
     ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *));
 extern void async_usleep(suseconds_t timeout);
@@ -242,10 +242,10 @@
 	    (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
 
-extern ipcarg_t async_req_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t *r1, ipcarg_t *r2,
-    ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5);
-extern ipcarg_t async_req_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *r1,
-    ipcarg_t *r2, ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5);
+extern sysarg_t async_req_fast(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
+    sysarg_t *r3, sysarg_t *r4, sysarg_t *r5);
+extern sysarg_t async_req_slow(int phoneid, sysarg_t method, sysarg_t arg1,
+    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
+    sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5);
 
 static inline void async_serialize_start(void)
@@ -259,6 +259,6 @@
 }
 
-extern int async_connect_me_to(int, ipcarg_t, ipcarg_t, ipcarg_t);
-extern int async_connect_me_to_blocking(int, ipcarg_t, ipcarg_t, ipcarg_t);
+extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
+extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
 
 /*
@@ -274,5 +274,5 @@
 	async_share_in_start((phoneid), (dst), (size), (arg), (flags))
 
-extern int async_share_in_start(int, void *, size_t, ipcarg_t, int *);
+extern int async_share_in_start(int, void *, size_t, sysarg_t, int *);
 extern int async_share_in_receive(ipc_callid_t *, size_t *);
 extern int async_share_in_finalize(ipc_callid_t, void *, int );
@@ -314,6 +314,6 @@
 extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
 
-extern int async_data_read_forward_fast(int, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t, ipc_call_t *);
+extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, ipc_call_t *);
 
 /*
@@ -356,6 +356,6 @@
 extern void async_data_write_void(const int);
 
-extern int async_data_write_forward_fast(int, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t, ipc_call_t *);
+extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, ipc_call_t *);
 
 #endif
Index: uspace/lib/c/include/device/char.h
===================================================================
--- uspace/lib/c/include/device/char.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/device/char.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
  /** @addtogroup libc
  * @{
@@ -32,5 +32,5 @@
 /** @file
  */
- 
+
 #ifndef LIBC_DEVICE_HW_RES_H_
 #define LIBC_DEVICE_HW_RES_H_
@@ -38,9 +38,9 @@
 typedef enum {
 	CHAR_READ_DEV = 0,
-	CHAR_WRITE_DEV	
+	CHAR_WRITE_DEV
 } hw_res_funcs_t;
 
-int read_dev(int dev_phone, void *buf, size_t len);
-int write_dev(int dev_phone, void *buf, size_t len);
+ssize_t read_dev(int dev_phone, void *buf, size_t len);
+ssize_t write_dev(int dev_phone, void *buf, size_t len);
 
 #endif
Index: uspace/lib/c/include/device/hw_res.h
===================================================================
--- uspace/lib/c/include/device/hw_res.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/device/hw_res.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -95,7 +95,6 @@
 
 
-bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources);
-
-bool enable_interrupt(int dev_phone);
+extern int get_hw_resources(int, hw_resource_list_t *);
+extern bool enable_interrupt(int);
 
 
Index: uspace/lib/c/include/devmap.h
===================================================================
--- uspace/lib/c/include/devmap.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/devmap.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -45,4 +45,5 @@
 extern int devmap_driver_register(const char *, async_client_conn_t);
 extern int devmap_device_register(const char *, devmap_handle_t *);
+extern int devmap_device_register_with_iface(const char *, devmap_handle_t *, sysarg_t);
 
 extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int);
Index: uspace/lib/c/include/err.h
===================================================================
--- uspace/lib/c/include/err.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/err.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -38,8 +38,9 @@
 #include <stdio.h>
 
-#define errx(status, fmt, ...) { \
-	printf((fmt), ##__VA_ARGS__); \
-	_exit(status); \
-}
+#define errx(status, fmt, ...) \
+	{ \
+		printf((fmt), ##__VA_ARGS__); \
+		_exit(status); \
+	}
 
 #endif
@@ -47,3 +48,2 @@
 /** @}
  */
-
Index: uspace/lib/c/include/errno.h
===================================================================
--- uspace/lib/c/include/errno.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/errno.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -83,8 +83,6 @@
 #define ENOTCONN	(-10057)
 
-/** The requested operation was not performed.
- *  Try again later.
- */
-#define TRY_AGAIN	(-11002)
+/** The requested operation was not performed. Try again later. */
+#define EAGAIN		(-11002)
 
 /** No data.
Index: uspace/lib/c/include/event.h
===================================================================
--- uspace/lib/c/include/event.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/event.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 #include <ipc/ipc.h>
 
-extern int event_subscribe(event_type_t, ipcarg_t);
+extern int event_subscribe(event_type_t, sysarg_t);
 
 #endif
Index: uspace/lib/c/include/fibril_synch.h
===================================================================
--- uspace/lib/c/include/fibril_synch.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/fibril_synch.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -105,4 +105,5 @@
 extern bool fibril_mutex_trylock(fibril_mutex_t *);
 extern void fibril_mutex_unlock(fibril_mutex_t *);
+extern bool fibril_mutex_is_locked(fibril_mutex_t *);
 
 extern void fibril_rwlock_initialize(fibril_rwlock_t *);
@@ -111,4 +112,7 @@
 extern void fibril_rwlock_read_unlock(fibril_rwlock_t *);
 extern void fibril_rwlock_write_unlock(fibril_rwlock_t *);
+extern bool fibril_rwlock_is_read_locked(fibril_rwlock_t *);
+extern bool fibril_rwlock_is_write_locked(fibril_rwlock_t *);
+extern bool fibril_rwlock_is_locked(fibril_rwlock_t *);
 
 extern void fibril_condvar_initialize(fibril_condvar_t *);
Index: uspace/lib/c/include/io/console.h
===================================================================
--- uspace/lib/c/include/io/console.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/io/console.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -68,7 +68,7 @@
 extern void console_clear(int phone);
 
-extern int console_get_size(int phone, ipcarg_t *cols, ipcarg_t *rows);
-extern int console_get_pos(int phone, ipcarg_t *col, ipcarg_t *row);
-extern void console_set_pos(int phone, ipcarg_t col, ipcarg_t row);
+extern int console_get_size(int phone, sysarg_t *cols, sysarg_t *rows);
+extern int console_get_pos(int phone, sysarg_t *col, sysarg_t *row);
+extern void console_set_pos(int phone, sysarg_t col, sysarg_t row);
 
 extern void console_set_style(int phone, uint8_t style);
@@ -78,5 +78,5 @@
 
 extern void console_cursor_visibility(int phone, bool show);
-extern int console_get_color_cap(int phone, ipcarg_t *ccap);
+extern int console_get_color_cap(int phone, sysarg_t *ccap);
 extern void console_kcon_enable(int phone);
 
Index: uspace/lib/c/include/io/screenbuffer.h
===================================================================
--- uspace/lib/c/include/io/screenbuffer.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/io/screenbuffer.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -84,10 +84,10 @@
 	keyfield_t *buffer;      /**< Screen content - characters and
 	                              their attributes (used as a circular buffer) */
-	ipcarg_t size_x;         /**< Number of columns  */
-	ipcarg_t size_y;         /**< Number of rows */
+	sysarg_t size_x;         /**< Number of columns  */
+	sysarg_t size_y;         /**< Number of rows */
 	
 	/** Coordinates of last printed character for determining cursor position */
-	ipcarg_t position_x;
-	ipcarg_t position_y;
+	sysarg_t position_x;
+	sysarg_t position_y;
 	
 	attrs_t attrs;           /**< Current attributes. */
@@ -109,5 +109,5 @@
  *
  */
-static inline keyfield_t *get_field_at(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y)
+static inline keyfield_t *get_field_at(screenbuffer_t *scr, sysarg_t x, sysarg_t y)
 {
 	return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x;
@@ -143,10 +143,10 @@
 
 extern void screenbuffer_putchar(screenbuffer_t *, wchar_t);
-extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, ipcarg_t, ipcarg_t);
+extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, sysarg_t, sysarg_t);
 
 extern void screenbuffer_clear(screenbuffer_t *);
-extern void screenbuffer_clear_line(screenbuffer_t *, ipcarg_t);
+extern void screenbuffer_clear_line(screenbuffer_t *, sysarg_t);
 extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *);
-extern void screenbuffer_goto(screenbuffer_t *, ipcarg_t, ipcarg_t);
+extern void screenbuffer_goto(screenbuffer_t *, sysarg_t, sysarg_t);
 extern void screenbuffer_set_style(screenbuffer_t *, uint8_t);
 extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t);
Index: uspace/lib/c/include/ipc/devman.h
===================================================================
--- uspace/lib/c/include/ipc/devman.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/devman.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -42,5 +42,5 @@
 #define DEVMAN_NAME_MAXLEN 256
 
-typedef ipcarg_t devman_handle_t;
+typedef sysarg_t devman_handle_t;
 
 /** Ids of device models used for device-to-driver matching.
@@ -123,4 +123,5 @@
 	DEVMAN_CLIENT,
 	DEVMAN_CONNECT_TO_DEVICE,
+	DEVMAN_CONNECT_FROM_DEVMAP,
 	DEVMAN_CONNECT_TO_PARENTS_DEVICE
 } devman_interface_t;
Index: uspace/lib/c/include/ipc/devmap.h
===================================================================
--- uspace/lib/c/include/ipc/devmap.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/devmap.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,5 +40,5 @@
 #define DEVMAP_NAME_MAXLEN  255
 
-typedef ipcarg_t devmap_handle_t;
+typedef sysarg_t devmap_handle_t;
 
 typedef enum {
Index: uspace/lib/c/include/ipc/ip.h
===================================================================
--- uspace/lib/c/include/ipc/ip.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/ip.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -93,5 +93,5 @@
 #define IP_SET_HEADERLEN(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG2(*answer, argument); \
 	} while (0)
Index: uspace/lib/c/include/ipc/ipc.h
===================================================================
--- uspace/lib/c/include/ipc/ipc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/ipc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,9 +44,7 @@
 #define IPC_FLAG_BLOCKING  0x01
 
-typedef sysarg_t ipcarg_t;
-
 typedef struct {
-	ipcarg_t args[IPC_CALL_LEN];
-	ipcarg_t in_phone_hash;
+	sysarg_t args[IPC_CALL_LEN];
+	sysarg_t in_phone_hash;
 } ipc_call_t;
 
@@ -183,10 +181,10 @@
 	    (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
 
-extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *);
-
-extern int ipc_call_sync_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *,
-    ipcarg_t *);
+extern int ipc_call_sync_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
+
+extern int ipc_call_sync_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
+    sysarg_t *);
 
 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int);
@@ -220,8 +218,8 @@
 	ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
 
-extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t);
-extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t, ipcarg_t);
+extern sysarg_t ipc_answer_fast(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t);
+extern sysarg_t ipc_answer_slow(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t);
 
 /*
@@ -255,10 +253,10 @@
 	    (arg4), (arg5), (private), (callback), (can_preempt))
 
-extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, void *, ipc_async_callback_t, int);
-extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int);
-
-extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
+extern void ipc_call_async_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, void *, ipc_async_callback_t, int);
+extern void ipc_call_async_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, void *, ipc_async_callback_t, int);
+
+extern int ipc_connect_to_me(int, int, int, int, sysarg_t *);
 extern int ipc_connect_me_to(int, int, int, int);
 extern int ipc_connect_me_to_blocking(int, int, int, int);
@@ -266,7 +264,7 @@
 extern int ipc_register_irq(int, int, int, irq_code_t *);
 extern int ipc_unregister_irq(int, int);
-extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int);
-extern int ipc_forward_slow(ipc_callid_t, int, int, ipcarg_t, ipcarg_t,
-    ipcarg_t, ipcarg_t, ipcarg_t, int);
+extern int ipc_forward_fast(ipc_callid_t, int, int, sysarg_t, sysarg_t, int);
+extern int ipc_forward_slow(ipc_callid_t, int, int, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t, int);
 
 /*
@@ -282,5 +280,5 @@
 	ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
 
-extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *);
+extern int ipc_share_in_start(int, void *, size_t, sysarg_t, int *);
 extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
 extern int ipc_share_out_start(int, void *, int);
Index: uspace/lib/c/include/ipc/net.h
===================================================================
--- uspace/lib/c/include/ipc/net.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/net.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -192,5 +192,5 @@
  */
 #define IS_NET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_FIRST, NET_LAST)
 
 /** Returns a value indicating whether the IPC call is an ARP message.
@@ -198,5 +198,5 @@
  */
 #define IS_NET_ARP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
 
 /** Returns a value indicating whether the IPC call is an Ethernet message.
@@ -204,5 +204,5 @@
  */
 #define IS_NET_ETH_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
 
 /** Returns a value indicating whether the IPC call is an ICMP message.
@@ -210,5 +210,5 @@
  */
 #define IS_NET_ICMP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
 
 /** Returns a value indicating whether the IPC call is an inter-network layer
@@ -217,5 +217,5 @@
  */
 #define IS_NET_IL_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IL_FIRST, NET_IL_LAST)
 
 /** Returns a value indicating whether the IPC call is an IP message.
@@ -223,5 +223,5 @@
  */
 #define IS_NET_IP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IP_FIRST, NET_IP_LAST)
 
 /** Returns a value indicating whether the IPC call is a generic networking
@@ -230,5 +230,5 @@
  */
 #define IS_NET_NET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NET_FIRST, NET_NET_LAST)
 
 /** Returns a value indicating whether the IPC call is a network interface layer
@@ -237,5 +237,5 @@
  */
 #define IS_NET_NIL_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
 
 /** Returns a value indicating whether the IPC call is a packet manaagement
@@ -244,5 +244,5 @@
  */
 #define IS_NET_PACKET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
 
 /** Returns a value indicating whether the IPC call is a socket message.
@@ -250,5 +250,5 @@
  */
 #define IS_NET_SOCKET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
 
 /** Returns a value indicating whether the IPC call is a TCP message.
@@ -256,5 +256,5 @@
  */
 #define IS_NET_TCP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
 
 /** Returns a value indicating whether the IPC call is a transport layer message.
@@ -262,5 +262,5 @@
  */
 #define IS_NET_TL_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TL_FIRST, NET_TL_LAST)
 
 /** Returns a value indicating whether the IPC call is a UDP message.
@@ -268,5 +268,5 @@
  */
 #define IS_NET_UDP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
+	IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
 
 /*@}*/
@@ -370,5 +370,5 @@
 #define IPC_SET_DEVICE(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG1(*answer, argument); \
 	} while (0)
@@ -379,5 +379,5 @@
 #define IPC_SET_ADDR(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG1(*answer, argument); \
 	} while (0)
@@ -388,5 +388,5 @@
 #define IPC_SET_PREFIX(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG2(*answer, argument); \
 	} while (0)
@@ -397,5 +397,5 @@
 #define IPC_SET_CONTENT(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG3(*answer, argument); \
 	} while (0)
@@ -406,5 +406,5 @@
 #define IPC_SET_SUFFIX(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG4(*answer, argument); \
 	} while (0)
Index: uspace/lib/c/include/ipc/socket.h
===================================================================
--- uspace/lib/c/include/ipc/socket.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/socket.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -84,5 +84,5 @@
 #define SOCKET_SET_SOCKET_ID(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG1(answer, argument); \
 	} while (0)
@@ -102,5 +102,5 @@
 #define SOCKET_SET_READ_DATA_LENGTH(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG1(answer, argument); \
 	} while (0)
@@ -147,5 +147,5 @@
 #define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG2(answer, argument); \
 	} while (0)
@@ -156,5 +156,5 @@
 #define SOCKET_SET_ADDRESS_LENGTH(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG3(answer, argument);\
 	} while (0)
@@ -174,5 +174,5 @@
 #define SOCKET_SET_HEADER_SIZE(answer, value) \
 	do { \
-		ipcarg_t argument = (ipcarg_t) (value); \
+		sysarg_t argument = (sysarg_t) (value); \
 		IPC_SET_ARG3(answer, argument); \
 	} while (0)
Index: uspace/lib/c/include/ipc/vfs.h
===================================================================
--- uspace/lib/c/include/ipc/vfs.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/ipc/vfs.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,6 +36,7 @@
 #define LIBC_IPC_VFS_H_
 
+#include <ipc/ipc.h>
 #include <sys/types.h>
-#include <ipc/ipc.h>
+#include <bool.h>
 
 #define FS_NAME_MAXLEN  20
@@ -55,4 +56,6 @@
 	/** Unique identifier of the fs. */
 	char name[FS_NAME_MAXLEN + 1];
+	bool concurrent_read_write;
+	bool write_retains_size;
 } vfs_info_t;
 
Index: uspace/lib/c/include/libc.h
===================================================================
--- uspace/lib/c/include/libc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/libc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,4 +40,11 @@
 #include <libarch/syscall.h>
 
+#ifdef __32_BITS__
+
+/** Explicit 64-bit arguments passed to syscalls. */
+typedef uint64_t sysarg64_t;
+
+#endif /* __32_BITS__ */
+
 #define __SYSCALL0(id) \
 	__syscall0(0, 0, 0, 0, 0, 0, id)
@@ -53,5 +60,5 @@
 	__syscall5(p1, p2, p3, p4, p5, 0, id)
 #define __SYSCALL6(id, p1, p2, p3, p4, p5, p6) \
-    __syscall6(p1, p2, p3, p4, p5, p6, id)
+	__syscall6(p1, p2, p3, p4, p5, p6, id)
 
 extern void __main(void *pcb_ptr);
Index: uspace/lib/c/include/malloc.h
===================================================================
--- uspace/lib/c/include/malloc.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/malloc.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,7 +41,10 @@
 extern uintptr_t get_max_heap_addr(void);
 
-extern void *malloc(const size_t size);
-extern void *calloc(const size_t nmemb, const size_t size);
-extern void *memalign(const size_t align, const size_t size);
+extern void *malloc(const size_t size)
+    __attribute__((malloc));
+extern void *calloc(const size_t nmemb, const size_t size)
+    __attribute__((malloc));
+extern void *memalign(const size_t align, const size_t size)
+    __attribute__((malloc));
 extern void *realloc(const void *addr, const size_t size);
 extern void free(const void *addr);
Index: uspace/lib/c/include/net/modules.h
===================================================================
--- uspace/lib/c/include/net/modules.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/net/modules.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -49,21 +49,4 @@
 #include <sys/time.h>
 
-/** Converts the data length between different types.
- *
- * @param[in] type_from	The source type.
- * @param[in] type_to	The destination type.
- * @param[in] count	The number units of the source type size.
- */
-#define CONVERT_SIZE(type_from, type_to, count) \
-	((sizeof(type_from) / sizeof(type_to)) * (count))
-
-/** Registers the module service at the name server.
- *
- * @param[in] me	The module service.
- * @param[out] phonehash The created phone hash.
- */
-#define REGISTER_ME(me, phonehash) \
-	ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash))
-
 /** Connect to the needed module function type definition.
  *
@@ -74,11 +57,10 @@
 
 extern void answer_call(ipc_callid_t, int, ipc_call_t *, int);
-extern int bind_service(services_t, ipcarg_t, ipcarg_t, ipcarg_t,
+extern int bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
     async_client_conn_t);
-extern int bind_service_timeout(services_t, ipcarg_t, ipcarg_t, ipcarg_t,
+extern int bind_service_timeout(services_t, sysarg_t, sysarg_t, sysarg_t,
     async_client_conn_t, suseconds_t);
 extern int connect_to_service(services_t);
 extern int connect_to_service_timeout(services_t, suseconds_t);
-extern int data_receive(void **, size_t *);
 extern int data_reply(void *, size_t);
 extern void refresh_answer(ipc_call_t *, int *);
Index: uspace/lib/c/include/net/packet.h
===================================================================
--- uspace/lib/c/include/net/packet.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/net/packet.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,5 +46,5 @@
  * @see packet
  */
-typedef struct packet * packet_t;
+typedef struct packet packet_t;
 
 /** Type definition of the packet dimension.
@@ -69,18 +69,18 @@
 /*@{*/
 
-extern packet_t pm_find(packet_id_t);
-extern int pm_add(packet_t);
+extern packet_t *pm_find(packet_id_t);
+extern int pm_add(packet_t *);
 extern int pm_init(void);
 extern void pm_destroy(void);
 
-extern int pq_add(packet_t *, packet_t, size_t, size_t);
-extern packet_t pq_find(packet_t, size_t);
-extern int pq_insert_after(packet_t, packet_t);
-extern packet_t pq_detach(packet_t);
-extern int pq_set_order(packet_t, size_t, size_t);
-extern int pq_get_order(packet_t, size_t *, size_t *);
-extern void pq_destroy(packet_t, void (*)(packet_t));
-extern packet_t pq_next(packet_t);
-extern packet_t pq_previous(packet_t);
+extern int pq_add(packet_t **, packet_t *, size_t, size_t);
+extern packet_t *pq_find(packet_t *, size_t);
+extern int pq_insert_after(packet_t *, packet_t *);
+extern packet_t *pq_detach(packet_t *);
+extern int pq_set_order(packet_t *, size_t, size_t);
+extern int pq_get_order(packet_t *, size_t *, size_t *);
+extern void pq_destroy(packet_t *, void (*)(packet_t *));
+extern packet_t *pq_next(packet_t *);
+extern packet_t *pq_previous(packet_t *);
 
 /*@}*/
Index: uspace/lib/c/include/net/packet_header.h
===================================================================
--- uspace/lib/c/include/net/packet_header.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/net/packet_header.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -128,5 +128,5 @@
  * @return		False otherwise.
  */
-static inline int packet_is_valid(const packet_t packet)
+static inline int packet_is_valid(const packet_t *packet)
 {
 	return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
Index: uspace/lib/c/include/stdint.h
===================================================================
--- uspace/lib/c/include/stdint.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/stdint.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,27 +36,27 @@
 #define LIBC_STDINT_H_
 
-#define INT8_MIN  (0x80)
-#define INT8_MAX  (0x7F)
+#define INT8_MIN  INT8_C(0x80)
+#define INT8_MAX  INT8_C(0x7F)
 
-#define UINT8_MIN  (0u)
-#define UINT8_MAX  (0xFFu)
+#define UINT8_MIN  UINT8_C(0)
+#define UINT8_MAX  UINT8_C(0xFF)
 
-#define INT16_MIN  (0x8000)
-#define INT16_MAX  (0x7FFF)
+#define INT16_MIN  INT16_C(0x8000)
+#define INT16_MAX  INT16_C(0x7FFF)
 
-#define UINT16_MIN  (0u)
-#define UINT16_MAX  (0xFFFFu)
+#define UINT16_MIN  UINT16_C(0)
+#define UINT16_MAX  UINT16_C(0xFFFF)
 
-#define INT32_MIN  (0x80000000l)
-#define INT32_MAX  (0x7FFFFFFFl)
+#define INT32_MIN  INT32_C(0x80000000)
+#define INT32_MAX  INT32_C(0x7FFFFFFF)
 
-#define UINT32_MIN  (0ul)
-#define UINT32_MAX  (0xFFFFFFFFul)
+#define UINT32_MIN  UINT32_C(0)
+#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
 
-#define INT64_MIN  (0x8000000000000000ll)
-#define INT64_MAX  (0x7FFFFFFFFFFFFFFFll)
+#define INT64_MIN  INT64_C(0x8000000000000000)
+#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
 
-#define UINT64_MIN  (0ull)
-#define UINT64_MAX  (0xFFFFFFFFFFFFFFFFull)
+#define UINT64_MIN  UINT64_C(0)
+#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
 
 #include <libarch/types.h>
Index: uspace/lib/c/include/stdio.h
===================================================================
--- uspace/lib/c/include/stdio.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/stdio.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,4 +41,15 @@
 #include <adt/list.h>
 
+#ifndef NVERIFY_PRINTF
+
+#define PRINTF_ATTRIBUTE(start, end) \
+	__attribute__((format(gnu_printf, start, end)))
+
+#else /* NVERIFY_PRINTF */
+
+#define PRINTF_ATTRIBUTE(start, end)
+
+#endif /* NVERIFY_PRINTF */
+
 #define EOF  (-1)
 
@@ -149,12 +160,16 @@
 
 /* Formatted string output functions */
-extern int fprintf(FILE *, const char*, ...);
+extern int fprintf(FILE *, const char*, ...)
+    PRINTF_ATTRIBUTE(2, 3);
 extern int vfprintf(FILE *, const char *, va_list);
 
-extern int printf(const char *, ...);
+extern int printf(const char *, ...)
+    PRINTF_ATTRIBUTE(1, 2);
 extern int vprintf(const char *, va_list);
 
-extern int snprintf(char *, size_t , const char *, ...);
-extern int asprintf(char **, const char *, ...);
+extern int snprintf(char *, size_t , const char *, ...)
+    PRINTF_ATTRIBUTE(3, 4);
+extern int asprintf(char **, const char *, ...)
+    PRINTF_ATTRIBUTE(2, 3);
 extern int vsnprintf(char *, size_t, const char *, va_list);
 
Index: uspace/lib/c/include/str.h
===================================================================
--- uspace/lib/c/include/str.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/str.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -86,4 +86,7 @@
 extern char *str_ndup(const char *, size_t max_size);
 
+extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *);
+extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
+
 extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix);
 
Index: uspace/lib/c/include/sys/typefmt.h
===================================================================
--- uspace/lib/c/include/sys/typefmt.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/sys/typefmt.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 #include <inttypes.h>
 
-/* off64_t */
+/* off64_t, aoff64_t */
 #define PRIdOFF64 PRId64
 #define PRIuOFF64 PRIu64
@@ -45,28 +45,4 @@
 #define PRIXOFF64 PRIX64
 
-/* (s)size_t */
-#define PRIdSIZE PRIdPTR
-#define PRIuSIZE PRIuPTR
-#define PRIxSIZE PRIxPTR
-#define PRIXSIZE PRIXPTR
-
-/* sysarg_t */
-#define PRIdSYSARG PRIdPTR
-#define PRIuSYSARG PRIuPTR
-#define PRIxSYSARG PRIxPTR
-#define PRIXSYSARG PRIxPTR
-
-/* ipcarg_t */
-#define PRIdIPCARG PRIdPTR
-#define PRIuIPCARG PRIuPTR
-#define PRIxIPCARG PRIxPTR
-#define PRIXIPCARG PRIXPTR
-
-/* taskid_t */
-#define PRIdTASKID PRId64
-#define PRIuTASKID PRIu64
-#define PRIxTASKID PRIx64
-#define PRIXTASKID PRIx64
-
 #endif
 
Index: uspace/lib/c/include/sys/types.h
===================================================================
--- uspace/lib/c/include/sys/types.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/sys/types.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,7 +46,4 @@
 typedef uint64_t aoff64_t;
 
-/** Unicode code point */
-typedef int32_t wchar_t;
-
 typedef volatile uint8_t ioport8_t;
 typedef volatile uint16_t ioport16_t;
Index: uspace/lib/c/include/unistd.h
===================================================================
--- uspace/lib/c/include/unistd.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/c/include/unistd.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,5 +41,5 @@
 
 #ifndef NULL
-	#define NULL  0UL
+	#define NULL	((void *) 0)
 #endif
 
Index: uspace/lib/clui/tinput.c
===================================================================
--- uspace/lib/clui/tinput.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/clui/tinput.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -140,6 +140,6 @@
 static void tinput_update_origin(tinput_t *ti)
 {
-	ipcarg_t width = ti->col0 + ti->nc;
-	ipcarg_t rows = (width / ti->con_cols) + 1;
+	sysarg_t width = ti->col0 + ti->nc;
+	sysarg_t rows = (width / ti->con_cols) + 1;
 	
 	/* Update row0 if the screen scrolled. */
@@ -153,8 +153,8 @@
 		return;
 	
-	ipcarg_t new_width = ti->col0 + ti->nc + 1;
+	sysarg_t new_width = ti->col0 + ti->nc + 1;
 	if (new_width % ti->con_cols == 0) {
 		/* Advancing to new line. */
-		ipcarg_t new_height = (new_width / ti->con_cols) + 1;
+		sysarg_t new_height = (new_width / ti->con_cols) + 1;
 		if (new_height >= ti->con_rows) {
 			/* Disallow text longer than 1 page for now. */
@@ -184,6 +184,6 @@
 		return;
 	
-	ipcarg_t new_width = ti->col0 + ti->nc + ilen;
-	ipcarg_t new_height = (new_width / ti->con_cols) + 1;
+	sysarg_t new_width = ti->col0 + ti->nc + ilen;
+	sysarg_t new_height = (new_width / ti->con_cols) + 1;
 	if (new_height >= ti->con_rows) {
 		/* Disallow text longer than 1 page for now. */
Index: uspace/lib/clui/tinput.h
===================================================================
--- uspace/lib/clui/tinput.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/clui/tinput.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,10 +51,10 @@
 	
 	/** Screen coordinates of the top-left corner of the text field */
-	ipcarg_t col0;
-	ipcarg_t row0;
+	sysarg_t col0;
+	sysarg_t row0;
 	
 	/** Screen dimensions */
-	ipcarg_t con_cols;
-	ipcarg_t con_rows;
+	sysarg_t con_cols;
+	sysarg_t con_rows;
 	
 	/** Number of characters in @c buffer */
Index: uspace/lib/drv/generic/dev_iface.c
===================================================================
--- uspace/lib/drv/generic/dev_iface.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/drv/generic/dev_iface.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -54,5 +54,5 @@
 
 remote_iface_func_ptr_t
-get_remote_method(remote_iface_t *rem_iface, ipcarg_t iface_method_idx)
+get_remote_method(remote_iface_t *rem_iface, sysarg_t iface_method_idx)
 {
 	if (iface_method_idx >= rem_iface->method_count) {
Index: uspace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/drv/generic/driver.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,4 +48,5 @@
 #include <ctype.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include <ipc/driver.h>
@@ -80,5 +81,5 @@
 static void driver_irq_handler(ipc_callid_t iid, ipc_call_t *icall)
 {
-	int id = (int)IPC_GET_METHOD(*icall);
+	int id = (int)IPC_GET_IMETHOD(*icall);
 	interrupt_context_t *ctx;
 	
@@ -164,4 +165,6 @@
 	
 	devman_handle_t dev_handle =  IPC_GET_ARG1(*icall);
+    	devman_handle_t parent_dev_handle = IPC_GET_ARG2(*icall);
+    
 	device_t *dev = create_device();
 	dev->handle = dev_handle;
@@ -171,10 +174,12 @@
 	
 	add_to_devices_list(dev);
+	dev->parent = driver_get_device(&devices, parent_dev_handle);
+	
 	res = driver->driver_ops->add_device(dev);
 	if (0 == res) {
-		printf("%s: new device with handle = %x was added.\n",
+		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 = %d.\n",
+		printf("%s: failed to add a new device with handle = %" PRIun ".\n",
 		    driver->name, dev_handle);
 		remove_from_devices_list(dev);
@@ -195,5 +200,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cont = false;
@@ -203,6 +208,5 @@
 			break;
 		default:
-			if (!(callid & IPC_CALLID_NOTIFICATION))
-				ipc_answer_0(callid, ENOENT);
+			ipc_answer_0(callid, ENOENT);
 		}
 	}
@@ -226,5 +230,5 @@
 	if (dev == NULL) {
 		printf("%s: driver_connection_gen error - no device with handle"
-		    " %x was found.\n", driver->name, handle);
+		    " %" PRIun " was found.\n", driver->name, handle);
 		ipc_answer_0(iid, ENOENT);
 		return;
@@ -250,5 +254,5 @@
 		ipc_call_t call;
 		callid = async_get_call(&call);
-		ipcarg_t method = IPC_GET_METHOD(call);
+		sysarg_t method = IPC_GET_IMETHOD(call);
 		int iface_idx;
 		
@@ -290,5 +294,5 @@
 				printf("%s: driver_connection_gen error - ",
 				    driver->name);
-				printf("device with handle %d has no interface "
+				printf("device with handle %" PRIun " has no interface "
 				    "with id %d.\n", handle, iface_idx);
 				ipc_answer_0(callid, ENOTSUP);
@@ -304,5 +308,5 @@
 
 			/* get the method of the remote interface */
-			ipcarg_t iface_method_idx = IPC_GET_ARG1(call);
+			sysarg_t iface_method_idx = IPC_GET_ARG1(call);
 			remote_iface_func_ptr_t iface_method_ptr =
 			    get_remote_method(rem_iface, iface_method_idx);
@@ -342,5 +346,5 @@
 {
 	/* Select interface */
-	switch ((ipcarg_t) (IPC_GET_ARG1(*icall))) {
+	switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
 	case DRIVER_DEVMAN:
 		/* handle PnP events from device manager */
@@ -377,4 +381,57 @@
 }
 
+/** Wrapper for child_device_register for devices with single match id.
+ *
+ * @param parent Parent device.
+ * @param child_name Child device name.
+ * @param child_match_id Child device match id.
+ * @param child_match_score Child device match score.
+ * @return Error code.
+ */
+int child_device_register_wrapper(device_t *parent, const char *child_name,
+    const char *child_match_id, int child_match_score)
+{
+	device_t *child = NULL;
+	match_id_t *match_id = NULL;
+	int rc;
+
+	child = create_device();
+	if (child == NULL) {
+		rc = ENOMEM;
+		goto failure;
+	}
+
+	child->name = child_name;
+
+	match_id = create_match_id();
+	if (match_id == NULL) {
+		rc = ENOMEM;
+		goto failure;
+	}
+
+	match_id->id = child_match_id;
+	match_id->score = child_match_score;
+	add_match_id(&child->match_ids, match_id);
+
+	rc = child_device_register(child, parent);
+	if (EOK != rc)
+		goto failure;
+
+	return EOK;
+
+failure:
+	if (match_id != NULL) {
+		match_id->id = NULL;
+		delete_match_id(match_id);
+	}
+
+	if (child != NULL) {
+		child->name = NULL;
+		delete_device(child);
+	}
+
+	return rc;
+}
+
 int driver_main(driver_t *drv)
 {
Index: uspace/lib/drv/include/driver.h
===================================================================
--- uspace/lib/drv/include/driver.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/drv/include/driver.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -79,5 +79,5 @@
 
 remote_iface_t *get_remote_iface(int);
-remote_iface_func_ptr_t get_remote_method(remote_iface_t *, ipcarg_t);
+remote_iface_func_ptr_t get_remote_method(remote_iface_t *, sysarg_t);
 
 
@@ -199,4 +199,5 @@
 
 int child_device_register(device_t *, device_t *);
+int child_device_register_wrapper(device_t *, const char *, const char *, int);
 
 
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/fs/libfs.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -155,5 +155,5 @@
 	devmap_handle_t mr_devmap_handle = (devmap_handle_t) IPC_GET_ARG4(*request);
 	int res;
-	ipcarg_t rc;
+	sysarg_t rc;
 	
 	ipc_call_t call;
@@ -163,5 +163,5 @@
 	callid = async_get_call(&call);
 	int mountee_phone = (int) IPC_GET_ARG1(call);
-	if ((IPC_GET_METHOD(call) != IPC_M_CONNECTION_CLONE) ||
+	if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECTION_CLONE) ||
 	    (mountee_phone < 0)) {
 		ipc_answer_0(callid, EINVAL);
Index: uspace/lib/fs/libfs.h
===================================================================
--- uspace/lib/fs/libfs.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/fs/libfs.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -86,5 +86,5 @@
 typedef struct {
 	int fs_handle;           /**< File system handle. */
-	ipcarg_t vfs_phonehash;  /**< Initial VFS phonehash. */
+	sysarg_t vfs_phonehash;  /**< Initial VFS phonehash. */
 	uint8_t *plb_ro;         /**< Read-only PLB view. */
 } fs_reg_t;
Index: uspace/lib/net/generic/generic.c
===================================================================
--- uspace/lib/net/generic/generic.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/generic/generic.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -59,6 +59,6 @@
     int state, services_t target)
 {
-	async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-	    (ipcarg_t) state, target);
+	async_msg_3(phone, (sysarg_t) message, (sysarg_t) device_id,
+	    (sysarg_t) state, target);
 	
 	return EOK;
@@ -81,6 +81,6 @@
     int arg2, services_t service)
 {
-	return (int) async_req_3_0(phone, (ipcarg_t) message,
-	    (ipcarg_t) device_id, (ipcarg_t) arg2, (ipcarg_t) service);
+	return (int) async_req_3_0(phone, (sysarg_t) message,
+	    (sysarg_t) device_id, (sysarg_t) arg2, (sysarg_t) service);
 }
 
@@ -103,5 +103,5 @@
 {
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 	int string;
 
@@ -110,6 +110,6 @@
 
 	// request the address
-	message_id = async_send_1(phone, (ipcarg_t) message,
-	    (ipcarg_t) device_id, NULL);
+	message_id = async_send_1(phone, (sysarg_t) message,
+	    (sysarg_t) device_id, NULL);
 	string = measured_strings_return(phone, address, data, 1);
 	async_wait_for(message_id, &result);
@@ -143,11 +143,11 @@
 		return EBADMEM;
 	
-	ipcarg_t addr_len;
-	ipcarg_t prefix;
-	ipcarg_t content;
-	ipcarg_t suffix;
-	
-	ipcarg_t result = async_req_1_4(phone, (ipcarg_t) message,
-	    (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix);
+	sysarg_t addr_len;
+	sysarg_t prefix;
+	sysarg_t content;
+	sysarg_t suffix;
+	
+	sysarg_t result = async_req_1_4(phone, (sysarg_t) message,
+	    (sysarg_t) device_id, &addr_len, &prefix, &content, &suffix);
 	
 	packet_dimension->prefix = (size_t) prefix;
@@ -175,9 +175,9 @@
 {
 	if (error) {
-		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error);
+		async_msg_4(phone, (sysarg_t) message, (sysarg_t) device_id,
+		    (sysarg_t) packet_id, (sysarg_t) target, (sysarg_t) error);
 	} else {
-		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) target);
+		async_msg_3(phone, (sysarg_t) message, (sysarg_t) device_id,
+		    (sysarg_t) packet_id, (sysarg_t) target);
 	}
 	
@@ -201,9 +201,9 @@
 {
 	if (error) {
-		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error);
+		async_msg_4(phone, (sysarg_t) message, (sysarg_t) device_id,
+		    (sysarg_t) packet_id, (sysarg_t) sender, (sysarg_t) error);
 	} else {
-		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) sender);
+		async_msg_3(phone, (sysarg_t) message, (sysarg_t) device_id,
+		    (sysarg_t) packet_id, (sysarg_t) sender);
 	}
 	
@@ -237,5 +237,5 @@
 {
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 	int string;
 
@@ -246,6 +246,6 @@
 
 	// request the translation
-	message_id = async_send_3(phone, (ipcarg_t) message,
-	    (ipcarg_t) device_id, (ipcarg_t) count, (ipcarg_t) service, NULL);
+	message_id = async_send_3(phone, (sysarg_t) message,
+	    (sysarg_t) device_id, (sysarg_t) count, (sysarg_t) service, NULL);
 	measured_strings_send(phone, configuration, count);
 	string = measured_strings_return(phone, translation, data, count);
Index: uspace/lib/net/generic/packet_client.c
===================================================================
--- uspace/lib/net/generic/packet_client.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/generic/packet_client.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,5 +57,5 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-int packet_copy_data(packet_t packet, const void *data, size_t length)
+int packet_copy_data(packet_t *packet, const void *data, size_t length)
 {
 	if (!packet_is_valid(packet))
@@ -81,8 +81,8 @@
  * @return		NULL if there is not enough memory left.
  */
-void *packet_prefix(packet_t packet, size_t length)
+void *packet_prefix(packet_t *packet, size_t length)
 {
 	if ((!packet_is_valid(packet)) ||
-	    (packet->data_start - sizeof(struct packet) -
+	    (packet->data_start - sizeof(packet_t) -
 	    2 * (packet->dest_addr - packet->src_addr) < length)) {
 		return NULL;
@@ -102,5 +102,5 @@
  * @return		NULL if there is not enough memory left.
  */
-void *packet_suffix(packet_t packet, size_t length)
+void *packet_suffix(packet_t *packet, size_t length)
 {
 	if ((!packet_is_valid(packet)) ||
@@ -124,5 +124,5 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-int packet_trim(packet_t packet, size_t prefix, size_t suffix)
+int packet_trim(packet_t *packet, size_t prefix, size_t suffix)
 {
 	if (!packet_is_valid(packet))
@@ -143,5 +143,5 @@
  * @return		Zero if the packet is not valid.
  */
-packet_id_t packet_get_id(const packet_t packet)
+packet_id_t packet_get_id(const packet_t *packet)
 {
 	return packet_is_valid(packet) ? packet->packet_id : 0;
@@ -157,5 +157,5 @@
  * @return		EINVAL if the packet is not valid.
  */
-int packet_get_addr(const packet_t packet, uint8_t **src, uint8_t **dest)
+int packet_get_addr(const packet_t *packet, uint8_t **src, uint8_t **dest)
 {
 	if (!packet_is_valid(packet))
@@ -177,5 +177,5 @@
  * @return		Zero if the packet is not valid.
  */
-size_t packet_get_data_length(const packet_t packet)
+size_t packet_get_data_length(const packet_t *packet)
 {
 	if (!packet_is_valid(packet))
@@ -191,5 +191,5 @@
  * @return		NULL if the packet is not valid.
  */
-void *packet_get_data(const packet_t packet)
+void *packet_get_data(const packet_t *packet)
 {
 	if (!packet_is_valid(packet))
@@ -210,5 +210,5 @@
  */
 int
-packet_set_addr(packet_t packet, const uint8_t *src, const uint8_t *dest,
+packet_set_addr(packet_t *packet, const uint8_t *src, const uint8_t *dest,
     size_t addr_len)
 {
@@ -257,7 +257,7 @@
  * @return		NULL on error.
  */
-packet_t packet_get_copy(int phone, packet_t packet)
-{
-	packet_t copy;
+packet_t *packet_get_copy(int phone, packet_t *packet)
+{
+	packet_t *copy;
 	uint8_t * src = NULL;
 	uint8_t * dest = NULL;
Index: uspace/lib/net/generic/packet_remote.c
===================================================================
--- uspace/lib/net/generic/packet_remote.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/generic/packet_remote.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -64,5 +64,5 @@
  */
 static int
-packet_return(int phone, packet_t *packet, packet_id_t packet_id, size_t size)
+packet_return(int phone, packet_t **packet, packet_id_t packet_id, size_t size)
 {
 	ipc_call_t answer;
@@ -72,5 +72,5 @@
 	message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
 
-	*packet = (packet_t) as_get_mappable_page(size);
+	*packet = (packet_t *) as_get_mappable_page(size);
 	rc = async_share_in_start_0_0(phone, *packet, size);
 	if (rc != EOK) {
@@ -86,5 +86,5 @@
 	}
 	
-	ipcarg_t result;
+	sysarg_t result;
 	async_wait_for(message, &result);
 	
@@ -107,5 +107,5 @@
  *			function.
  */
-int packet_translate_remote(int phone, packet_t *packet, packet_id_t packet_id)
+int packet_translate_remote(int phone, packet_t **packet, packet_id_t packet_id)
 {
 	int rc;
@@ -116,5 +116,5 @@
 	*packet = pm_find(packet_id);
 	if (!*packet) {
-		ipcarg_t size;
+		sysarg_t size;
 		
 		rc = async_req_1_1(phone, NET_PACKET_GET_SIZE, packet_id,
@@ -127,5 +127,5 @@
 	}
 	if ((*packet)->next) {
-		packet_t next;
+		packet_t *next;
 		
 		return packet_translate_remote(phone, &next, (*packet)->next);
@@ -148,9 +148,9 @@
  * @return		NULL on error.
  */
-packet_t packet_get_4_remote(int phone, size_t max_content, size_t addr_len,
+packet_t *packet_get_4_remote(int phone, size_t max_content, size_t addr_len,
     size_t max_prefix, size_t max_suffix)
 {
-	ipcarg_t packet_id;
-	ipcarg_t size;
+	sysarg_t packet_id;
+	sysarg_t size;
 	int rc;
 	
@@ -161,5 +161,5 @@
 	
 	
-	packet_t packet = pm_find(packet_id);
+	packet_t *packet = pm_find(packet_id);
 	if (!packet) {
 		rc = packet_return(phone, &packet, packet_id, size);
@@ -180,8 +180,8 @@
  * @return		NULL on error.
  */
-packet_t packet_get_1_remote(int phone, size_t content)
-{
-	ipcarg_t packet_id;
-	ipcarg_t size;
+packet_t *packet_get_1_remote(int phone, size_t content)
+{
+	sysarg_t packet_id;
+	sysarg_t size;
 	int rc;
 	
@@ -191,5 +191,5 @@
 		return NULL;
 	
-	packet_t packet = pm_find(packet_id);
+	packet_t *packet = pm_find(packet_id);
 	if (!packet) {
 		rc = packet_return(phone, &packet, packet_id, size);
Index: uspace/lib/net/il/arp_remote.c
===================================================================
--- uspace/lib/net/il/arp_remote.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/il/arp_remote.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -86,8 +86,8 @@
 {
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 
 	message_id = async_send_2(arp_phone, NET_ARP_CLEAR_ADDRESS,
-	    (ipcarg_t) device_id, protocol, NULL);
+	    (sysarg_t) device_id, protocol, NULL);
 	measured_strings_send(arp_phone, address, 1);
 	async_wait_for(message_id, &result);
@@ -106,5 +106,5 @@
 {
 	return (int) async_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE,
-	    (ipcarg_t) device_id);
+	    (sysarg_t) device_id);
 }
 
@@ -136,8 +136,8 @@
 {
 	aid_t message_id;
-	ipcarg_t result;
+	sysarg_t result;
 
 	message_id = async_send_3(arp_phone, NET_ARP_DEVICE,
-	    (ipcarg_t) device_id, protocol, netif, NULL);
+	    (sysarg_t) device_id, protocol, netif, NULL);
 	measured_strings_send(arp_phone, address, 1);
 	async_wait_for(message_id, &result);
Index: uspace/lib/net/il/il_interface.c
===================================================================
--- uspace/lib/net/il/il_interface.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/il/il_interface.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -77,5 +77,5 @@
  *
  */
-int il_received_msg(int il_phone, device_id_t device_id, packet_t packet,
+int il_received_msg(int il_phone, device_id_t device_id, packet_t *packet,
     services_t target)
 {
Index: uspace/lib/net/il/ip_client.c
===================================================================
--- uspace/lib/net/il/ip_client.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/il/ip_client.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,5 +51,5 @@
  * @return		Zero if there is no IP header.
  */
-size_t ip_client_header_length(packet_t packet)
+size_t ip_client_header_length(packet_t *packet)
 {
 	ip_header_t *header;
@@ -152,5 +152,5 @@
  */
 int
-ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl,
+ip_client_prepare_packet(packet_t *packet, ip_protocol_t protocol, ip_ttl_t ttl,
     ip_tos_t tos, int dont_fragment, size_t ipopt_length)
 {
@@ -208,5 +208,5 @@
  */
 int
-ip_client_process_packet(packet_t packet, ip_protocol_t *protocol,
+ip_client_process_packet(packet_t *packet, ip_protocol_t *protocol,
     ip_ttl_t *ttl, ip_tos_t *tos, int *dont_fragment, size_t *ipopt_length)
 {
Index: uspace/lib/net/il/ip_remote.c
===================================================================
--- uspace/lib/net/il/ip_remote.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/il/ip_remote.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -67,6 +67,6 @@
 {
 	return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE,
-	    (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr,
-	    (ipcarg_t) address.s_addr, (ipcarg_t) netmask.s_addr);
+	    (sysarg_t) device_id, (sysarg_t) gateway.s_addr,
+	    (sysarg_t) address.s_addr, (sysarg_t) netmask.s_addr);
 }
 
@@ -86,5 +86,5 @@
     async_client_conn_t receiver)
 {
-	return (int) bind_service(service, (ipcarg_t) protocol, me, service,
+	return (int) bind_service(service, (sysarg_t) protocol, me, service,
 	    receiver);
 }
@@ -151,5 +151,5 @@
 	ipc_call_t answer;
 	aid_t message_id = async_send_1(ip_phone, NET_IP_GET_ROUTE,
-	    (ipcarg_t) protocol, &answer);
+	    (sysarg_t) protocol, &answer);
 	
 	if ((async_data_write_start(ip_phone, destination, addrlen) == EOK) &&
@@ -164,5 +164,5 @@
 	}
 	
-	ipcarg_t result;
+	sysarg_t result;
 	async_wait_for(message_id, &result);
 	
@@ -204,5 +204,5 @@
  */
 int ip_received_error_msg_remote(int ip_phone, device_id_t device_id,
-    packet_t packet, services_t target, services_t error)
+    packet_t *packet, services_t target, services_t error)
 {
 	return generic_received_msg_remote(ip_phone, NET_IP_RECEIVED_ERROR,
@@ -225,5 +225,5 @@
  *			function.
  */
-int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t packet,
+int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t *packet,
     services_t sender, services_t error)
 {
@@ -244,5 +244,5 @@
 {
 	return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY,
-	    (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr);
+	    (sysarg_t) device_id, (sysarg_t) gateway.s_addr);
 }
 
Index: uspace/lib/net/include/icmp_client.h
===================================================================
--- uspace/lib/net/include/icmp_client.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/icmp_client.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -41,7 +41,7 @@
 #include <net/packet.h>
 
-extern int icmp_client_process_packet(packet_t, icmp_type_t *, icmp_code_t *,
+extern int icmp_client_process_packet(packet_t *, icmp_type_t *, icmp_code_t *,
     icmp_param_t *, icmp_param_t *);
-extern size_t icmp_client_header_length(packet_t);
+extern size_t icmp_client_header_length(packet_t *);
 
 #endif
Index: uspace/lib/net/include/icmp_interface.h
===================================================================
--- uspace/lib/net/include/icmp_interface.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/icmp_interface.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,8 +51,8 @@
 
 extern int icmp_destination_unreachable_msg(int, icmp_code_t, icmp_param_t,
-    packet_t);
-extern int icmp_source_quench_msg(int, packet_t);
-extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t);
-extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t);
+    packet_t *);
+extern int icmp_source_quench_msg(int, packet_t *);
+extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t *);
+extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t *);
 
 /*@}*/
Index: uspace/lib/net/include/il_interface.h
===================================================================
--- uspace/lib/net/include/il_interface.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/il_interface.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -51,5 +51,5 @@
 
 extern int il_device_state_msg(int, device_id_t, device_state_t, services_t);
-extern int il_received_msg(int, device_id_t, packet_t, services_t);
+extern int il_received_msg(int, device_id_t, packet_t *, services_t);
 extern int il_mtu_changed_msg(int, device_id_t, size_t, services_t);
 
Index: uspace/lib/net/include/ip_client.h
===================================================================
--- uspace/lib/net/include/ip_client.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/ip_client.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -45,9 +45,9 @@
 #include <ip_interface.h>
 
-extern int ip_client_prepare_packet(packet_t, ip_protocol_t, ip_ttl_t, ip_tos_t,
-    int, size_t);
-extern int ip_client_process_packet(packet_t, ip_protocol_t *, ip_ttl_t *,
+extern int ip_client_prepare_packet(packet_t *, ip_protocol_t, ip_ttl_t,
+    ip_tos_t, int, size_t);
+extern int ip_client_process_packet(packet_t *, ip_protocol_t *, ip_ttl_t *,
     ip_tos_t *, int *, size_t *);
-extern size_t ip_client_header_length(packet_t);
+extern size_t ip_client_header_length(packet_t *);
 extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t);
 extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *,
Index: uspace/lib/net/include/ip_interface.h
===================================================================
--- uspace/lib/net/include/ip_interface.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/ip_interface.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -70,5 +70,5 @@
  * @return		EOK on success.
  */
-typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet,
+typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t *packet,
     services_t receiver, services_t error);
 
Index: uspace/lib/net/include/ip_remote.h
===================================================================
--- uspace/lib/net/include/ip_remote.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/ip_remote.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -45,10 +45,10 @@
 extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t);
 extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_t *);
-extern int ip_received_error_msg_remote(int, device_id_t, packet_t, services_t,
+extern int ip_received_error_msg_remote(int, device_id_t, packet_t *, services_t,
     services_t);
 extern int ip_device_req_remote(int, device_id_t, services_t);
 extern int ip_add_route_req_remote(int, device_id_t, in_addr_t, in_addr_t,
     in_addr_t);
-extern int ip_send_msg_remote(int, device_id_t, packet_t, services_t,
+extern int ip_send_msg_remote(int, device_id_t, packet_t *, services_t,
     services_t);
 extern int ip_get_route_req_remote(int, ip_protocol_t, const struct sockaddr *,
Index: uspace/lib/net/include/netif_local.h
===================================================================
--- uspace/lib/net/include/netif_local.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/netif_local.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -111,5 +111,5 @@
  *			message implementation.
  */
-extern int netif_send_message(device_id_t device_id, packet_t packet,
+extern int netif_send_message(device_id_t device_id, packet_t *packet,
     services_t sender);
 
@@ -198,5 +198,5 @@
     char **);
 extern int netif_probe_req_local(int, device_id_t, int, int);
-extern int netif_send_msg_local(int, device_id_t, packet_t, services_t);
+extern int netif_send_msg_local(int, device_id_t, packet_t *, services_t);
 extern int netif_start_req_local(int, device_id_t);
 extern int netif_stop_req_local(int, device_id_t);
@@ -208,5 +208,5 @@
 extern void null_device_stats(device_stats_t *);
 extern void netif_pq_release(packet_id_t);
-extern packet_t netif_packet_get_1(size_t);
+extern packet_t *netif_packet_get_1(size_t);
 extern int netif_init_module(async_client_conn_t);
 
Index: uspace/lib/net/include/netif_remote.h
===================================================================
--- uspace/lib/net/include/netif_remote.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/netif_remote.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,5 +44,5 @@
     char **);
 extern int netif_probe_req_remote(int, device_id_t, int, int);
-extern int netif_send_msg_remote(int, device_id_t, packet_t, services_t);
+extern int netif_send_msg_remote(int, device_id_t, packet_t *, services_t);
 extern int netif_start_req_remote(int, device_id_t);
 extern int netif_stop_req_remote(int, device_id_t);
Index: uspace/lib/net/include/nil_local.h
===================================================================
--- uspace/lib/net/include/nil_local.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/nil_local.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -77,5 +77,5 @@
  * 			received function.
  */
-extern int nil_received_msg_local(int, device_id_t, packet_t, services_t);
+extern int nil_received_msg_local(int, device_id_t, packet_t *, services_t);
 
 /** Message processing function.
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/nil_remote.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,5 +39,5 @@
 
 extern int nil_device_state_msg_remote(int, device_id_t, int);
-extern int nil_received_msg_remote(int, device_id_t, packet_t, services_t);
+extern int nil_received_msg_remote(int, device_id_t, packet_t *, services_t);
 
 #endif
Index: uspace/lib/net/include/packet_client.h
===================================================================
--- uspace/lib/net/include/packet_client.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/packet_client.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -99,14 +99,14 @@
 	packet_trim((packet), sizeof(prefix), sizeof(suffix))
 
-extern void *packet_prefix(packet_t, size_t);
-extern void *packet_suffix(packet_t, size_t);
-extern int packet_trim(packet_t, size_t, size_t);
-extern int packet_copy_data(packet_t, const void *, size_t);
-extern packet_id_t packet_get_id(const packet_t);
-extern size_t packet_get_data_length(const packet_t);
-extern void *packet_get_data(const packet_t);
-extern int packet_get_addr(const packet_t, uint8_t **, uint8_t **);
-extern int packet_set_addr(packet_t, const uint8_t *, const uint8_t *, size_t);
-extern packet_t packet_get_copy(int phone, packet_t packet);
+extern void *packet_prefix(packet_t *, size_t);
+extern void *packet_suffix(packet_t *, size_t);
+extern int packet_trim(packet_t *, size_t, size_t);
+extern int packet_copy_data(packet_t *, const void *, size_t);
+extern packet_id_t packet_get_id(const packet_t *);
+extern size_t packet_get_data_length(const packet_t *);
+extern void *packet_get_data(const packet_t *);
+extern int packet_get_addr(const packet_t *, uint8_t **, uint8_t **);
+extern int packet_set_addr(packet_t *, const uint8_t *, const uint8_t *, size_t);
+extern packet_t *packet_get_copy(int, packet_t *);
 
 /*@}*/
Index: uspace/lib/net/include/packet_remote.h
===================================================================
--- uspace/lib/net/include/packet_remote.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/packet_remote.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -37,7 +37,7 @@
 #include <sys/types.h>
 
-extern int packet_translate_remote(int, packet_t *, packet_id_t);
-extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t);
-extern packet_t packet_get_1_remote(int, size_t);
+extern int packet_translate_remote(int, packet_t **, packet_id_t);
+extern packet_t *packet_get_4_remote(int, size_t, size_t, size_t, size_t);
+extern packet_t *packet_get_1_remote(int, size_t);
 extern void pq_release_remote(int, packet_id_t);
 
Index: uspace/lib/net/include/socket_core.h
===================================================================
--- uspace/lib/net/include/socket_core.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/socket_core.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -117,5 +117,5 @@
 extern int socket_destroy(int, int, socket_cores_t *, socket_ports_t *,
     void (*)(socket_core_t *));
-extern int socket_reply_packets(packet_t, size_t *);
+extern int socket_reply_packets(packet_t *, size_t *);
 extern socket_core_t *socket_port_find(socket_ports_t *, int, const char *,
     size_t);
Index: uspace/lib/net/include/tl_common.h
===================================================================
--- uspace/lib/net/include/tl_common.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/tl_common.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,6 +57,6 @@
     size_t);
 extern int tl_set_address_port(struct sockaddr *, int, uint16_t);
-extern int tl_prepare_icmp_packet(int, int, packet_t, services_t);
-extern int tl_socket_read_packet_data(int, packet_t *, size_t,
+extern int tl_prepare_icmp_packet(int, int, packet_t *, services_t);
+extern int tl_socket_read_packet_data(int, packet_t **, size_t,
     const packet_dimension_t *, const struct sockaddr *, socklen_t);
 
Index: uspace/lib/net/include/tl_interface.h
===================================================================
--- uspace/lib/net/include/tl_interface.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/include/tl_interface.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,5 +52,5 @@
 /*@{*/
 
-extern int tl_received_msg(int, device_id_t, packet_t, services_t, services_t);
+extern int tl_received_msg(int, device_id_t, packet_t *, services_t, services_t);
 
 /*@}*/
Index: uspace/lib/net/netif/netif_local.c
===================================================================
--- uspace/lib/net/netif/netif_local.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/netif/netif_local.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -92,5 +92,5 @@
  */
 int netif_send_msg_local(int netif_phone, device_id_t device_id,
-    packet_t packet, services_t sender)
+    packet_t *packet, services_t sender)
 {
 	fibril_rwlock_write_lock(&netif_globals.lock);
@@ -307,5 +307,5 @@
  *
  */
-packet_t netif_packet_get_1(size_t content)
+packet_t *netif_packet_get_1(size_t content)
 {
 	return packet_get_1_remote(netif_globals.net_phone, content);
@@ -361,10 +361,10 @@
 	size_t length;
 	device_stats_t stats;
-	packet_t packet;
+	packet_t *packet;
 	measured_string_t address;
 	int rc;
 	
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
Index: uspace/lib/net/netif/netif_remote.c
===================================================================
--- uspace/lib/net/netif/netif_remote.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/netif/netif_remote.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -93,5 +93,5 @@
  */
 int
-netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,
+netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t *packet,
     services_t sender)
 {
@@ -144,8 +144,8 @@
 	
 	aid_t message_id = async_send_1(netif_phone, NET_NETIF_STATS,
-	    (ipcarg_t) device_id, NULL);
+	    (sysarg_t) device_id, NULL);
 	async_data_read_start(netif_phone, stats, sizeof(*stats));
 	
-	ipcarg_t result;
+	sysarg_t result;
 	async_wait_for(message_id, &result);
 	
Index: uspace/lib/net/nil/nil_remote.c
===================================================================
--- uspace/lib/net/nil/nil_remote.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/nil/nil_remote.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -74,5 +74,5 @@
  */
 int nil_received_msg_remote(int nil_phone, device_id_t device_id,
-    packet_t packet, services_t target)
+    packet_t *packet, services_t target)
 {
 	return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED,
Index: uspace/lib/net/tl/icmp_client.c
===================================================================
--- uspace/lib/net/tl/icmp_client.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/tl/icmp_client.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -61,5 +61,5 @@
  */
 int
-icmp_client_process_packet(packet_t packet, icmp_type_t *type,
+icmp_client_process_packet(packet_t *packet, icmp_type_t *type,
     icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu)
 {
@@ -94,5 +94,5 @@
  * @return		The ICMP header length in bytes.
  */
-size_t icmp_client_header_length(packet_t packet)
+size_t icmp_client_header_length(packet_t *packet)
 {
 	if (packet_get_data_length(packet) < sizeof(icmp_header_t))
Index: uspace/lib/net/tl/icmp_remote.c
===================================================================
--- uspace/lib/net/tl/icmp_remote.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/tl/icmp_remote.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -63,8 +63,8 @@
 int
 icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code,
-    icmp_param_t mtu, packet_t packet)
+    icmp_param_t mtu, packet_t *packet)
 {
-	async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (ipcarg_t) code,
-	    (ipcarg_t) packet_get_id(packet), (ipcarg_t) mtu);
+	async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (sysarg_t) code,
+	    (sysarg_t) packet_get_id(packet), (sysarg_t) mtu);
 	return EOK;
 }
@@ -82,8 +82,8 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-int icmp_source_quench_msg(int icmp_phone, packet_t packet)
+int icmp_source_quench_msg(int icmp_phone, packet_t *packet)
 {
 	async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0,
-	    (ipcarg_t) packet_get_id(packet));
+	    (sysarg_t) packet_get_id(packet));
 	return EOK;
 }
@@ -102,8 +102,8 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet)
+int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t *packet)
 {
-	async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (ipcarg_t) code,
-	    (ipcarg_t) packet_get_id(packet));
+	async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,
+	    (sysarg_t) packet_get_id(packet));
 	return EOK;
 }
@@ -124,8 +124,8 @@
  */
 int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code,
-    icmp_param_t pointer, packet_t packet)
+    icmp_param_t pointer, packet_t *packet)
 {
-	async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (ipcarg_t) code,
-	    (ipcarg_t) packet_get_id(packet), (ipcarg_t) pointer);
+	async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (sysarg_t) code,
+	    (sysarg_t) packet_get_id(packet), (sysarg_t) pointer);
 	return EOK;
 }
Index: uspace/lib/net/tl/socket_core.c
===================================================================
--- uspace/lib/net/tl/socket_core.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/tl/socket_core.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -522,7 +522,7 @@
  *			function.
  */
-int socket_reply_packets(packet_t packet, size_t *length)
-{
-	packet_t next_packet;
+int socket_reply_packets(packet_t *packet, size_t *length)
+{
+	packet_t *next_packet;
 	size_t fragments;
 	size_t *lengths;
Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/tl/tl_common.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -248,8 +248,8 @@
  */
 int
-tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet,
+tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t *packet,
     services_t error)
 {
-	packet_t next;
+	packet_t *next;
 	uint8_t *src;
 	int length;
@@ -287,5 +287,5 @@
  */
 int
-tl_socket_read_packet_data(int packet_phone, packet_t *packet, size_t prefix,
+tl_socket_read_packet_data(int packet_phone, packet_t **packet, size_t prefix,
     const packet_dimension_t *dimension, const struct sockaddr *addr,
     socklen_t addrlen)
Index: uspace/lib/net/tl/tl_interface.c
===================================================================
--- uspace/lib/net/tl/tl_interface.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/net/tl/tl_interface.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -58,5 +58,5 @@
  */
 int
-tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet,
+tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet,
     services_t target, services_t error)
 {
Index: uspace/lib/packet/generic/packet_server.c
===================================================================
--- uspace/lib/packet/generic/packet_server.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/lib/packet/generic/packet_server.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,5 +36,4 @@
 
 #include <packet_server.h>
-#include <packet_local.h>
 
 #include <align.h>
@@ -69,5 +68,5 @@
 	fibril_mutex_t lock;
 	/** Free packet queues. */
-	packet_t free[FREE_QUEUES_COUNT];
+	packet_t *free[FREE_QUEUES_COUNT];
 	
 	/**
@@ -103,13 +102,4 @@
 };
 
-int packet_translate_local(int phone, packet_t *packet, packet_id_t packet_id)
-{
-	if (!packet)
-		return EINVAL;
-	
-	*packet = pm_find(packet_id);
-	return (*packet) ? EOK : ENOENT;
-}
-
 /** Clears and initializes the packet according to the given dimensions.
  *
@@ -122,10 +112,10 @@
  */
 static void
-packet_init(packet_t packet, size_t addr_len, size_t max_prefix,
+packet_init(packet_t *packet, size_t addr_len, size_t max_prefix,
     size_t max_content, size_t max_suffix)
 {
 	// clear the packet content
-	bzero(((void *) packet) + sizeof(struct packet),
-	    packet->length - sizeof(struct packet));
+	bzero(((void *) packet) + sizeof(packet_t),
+	    packet->length - sizeof(packet_t));
 	
 	// clear the packet header
@@ -135,5 +125,5 @@
 	packet->next = 0;
 	packet->addr_len = 0;
-	packet->src_addr = sizeof(struct packet);
+	packet->src_addr = sizeof(packet_t);
 	packet->dest_addr = packet->src_addr + addr_len;
 	packet->max_prefix = max_prefix;
@@ -144,6 +134,4 @@
 
 /** Creates a new packet of dimensions at least as given.
- *
- * Should be used only when the global data are locked.
  *
  * @param[in] length	The total length of the packet, including the header,
@@ -157,13 +145,15 @@
  * @return		NULL if there is not enough memory left.
  */
-static packet_t
+static packet_t *
 packet_create(size_t length, size_t addr_len, size_t max_prefix,
     size_t max_content, size_t max_suffix)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
+	assert(fibril_mutex_is_locked(&ps_globals.lock));
+
 	// already locked
-	packet = (packet_t) mmap(NULL, length, PROTO_READ | PROTO_WRITE,
+	packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE,
 	    MAP_SHARED | MAP_ANONYMOUS, 0, 0);
 	if (packet == MAP_FAILED)
@@ -198,14 +188,14 @@
  * @return		NULL if there is not enough memory left.
  */
-static packet_t
+static packet_t *
 packet_get_local(size_t addr_len, size_t max_prefix, size_t max_content,
     size_t max_suffix)
 {
-	size_t length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len +
+	size_t length = ALIGN_UP(sizeof(packet_t) + 2 * addr_len +
 	    max_prefix + max_content + max_suffix, PAGE_SIZE);
 	
 	fibril_mutex_lock(&ps_globals.lock);
 	
-	packet_t packet;
+	packet_t *packet;
 	unsigned int index;
 	
@@ -241,27 +231,15 @@
 }
 
-packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len,
-    size_t max_prefix, size_t max_suffix)
-{
-	return packet_get_local(addr_len, max_prefix, max_content, max_suffix);
-}
-
-packet_t packet_get_1_local(int phone, size_t content)
-{
-	return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content,
-	    DEFAULT_SUFFIX);
-}
-
 /** Release the packet and returns it to the appropriate free packet queue.
  *
- * Should be used only when the global data are locked.
- *
  * @param[in] packet	The packet to be released.
  *
  */
-static void packet_release(packet_t packet)
+static void packet_release(packet_t *packet)
 {
 	int index;
 	int result;
+
+	assert(fibril_mutex_is_locked(&ps_globals.lock));
 
 	for (index = 0; (index < FREE_QUEUES_COUNT - 1) &&
@@ -283,5 +261,5 @@
 static int packet_release_wrapper(packet_id_t packet_id)
 {
-	packet_t packet;
+	packet_t *packet;
 
 	packet = pm_find(packet_id);
@@ -294,9 +272,4 @@
 
 	return EOK;
-}
-
-void pq_release_local(int phone, packet_id_t packet_id)
-{
-	(void) packet_release_wrapper(packet_id);
 }
 
@@ -310,5 +283,5 @@
  *			async_share_in_finalize() function.
  */
-static int packet_reply(const packet_t packet)
+static int packet_reply(packet_t *packet)
 {
 	ipc_callid_t callid;
@@ -351,8 +324,8 @@
     int *answer_count)
 {
-	packet_t packet;
+	packet_t *packet;
 
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
@@ -364,6 +337,6 @@
 			return ENOMEM;
 		*answer_count = 2;
-		IPC_SET_ARG1(*answer, (ipcarg_t) packet->packet_id);
-		IPC_SET_ARG2(*answer, (ipcarg_t) packet->length);
+		IPC_SET_ARG1(*answer, (sysarg_t) packet->packet_id);
+		IPC_SET_ARG2(*answer, (sysarg_t) packet->length);
 		return EOK;
 	
@@ -378,6 +351,6 @@
 			return ENOMEM;
 		*answer_count = 2;
-		IPC_SET_ARG1(*answer, (ipcarg_t) packet->packet_id);
-		IPC_SET_ARG2(*answer, (ipcarg_t) packet->length);
+		IPC_SET_ARG1(*answer, (sysarg_t) packet->packet_id);
+		IPC_SET_ARG2(*answer, (sysarg_t) packet->length);
 		return EOK;
 	
@@ -392,5 +365,5 @@
 		if (!packet_is_valid(packet))
 			return ENOENT;
-		IPC_SET_ARG1(*answer, (ipcarg_t) packet->length);
+		IPC_SET_ARG1(*answer, (sysarg_t) packet->length);
 		*answer_count = 1;
 		return EOK;
Index: pace/lib/packet/include/packet_local.h
===================================================================
--- uspace/lib/packet/include/packet_local.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * 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 libpacket
- * @{
- */
-
-/** @file
- */
-
-#ifndef LIBPACKET_PACKET_LOCAL_H_
-#define LIBPACKET_PACKET_LOCAL_H_
-
-#include <net/packet.h>
-
-/** @name Packet local interface
- */
-/*@{*/
-
-extern int packet_translate_local(int, packet_t *, packet_id_t);
-extern packet_t packet_get_4_local(int, size_t, size_t, size_t, size_t);
-extern packet_t packet_get_1_local(int, size_t);
-extern void pq_release_local(int, packet_id_t);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/srv/bd/ata_bd/ata_bd.c
===================================================================
--- uspace/srv/bd/ata_bd/ata_bd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/bd/ata_bd/ata_bd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -113,5 +113,6 @@
 	printf(NAME ": ATA disk driver\n");
 
-	printf("I/O address %p/%p\n", ctl_physical, cmd_physical);
+	printf("I/O address %p/%p\n", (void *) ctl_physical,
+	    (void *) cmd_physical);
 
 	if (ata_bd_init() != EOK)
@@ -181,5 +182,5 @@
 	}
 
-	printf(" %" PRIu64 " blocks", d->blocks, d->blocks / (2 * 1024));
+	printf(" %" PRIu64 " blocks", d->blocks);
 
 	mbytes = d->blocks / (2 * 1024);
@@ -228,5 +229,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	devmap_handle_t dh;
 	int flags;
@@ -268,5 +269,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
Index: uspace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/bd/file_bd/file_bd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -56,5 +56,7 @@
 #define NAME "file_bd"
 
-static const size_t block_size = 512;
+#define DEFAULT_BLOCK_SIZE 512
+
+static size_t block_size;
 static aoff64_t num_blocks;
 static FILE *img;
@@ -63,4 +65,5 @@
 static fibril_mutex_t dev_lock;
 
+static void print_usage(void);
 static int file_bd_init(const char *fname);
 static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall);
@@ -71,20 +74,53 @@
 {
 	int rc;
+	char *image_name;
+	char *device_name;
 
 	printf(NAME ": File-backed block device driver\n");
 
-	if (argc != 3) {
-		printf("Expected two arguments (image name, device name).\n");
+	block_size = DEFAULT_BLOCK_SIZE;
+
+	++argv; --argc;
+	while (*argv != NULL && (*argv)[0] == '-') {
+		/* Option */
+		if (str_cmp(*argv, "-b") == 0) {
+			if (argc < 2) {
+				printf("Argument missing.\n");
+				print_usage();
+				return -1;
+			}
+
+			rc = str_size_t(argv[1], NULL, 10, true, &block_size);
+			if (rc != EOK || block_size == 0) {
+				printf("Invalid block size '%s'.\n", argv[1]);
+				print_usage();
+				return -1;
+			}
+			++argv; --argc;
+		} else {
+			printf("Invalid option '%s'.\n", *argv);
+			print_usage();
+			return -1;
+		}
+		++argv; --argc;
+	}
+
+	if (argc < 2) {
+		printf("Missing arguments.\n");
+		print_usage();
 		return -1;
 	}
 
-	if (file_bd_init(argv[1]) != EOK)
+	image_name = argv[0];
+	device_name = argv[1];
+
+	if (file_bd_init(image_name) != EOK)
 		return -1;
 
-	rc = devmap_device_register(argv[2], &devmap_handle);
+	rc = devmap_device_register(device_name, &devmap_handle);
 	if (rc != EOK) {
 		devmap_hangup_phone(DEVMAP_DRIVER);
-		printf(NAME ": Unable to register device %s.\n",
-			argv[2]);
+		printf(NAME ": Unable to register device '%s'.\n",
+			device_name);
 		return rc;
 	}
@@ -96,4 +132,9 @@
 	/* Not reached */
 	return 0;
+}
+
+static void print_usage(void)
+{
+	printf("Usage: " NAME " [-b <block_size>] <image_file> <device_name>\n");
 }
 
@@ -136,5 +177,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	size_t comm_size;
 	int flags;
@@ -161,5 +202,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
Index: uspace/srv/bd/gxe_bd/gxe_bd.c
===================================================================
--- uspace/srv/bd/gxe_bd/gxe_bd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/bd/gxe_bd/gxe_bd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -160,5 +160,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	devmap_handle_t dh;
 	int flags;
@@ -205,5 +205,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
Index: uspace/srv/bd/part/guid_part/guid_part.c
===================================================================
--- uspace/srv/bd/part/guid_part/guid_part.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/bd/part/guid_part/guid_part.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -155,5 +155,5 @@
 
 	if (block_size < 512 || (block_size % 512) != 0) {
-		printf(NAME ": invalid block size %d.\n");
+		printf(NAME ": invalid block size %zu.\n", block_size);
 		return ENOTSUP;
 	}
@@ -315,5 +315,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	devmap_handle_t dh;
 	int flags;
@@ -360,5 +360,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
Index: uspace/srv/bd/part/mbr_part/mbr_part.c
===================================================================
--- uspace/srv/bd/part/mbr_part/mbr_part.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/bd/part/mbr_part/mbr_part.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -206,5 +206,5 @@
 
 	if (block_size < 512 || (block_size % 512) != 0) {
-		printf(NAME ": invalid block size %d.\n");
+		printf(NAME ": invalid block size %zu.\n", block_size);
 		return ENOTSUP;
 	}
@@ -393,5 +393,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	devmap_handle_t dh;
 	int flags;
@@ -438,5 +438,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
Index: uspace/srv/bd/rd/rd.c
===================================================================
--- uspace/srv/bd/rd/rd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/bd/rd/rd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -124,5 +124,5 @@
 	while (true) {
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/*
@@ -230,5 +230,6 @@
 	}
 	
-	printf("%s: Found RAM disk at %p, %d bytes\n", NAME, rd_ph_addr, rd_size);
+	printf("%s: Found RAM disk at %p, %zu bytes\n", NAME,
+	    (void *) rd_ph_addr, rd_size);
 	
 	int rc = devmap_driver_register(NAME, rd_connection);
Index: uspace/srv/clip/clip.c
===================================================================
--- uspace/srv/clip/clip.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/clip/clip.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -118,5 +118,5 @@
 		}
 		
-		ipcarg_t retval = async_data_read_finalize(callid, clip_data, size);
+		sysarg_t retval = async_data_read_finalize(callid, clip_data, size);
 		if (retval != EOK) {
 			ipc_answer_0(rid, retval);
@@ -145,5 +145,5 @@
 	
 	fibril_mutex_unlock(&clip_mtx);
-	ipc_answer_2(rid, EOK, (ipcarg_t) size, (ipcarg_t) tag);
+	ipc_answer_2(rid, EOK, (sysarg_t) size, (sysarg_t) tag);
 }
 
@@ -158,5 +158,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cont = false;
@@ -172,6 +172,5 @@
 			break;
 		default:
-			if (!(callid & IPC_CALLID_NOTIFICATION))
-				ipc_answer_0(callid, ENOENT);
+			ipc_answer_0(callid, ENOENT);
 		}
 	}
@@ -184,5 +183,5 @@
 	async_set_client_connection(clip_connection);
 	
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	if (ipc_connect_to_me(PHONE_NS, SERVICE_CLIPBOARD, 0, 0, &phonead) != 0) 
 		return -1;
Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/devman/devman.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -62,4 +62,14 @@
 }
 
+static int devmap_devices_class_compare(unsigned long key[], hash_count_t keys,
+    link_t *item)
+{
+	dev_class_info_t *class_info
+	    = hash_table_get_instance(item, dev_class_info_t, devmap_link);
+	assert(class_info != NULL);
+
+	return (class_info->devmap_handle == (devmap_handle_t) key[0]);
+}
+
 static void devices_remove_callback(link_t *item)
 {
@@ -75,4 +85,10 @@
 	.hash = devices_hash,
 	.compare = devmap_devices_compare,
+	.remove_callback = devices_remove_callback
+};
+
+static hash_table_operations_t devmap_devices_class_ops = {
+	.hash = devices_hash,
+	.compare = devmap_devices_class_compare,
 	.remove_callback = devices_remove_callback
 };
@@ -368,4 +384,5 @@
 	printf(NAME ": create_root_node\n");
 
+	fibril_rwlock_write_lock(&tree->rwlock);
 	node = create_dev_node();
 	if (node != NULL) {
@@ -377,4 +394,5 @@
 		tree->root_node = node;
 	}
+	fibril_rwlock_write_unlock(&tree->rwlock);
 
 	return node != NULL;
@@ -439,6 +457,4 @@
 /** Start a driver
  *
- * The driver's mutex is assumed to be locked.
- *
  * @param drv		The driver's structure.
  * @return		True if the driver's task is successfully spawned, false
@@ -449,4 +465,6 @@
 	int rc;
 
+	assert(fibril_mutex_is_locked(&drv->driver_mutex));
+	
 	printf(NAME ": start_driver '%s'\n", drv->name);
 	
@@ -498,5 +516,5 @@
  * @param phone		The phone to the driver.
  */
-void set_driver_phone(driver_t *driver, ipcarg_t phone)
+void set_driver_phone(driver_t *driver, sysarg_t phone)
 {
 	fibril_mutex_lock(&driver->driver_mutex);
@@ -508,6 +526,4 @@
 /** Notify driver about the devices to which it was assigned.
  *
- * The driver's mutex must be locked.
- *
  * @param driver	The driver to which the devices are passed.
  */
@@ -518,18 +534,75 @@
 	int phone;
 
-	printf(NAME ": pass_devices_to_driver\n");
-
-	phone = ipc_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
-	if (phone > 0) {
-		
+	printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name);
+
+	fibril_mutex_lock(&driver->driver_mutex);
+
+	phone = async_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
+
+	if (phone < 0) {
+		fibril_mutex_unlock(&driver->driver_mutex);
+		return;
+	}
+
+	/*
+	 * Go through devices list as long as there is some device
+	 * that has not been passed to the driver.
+	 */
+	link = driver->devices.next;
+	while (link != &driver->devices) {
+		dev = list_get_instance(link, node_t, driver_devices);
+		if (dev->passed_to_driver) {
+			link = link->next;
+			continue;
+		}
+
+		/*
+		 * We remove the device from the list to allow safe adding
+		 * of new devices (no one will touch our item this way).
+		 */
+		list_remove(link);
+
+		/*
+		 * Unlock to avoid deadlock when adding device
+		 * handled by itself.
+		 */
+		fibril_mutex_unlock(&driver->driver_mutex);
+
+		add_device(phone, driver, dev, tree);
+
+		/*
+		 * Lock again as we will work with driver's
+		 * structure.
+		 */
+		fibril_mutex_lock(&driver->driver_mutex);
+
+		/*
+		 * Insert the device back.
+		 * The order is not relevant here so no harm is done
+		 * (actually, the order would be preserved in most cases).
+		 */
+		list_append(link, &driver->devices);
+
+		/*
+		 * Restart the cycle to go through all devices again.
+		 */
 		link = driver->devices.next;
-		while (link != &driver->devices) {
-			dev = list_get_instance(link, node_t, driver_devices);
-			add_device(phone, driver, dev, tree);
-			link = link->next;
-		}
-		
-		ipc_hangup(phone);
-	}
+	}
+
+	ipc_hangup(phone);
+
+	/*
+	 * Once we passed all devices to the driver, we need to mark the
+	 * driver as running.
+	 * It is vital to do it here and inside critical section.
+	 *
+	 * If we would change the state earlier, other devices added to
+	 * the driver would be added to the device list and started
+	 * immediately and possibly started here as well.
+	 */
+	printf(NAME ": driver %s goes into running state.\n", driver->name);
+	driver->state = DRIVER_RUNNING;
+
+	fibril_mutex_unlock(&driver->driver_mutex);
 }
 
@@ -545,6 +618,5 @@
 void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
 {
-	printf(NAME ": initialize_running_driver\n");
-	fibril_mutex_lock(&driver->driver_mutex);
+	printf(NAME ": initialize_running_driver (`%s')\n", driver->name);
 	
 	/*
@@ -553,9 +625,4 @@
 	 */
 	pass_devices_to_driver(driver, tree);
-	
-	/* Change driver's state to running. */
-	driver->state = DRIVER_RUNNING;
-	
-	fibril_mutex_unlock(&driver->driver_mutex);
 }
 
@@ -621,5 +688,6 @@
 	}
 	
-	devmap_device_register(devmap_pathname, &node->devmap_handle);
+	devmap_device_register_with_iface(devmap_pathname,
+	    &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
 	
 	tree_add_devmap_device(tree, node);
@@ -629,5 +697,4 @@
 }
 
-
 /** Pass a device to running driver.
  *
@@ -637,12 +704,24 @@
 void add_device(int phone, driver_t *drv, node_t *node, dev_tree_t *tree)
 {
-	printf(NAME ": add_device\n");
-	
-	ipcarg_t rc;
+	/*
+	 * We do not expect to have driver's mutex locked as we do not
+	 * access any structures that would affect driver_t.
+	 */
+	printf(NAME ": add_device (driver `%s', device `%s')\n", drv->name,
+	    node->name);
+	
+	sysarg_t rc;
 	ipc_call_t answer;
 	
 	/* Send the device to the driver. */
-	aid_t req = async_send_1(phone, DRIVER_ADD_DEVICE, node->handle,
-	    &answer);
+	devman_handle_t parent_handle;
+	if (node->parent) {
+		parent_handle = node->parent->handle;
+	} else {
+		parent_handle = 0;
+	}
+
+	aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, node->handle,
+	    parent_handle, &answer);
 	
 	/* Send the device's name to the driver. */
@@ -652,7 +731,8 @@
 		/* TODO handle error */
 	}
-	
+
 	/* Wait for answer from the driver. */
 	async_wait_for(req, &rc);
+
 	switch(rc) {
 	case EOK:
@@ -667,4 +747,6 @@
 	}
 	
+	node->passed_to_driver = true;
+
 	return;
 }
@@ -692,12 +774,15 @@
 	attach_driver(node, drv);
 	
+	fibril_mutex_lock(&drv->driver_mutex);
 	if (drv->state == DRIVER_NOT_STARTED) {
 		/* Start the driver. */
 		start_driver(drv);
 	}
-	
-	if (drv->state == DRIVER_RUNNING) {
+	bool is_running = drv->state == DRIVER_RUNNING;
+	fibril_mutex_unlock(&drv->driver_mutex);
+
+	if (is_running) {
 		/* Notify the driver about the new device. */
-		int phone = ipc_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
+		int phone = async_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
 		if (phone > 0) {
 			add_device(phone, drv, node, tree);
@@ -776,6 +861,4 @@
 /** Find the device node structure of the device witch has the specified handle.
  *
- * Device tree's rwlock should be held at least for reading.
- *
  * @param tree		The device tree where we look for the device node.
  * @param handle	The handle of the device.
@@ -785,5 +868,9 @@
 {
 	unsigned long key = handle;
-	link_t *link = hash_table_find(&tree->devman_devices, &key);
+	link_t *link;
+	
+	assert(fibril_rwlock_is_locked(&tree->rwlock));
+	
+	link = hash_table_find(&tree->devman_devices, &key);
 	return hash_table_get_instance(link, node_t, devman_link);
 }
@@ -841,7 +928,4 @@
 /** Insert new device into device tree.
  *
- * The device tree's rwlock should be already held exclusively when calling this
- * function.
- *
  * @param tree		The device tree.
  * @param node		The newly added device node. 
@@ -858,8 +942,8 @@
 	assert(tree != NULL);
 	assert(dev_name != NULL);
+	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
 	
 	node->name = dev_name;
 	if (!set_dev_path(node, parent)) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
 		return false;
 	}
@@ -977,6 +1061,10 @@
 	
 	info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
-	if (info != NULL)
+	if (info != NULL) {
 		memset(info, 0, sizeof(dev_class_info_t));
+		list_initialize(&info->dev_classes);
+		list_initialize(&info->devmap_link);
+		list_initialize(&info->link);
+	}
 	
 	return info;
@@ -1014,5 +1102,5 @@
 	
 	size_t idx = get_new_class_dev_idx(cl);
-	asprintf(&dev_name, "%s%d", base_name, idx);
+	asprintf(&dev_name, "%s%zu", base_name, idx);
 	
 	return dev_name;
@@ -1083,6 +1171,8 @@
 	while (link != &class_list->classes) {
 		cl = list_get_instance(link, dev_class_t, link);
-		if (str_cmp(cl->name, class_name) == 0)
+		if (str_cmp(cl->name, class_name) == 0) {
 			return cl;
+		}
+		link = link->next;
 	}
 	
@@ -1100,5 +1190,5 @@
 	fibril_rwlock_initialize(&class_list->rwlock);
 	hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
-	    &devmap_devices_ops);
+	    &devmap_devices_class_ops);
 }
 
@@ -1148,4 +1238,6 @@
 	hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
 	fibril_rwlock_write_unlock(&class_list->rwlock);
+
+	assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
 }
 
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/devman/devman.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -86,5 +86,5 @@
 	
 	/** Phone asociated with this driver. */
-	ipcarg_t phone;
+	sysarg_t phone;
 	/** Name of the device driver. */
 	char *name;
@@ -168,4 +168,9 @@
 	 */
 	link_t devmap_link;
+
+	/**
+	 * Whether this device was already passed to the driver.
+	 */
+	bool passed_to_driver;
 };
 
@@ -297,5 +302,5 @@
 
 extern driver_t *find_driver(driver_list_t *, const char *);
-extern void set_driver_phone(driver_t *, ipcarg_t);
+extern void set_driver_phone(driver_t *, sysarg_t);
 extern void initialize_running_driver(driver_t *, dev_tree_t *);
 
Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/devman/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,4 +36,5 @@
  */
 
+#include <inttypes.h>
 #include <assert.h>
 #include <ipc/services.h>
@@ -73,5 +74,5 @@
 	
 	iid = async_get_call(&icall);
-	if (IPC_GET_METHOD(icall) != DEVMAN_DRIVER_REGISTER) {
+	if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) {
 		ipc_answer_0(iid, EREFUSED);
 		return NULL;
@@ -108,5 +109,5 @@
 	ipc_call_t call;
 	ipc_callid_t callid = async_get_call(&call);
-	if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) {
+	if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
 		ipc_answer_0(callid, ENOTSUP);
 		ipc_answer_0(iid, ENOTSUP);
@@ -140,5 +141,5 @@
 	
 	callid = async_get_call(&call);
-	if (DEVMAN_ADD_MATCH_ID != IPC_GET_METHOD(call)) {
+	if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
 		printf(NAME ": ERROR: devman_receive_match_id - invalid "
 		    "protocol.\n");
@@ -183,5 +184,5 @@
  * @return		Zero on success, negative error code otherwise.
  */
-static int devman_receive_match_ids(ipcarg_t match_count,
+static int devman_receive_match_ids(sysarg_t match_count,
     match_id_list_t *match_ids)
 {
@@ -196,4 +197,11 @@
 }
 
+static int assign_driver_fibril(void *arg)
+{
+	node_t *node = (node_t *) arg;
+	assign_driver(node, &drivers_list, &device_tree);
+	return EOK;
+}
+
 /** Handle child device registration.
  *
@@ -203,5 +211,5 @@
 {
 	devman_handle_t parent_handle = IPC_GET_ARG1(*call);
-	ipcarg_t match_count = IPC_GET_ARG2(*call);
+	sysarg_t match_count = IPC_GET_ARG2(*call);
 	dev_tree_t *tree = &device_tree;
 	
@@ -236,10 +244,25 @@
 	
 	devman_receive_match_ids(match_count, &node->match_ids);
-	
+
+	/*
+	 * Try to find a suitable driver and assign it to the device.  We do
+	 * not want to block the current fibril that is used for processing
+	 * incoming calls: we will launch a separate fibril to handle the
+	 * driver assigning. That is because assign_driver can actually include
+	 * task spawning which could take some time.
+	 */
+	fid_t assign_fibril = fibril_create(assign_driver_fibril, node);
+	if (assign_fibril == 0) {
+		/*
+		 * Fallback in case we are out of memory.
+		 * Probably not needed as we will die soon anyway ;-).
+		 */
+		(void) assign_driver_fibril(node);
+	} else {
+		fibril_add_ready(assign_fibril);
+	}
+
 	/* Return device handle to parent's driver. */
 	ipc_answer_1(callid, EOK, node->handle);
-	
-	/* Try to find suitable driver and assign it to the device. */
-	assign_driver(node, &drivers_list, &device_tree);
 }
 
@@ -258,5 +281,6 @@
 	 * handle.
 	 */
-	devmap_device_register(devmap_pathname, &cli->devmap_handle);
+	devmap_device_register_with_iface(devmap_pathname,
+	    &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
 	
 	/*
@@ -296,5 +320,5 @@
 	printf(NAME ": device '%s' added to class '%s', class name '%s' was "
 	    "asigned to it\n", dev->pathname, class_name, class_info->dev_name);
-	
+
 	ipc_answer_0(callid, EOK);
 }
@@ -344,5 +368,5 @@
 		callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cont = false;
@@ -397,5 +421,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cont = false;
@@ -405,6 +429,5 @@
 			break;
 		default:
-			if (!(callid & IPC_CALLID_NOTIFICATION))
-				ipc_answer_0(callid, ENOENT);
+			ipc_answer_0(callid, ENOENT);
 		}
 	}
@@ -418,6 +441,6 @@
 	node_t *dev = find_dev_node(&device_tree, handle);
 	if (dev == NULL) {
-		printf(NAME ": devman_forward error - no device with handle %x "
-		    "was found.\n", handle);
+		printf(NAME ": devman_forward error - no device with handle %" PRIun
+		    " was found.\n", handle);
 		ipc_answer_0(iid, ENOENT);
 		return;
@@ -435,6 +458,6 @@
 	
 	if (driver == NULL) {
-		printf(NAME ": devman_forward error - the device is not in "
-		    "usable state.\n", handle);
+		printf(NAME ": devman_forward error - the device is not in %" PRIun
+		    " usable state.\n", handle);
 		ipc_answer_0(iid, ENOENT);
 		return;
@@ -450,5 +473,5 @@
 		printf(NAME ": devman_forward: cound not forward to driver %s ",
 		    driver->name);
-		printf("the driver's phone is %x).\n", driver->phone);
+		printf("the driver's phone is %" PRIun ").\n", driver->phone);
 		ipc_answer_0(iid, EINVAL);
 		return;
@@ -464,5 +487,5 @@
 static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
 {
-	devmap_handle_t devmap_handle = IPC_GET_METHOD(*icall);
+	devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall);
 	node_t *dev;
 
@@ -481,8 +504,8 @@
 	}
 	
-	printf(NAME ": devman_connection_devmapper: forward connection to "
-	    "device %s to driver %s.\n", dev->pathname, dev->drv->name);
 	ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
 	    IPC_FF_NONE);
+	printf(NAME ": devman_connection_devmapper: forwarded connection to "
+	    "device %s to driver %s.\n", dev->pathname, dev->drv->name);
 }
 
@@ -490,24 +513,6 @@
 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall)
 {
-	/*
-	 * Silly hack to enable the device manager to register as a driver by
-	 * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this
-	 * is not the forwarded connection from naming service, so it must be a
-	 * connection from the devmapper which thinks this is a devmapper-style
-	 * driver. So pretend this is a devmapper-style driver. (This does not
-	 * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper
-	 * passes device handle to the driver as an ipc method.)
-	 */
-	if (IPC_GET_METHOD(*icall) != IPC_M_CONNECT_ME_TO)
-		devman_connection_devmapper(iid, icall);
-
-	/*
-	 * ipc method is IPC_M_CONNECT_ME_TO, so this is forwarded connection
-	 * from naming service by which we registered as device manager, so be
-	 * device manager.
-	 */
-	
 	/* Select interface. */
-	switch ((ipcarg_t) (IPC_GET_ARG1(*icall))) {
+	switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
 	case DEVMAN_DRIVER:
 		devman_connection_driver(iid, icall);
@@ -520,4 +525,8 @@
 		devman_forward(iid, icall, false);
 		break;
+	case DEVMAN_CONNECT_FROM_DEVMAP:
+		/* Someone connected through devmap node. */
+		devman_connection_devmapper(iid, icall);
+		break;
 	case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
 		/* Connect client to selected device. */
@@ -577,5 +586,5 @@
 
 	/* Register device manager at naming service. */
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAN, 0, 0, &phonead) != 0)
 		return -1;
Index: uspace/srv/devman/match.c
===================================================================
--- uspace/srv/devman/match.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/devman/match.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -35,4 +35,26 @@
 #include "devman.h"
 
+/** Compute compound score of driver and device.
+ *
+ * @param driver Match id of the driver.
+ * @param device Match id of the device.
+ * @return Compound score.
+ * @retval 0 No match at all.
+ */
+static int compute_match_score(match_id_t *driver, match_id_t *device)
+{
+	if (str_cmp(driver->id, device->id) == 0) {
+		/*
+		 * The strings match, return the product of their scores.
+		 */
+		return driver->score * device->score;
+	} else {
+		/*
+		 * Different strings, return zero.
+		 */
+		return 0;
+	}
+}
+
 int get_match_score(driver_t *drv, node_t *dev)
 {
@@ -43,63 +65,28 @@
 		return 0;
 	
+	/*
+	 * Go through all pairs, return the highest score obtained.
+	 */
+	int highest_score = 0;
+	
 	link_t *drv_link = drv->match_ids.ids.next;
-	link_t *dev_link = dev->match_ids.ids.next;
-	
-	match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link);
-	match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link);
-	
-	int score_next_drv = 0;
-	int score_next_dev = 0;
-	
-	do {
-		match_id_t *tmp_ma_id;
-	
-		if (str_cmp(drv_id->id, dev_id->id) == 0) {
-		 	/*
-		 	 * We found a match.
-		 	 * Return the score of the match.
-		 	 */
-			return drv_id->score * dev_id->score;
+	while (drv_link != drv_head) {
+		link_t *dev_link = dev_head->next;
+		while (dev_link != dev_head) {
+			match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link);
+			match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link);
+			
+			int score = compute_match_score(drv_id, dev_id);
+			if (score > highest_score) {
+				highest_score = score;
+			}
+
+			dev_link = dev_link->next;
 		}
 		
-		/*
-		 * Compute the next score we get, if we advance in the driver's
-		 * list of match ids.
-		 */
-		if (drv_link->next != drv_head) {
-			tmp_ma_id = list_get_instance(drv_link->next,
-			    match_id_t, link);
-			score_next_drv = dev_id->score * tmp_ma_id->score;
-		} else {
-			score_next_drv = 0;
-		}
-		
-		/*
-		 * Compute the next score we get, if we advance in the device's
-		 * list of match ids.
-		 */
-		if (dev_link->next != dev_head) {
-			tmp_ma_id = list_get_instance(dev_link->next,
-			    match_id_t, link);
-			score_next_dev = drv_id->score * tmp_ma_id->score;
-		} else {
-			score_next_dev = 0;
-		}
-		
-		/*
-		 * Advance in one of the two lists, so we get the next highest
-		 * score.
-		 */
-		if (score_next_drv > score_next_dev) {
-			drv_link = drv_link->next;
-			drv_id = list_get_instance(drv_link, match_id_t, link);
-		} else {
-			dev_link = dev_link->next;
-			dev_id = list_get_instance(dev_link, match_id_t, link);
-		}
-		
-	} while (drv_link->next != drv_head && dev_link->next != dev_head);
+		drv_link = drv_link->next;
+	}
 	
-	return 0;
+	return highest_score;
 }
 
Index: uspace/srv/devmap/devmap.c
===================================================================
--- uspace/srv/devmap/devmap.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/devmap/devmap.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,4 +46,5 @@
 #include <str.h>
 #include <ipc/devmap.h>
+#include <assert.h>
 
 #define NAME          "devmap"
@@ -61,5 +62,5 @@
 	link_t devices;
 	/** Phone asociated with this driver */
-	ipcarg_t phone;
+	sysarg_t phone;
 	/** Device driver name */
 	char *name;
@@ -99,4 +100,6 @@
 	/** Device driver handling this device */
 	devmap_driver_t *driver;
+	/** Use this interface when forwarding to driver. */
+	sysarg_t forward_interface;
 } devmap_device_t;
 
@@ -206,13 +209,11 @@
 }
 
-/** Find namespace with given name.
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Find namespace with given name. */
 static devmap_namespace_t *devmap_namespace_find_name(const char *name)
 {
 	link_t *item;
+	
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+	
 	for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
 		devmap_namespace_t *namespace =
@@ -227,7 +228,4 @@
 /** Find namespace with given handle.
  *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
  * @todo: use hash table
  *
@@ -236,4 +234,7 @@
 {
 	link_t *item;
+	
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+	
 	for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
 		devmap_namespace_t *namespace =
@@ -246,14 +247,12 @@
 }
 
-/** Find device with given name.
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Find device with given name. */
 static devmap_device_t *devmap_device_find_name(const char *ns_name,
     const char *name)
 {
 	link_t *item;
+	
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+	
 	for (item = devices_list.next; item != &devices_list; item = item->next) {
 		devmap_device_t *device =
@@ -269,7 +268,4 @@
 /** Find device with given handle.
  *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
  * @todo: use hash table
  *
@@ -278,4 +274,7 @@
 {
 	link_t *item;
+	
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+	
 	for (item = devices_list.next; item != &devices_list; item = item->next) {
 		devmap_device_t *device =
@@ -288,13 +287,12 @@
 }
 
-/** Create a namespace (if not already present)
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Create a namespace (if not already present). */
 static devmap_namespace_t *devmap_namespace_create(const char *ns_name)
 {
-	devmap_namespace_t *namespace = devmap_namespace_find_name(ns_name);
+	devmap_namespace_t *namespace;
+	
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+	
+	namespace = devmap_namespace_find_name(ns_name);
 	if (namespace != NULL)
 		return namespace;
@@ -321,12 +319,9 @@
 }
 
-/** Destroy a namespace (if it is no longer needed)
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Destroy a namespace (if it is no longer needed). */
 static void devmap_namespace_destroy(devmap_namespace_t *namespace)
 {
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+
 	if (namespace->refcnt == 0) {
 		list_remove(&(namespace->namespaces));
@@ -337,37 +332,28 @@
 }
 
-/** Increase namespace reference count by including device
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Increase namespace reference count by including device. */
 static void devmap_namespace_addref(devmap_namespace_t *namespace,
     devmap_device_t *device)
 {
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+
 	device->namespace = namespace;
 	namespace->refcnt++;
 }
 
-/** Decrease namespace reference count
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Decrease namespace reference count. */
 static void devmap_namespace_delref(devmap_namespace_t *namespace)
 {
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+
 	namespace->refcnt--;
 	devmap_namespace_destroy(namespace);
 }
 
-/** Unregister device and free it
- *
- * The devices_list_mutex should be already held when
- * calling this function.
- *
- */
+/** Unregister device and free it. */
 static void devmap_device_unregister_core(devmap_device_t *device)
 {
+	assert(fibril_mutex_is_locked(&devices_list_mutex));
+
 	devmap_namespace_delref(device->namespace);
 	list_remove(&(device->devices));
@@ -387,5 +373,5 @@
 	ipc_callid_t iid = async_get_call(&icall);
 	
-	if (IPC_GET_METHOD(icall) != DEVMAP_DRIVER_REGISTER) {
+	if (IPC_GET_IMETHOD(icall) != DEVMAP_DRIVER_REGISTER) {
 		ipc_answer_0(iid, EREFUSED);
 		return NULL;
@@ -416,5 +402,5 @@
 	ipc_callid_t callid = async_get_call(&call);
 	
-	if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) {
+	if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
 		free(driver->name);
 		free(driver);
@@ -517,4 +503,7 @@
 	}
 	
+	/* Set the interface, if any. */
+	device->forward_interface = IPC_GET_ARG1(*icall);
+
 	/* Get fqdn */
 	char *fqdn;
@@ -555,5 +544,5 @@
 	if (devmap_device_find_name(namespace->name, device->name) != NULL) {
 		printf("%s: Device '%s/%s' already registered\n", NAME,
-		    device->namespace, device->name);
+		    device->namespace->name, device->name);
 		devmap_namespace_destroy(namespace);
 		fibril_mutex_unlock(&devices_list_mutex);
@@ -566,5 +555,5 @@
 	/* Get unique device handle */
 	device->handle = devmap_create_handle();
-	
+
 	devmap_namespace_addref(namespace, device);
 	device->driver = driver;
@@ -617,6 +606,13 @@
 	}
 	
-	ipc_forward_fast(callid, dev->driver->phone, dev->handle,
-	    IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
+	if (dev->forward_interface == 0) {
+		ipc_forward_fast(callid, dev->driver->phone,
+		    dev->handle, 0, 0,
+		    IPC_FF_NONE);
+	} else {
+		ipc_forward_fast(callid, dev->driver->phone,
+		    dev->forward_interface, dev->handle, 0,
+		    IPC_FF_NONE);
+	}
 	
 	fibril_mutex_unlock(&devices_list_mutex);
@@ -823,5 +819,5 @@
 	}
 	
-	ipcarg_t retval = async_data_read_finalize(callid, desc, size);
+	sysarg_t retval = async_data_read_finalize(callid, desc, size);
 	
 	free(desc);
@@ -890,5 +886,5 @@
 	}
 	
-	ipcarg_t retval = async_data_read_finalize(callid, desc, size);
+	sysarg_t retval = async_data_read_finalize(callid, desc, size);
 	
 	free(desc);
@@ -964,10 +960,10 @@
 	fibril_mutex_unlock(&null_devices_mutex);
 	
-	ipc_answer_1(iid, EOK, (ipcarg_t) i);
+	ipc_answer_1(iid, EOK, (sysarg_t) i);
 }
 
 static void devmap_null_destroy(ipc_callid_t iid, ipc_call_t *icall)
 {
-	ipcarg_t i = IPC_GET_ARG1(*icall);
+	sysarg_t i = IPC_GET_ARG1(*icall);
 	if (i >= NULL_DEVICES) {
 		ipc_answer_0(iid, ELIMIT);
@@ -1027,5 +1023,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cont = false;
@@ -1052,6 +1048,5 @@
 			break;
 		default:
-			if (!(callid & IPC_CALLID_NOTIFICATION))
-				ipc_answer_0(callid, ENOENT);
+			ipc_answer_0(callid, ENOENT);
 		}
 	}
@@ -1079,5 +1074,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cont = false;
@@ -1111,6 +1106,5 @@
 			break;
 		default:
-			if (!(callid & IPC_CALLID_NOTIFICATION))
-				ipc_answer_0(callid, ENOENT);
+			ipc_answer_0(callid, ENOENT);
 		}
 	}
@@ -1123,5 +1117,5 @@
 {
 	/* Select interface */
-	switch ((ipcarg_t) (IPC_GET_ARG1(*icall))) {
+	switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
 	case DEVMAP_DRIVER:
 		devmap_connection_driver(iid, icall);
@@ -1156,5 +1150,5 @@
 	
 	/* Register device mapper at naming service */
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAP, 0, 0, &phonead) != 0) 
 		return -1;
Index: uspace/srv/fs/devfs/devfs.c
===================================================================
--- uspace/srv/fs/devfs/devfs.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/fs/devfs/devfs.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -53,4 +53,6 @@
 static vfs_info_t devfs_vfs_info = {
 	.name = NAME,
+	.concurrent_read_write = false,
+	.write_retains_size = false,
 };
 
@@ -66,5 +68,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 		
-		switch  (IPC_GET_METHOD(call)) {
+		switch  (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return;
Index: uspace/srv/fs/devfs/devfs_ops.c
===================================================================
--- uspace/srv/fs/devfs/devfs_ops.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/fs/devfs/devfs_ops.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -60,7 +60,8 @@
 typedef struct {
 	devmap_handle_t handle;
-	int phone;
+	int phone;		/**< When < 0, the structure is incomplete. */
 	size_t refcount;
 	link_t link;
+	fibril_condvar_t cv;	/**< Broadcast when completed. */
 } device_t;
 
@@ -227,7 +228,9 @@
 			[DEVICES_KEY_HANDLE] = (unsigned long) node->handle
 		};
-		
+		link_t *lnk;
+
 		fibril_mutex_lock(&devices_mutex);
-		link_t *lnk = hash_table_find(&devices, key);
+restart:
+		lnk = hash_table_find(&devices, key);
 		if (lnk == NULL) {
 			device_t *dev = (device_t *) malloc(sizeof(device_t));
@@ -237,18 +240,60 @@
 			}
 			
+			dev->handle = node->handle;
+			dev->phone = -1;	/* mark as incomplete */
+			dev->refcount = 1;
+			fibril_condvar_initialize(&dev->cv);
+
+			/*
+			 * Insert the incomplete device structure so that other
+			 * fibrils will not race with us when we drop the mutex
+			 * below.
+			 */
+			hash_table_insert(&devices, key, &dev->link);
+
+			/*
+			 * Drop the mutex to allow recursive devfs requests.
+			 */
+			fibril_mutex_unlock(&devices_mutex);
+
 			int phone = devmap_device_connect(node->handle, 0);
+
+			fibril_mutex_lock(&devices_mutex);
+
+			/*
+			 * Notify possible waiters about this device structure
+			 * being completed (or destroyed).
+			 */
+			fibril_condvar_broadcast(&dev->cv);
+
 			if (phone < 0) {
+				/*
+				 * Connecting failed, need to remove the
+				 * entry and free the device structure.
+				 */
+				hash_table_remove(&devices, key, DEVICES_KEYS);
 				fibril_mutex_unlock(&devices_mutex);
+
 				free(dev);
 				return ENOENT;
 			}
 			
-			dev->handle = node->handle;
+			/* Set the correct phone. */
 			dev->phone = phone;
-			dev->refcount = 1;
-			
-			hash_table_insert(&devices, key, &dev->link);
 		} else {
 			device_t *dev = hash_table_get_instance(lnk, device_t, link);
+
+			if (dev->phone < 0) {
+				/*
+				 * Wait until the device structure is completed
+				 * and start from the beginning as the device
+				 * structure might have entirely disappeared
+				 * while we were not holding the mutex in
+				 * fibril_condvar_wait().
+				 */
+				fibril_condvar_wait(&dev->cv, &devices_mutex);
+				goto restart;
+			}
+
 			dev->refcount++;
 		}
@@ -420,5 +465,5 @@
 	
 	/* Accept the mount options */
-	ipcarg_t retval = async_data_write_accept((void **) &opts, true, 0, 0,
+	sysarg_t retval = async_data_write_accept((void **) &opts, true, 0, 0,
 	    0, NULL);
 	if (retval != EOK) {
@@ -564,4 +609,5 @@
 		
 		device_t *dev = hash_table_get_instance(lnk, device_t, link);
+		assert(dev->phone >= 0);
 		
 		ipc_callid_t callid;
@@ -575,5 +621,5 @@
 		/* Make a request at the driver */
 		ipc_call_t answer;
-		aid_t msg = async_send_3(dev->phone, IPC_GET_METHOD(*request),
+		aid_t msg = async_send_3(dev->phone, IPC_GET_IMETHOD(*request),
 		    IPC_GET_ARG1(*request), IPC_GET_ARG2(*request),
 		    IPC_GET_ARG3(*request), &answer);
@@ -584,5 +630,5 @@
 		
 		/* Wait for reply from the driver. */
-		ipcarg_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 		size_t bytes = IPC_GET_ARG1(answer);
@@ -627,4 +673,5 @@
 		
 		device_t *dev = hash_table_get_instance(lnk, device_t, link);
+		assert(dev->phone >= 0);
 		
 		ipc_callid_t callid;
@@ -638,5 +685,5 @@
 		/* Make a request at the driver */
 		ipc_call_t answer;
-		aid_t msg = async_send_3(dev->phone, IPC_GET_METHOD(*request),
+		aid_t msg = async_send_3(dev->phone, IPC_GET_IMETHOD(*request),
 		    IPC_GET_ARG1(*request), IPC_GET_ARG2(*request),
 		    IPC_GET_ARG3(*request), &answer);
@@ -648,5 +695,5 @@
 		
 		/* Wait for reply from the driver. */
-		ipcarg_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 		size_t bytes = IPC_GET_ARG1(answer);
@@ -696,4 +743,5 @@
 		
 		device_t *dev = hash_table_get_instance(lnk, device_t, link);
+		assert(dev->phone >= 0);
 		dev->refcount--;
 		
@@ -743,8 +791,9 @@
 		
 		device_t *dev = hash_table_get_instance(lnk, device_t, link);
+		assert(dev->phone >= 0);
 		
 		/* Make a request at the driver */
 		ipc_call_t answer;
-		aid_t msg = async_send_2(dev->phone, IPC_GET_METHOD(*request),
+		aid_t msg = async_send_2(dev->phone, IPC_GET_IMETHOD(*request),
 		    IPC_GET_ARG1(*request), IPC_GET_ARG2(*request), &answer);
 		
@@ -752,5 +801,5 @@
 		
 		/* Wait for reply from the driver */
-		ipcarg_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 		
Index: uspace/srv/fs/fat/fat.c
===================================================================
--- uspace/srv/fs/fat/fat.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/fs/fat/fat.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,4 +52,6 @@
 vfs_info_t fat_vfs_info = {
 	.name = NAME,
+	.concurrent_read_write = false,
+	.write_retains_size = false,	
 };
 
@@ -91,5 +93,5 @@
 	
 		callid = async_get_call(&call);
-		switch  (IPC_GET_METHOD(call)) {
+		switch  (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return;
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -1257,5 +1257,5 @@
 
 	rc = fat_node_put(fn);
-	ipc_answer_1(rid, rc, (ipcarg_t)bytes);
+	ipc_answer_1(rid, rc, (sysarg_t)bytes);
 }
 
Index: uspace/srv/fs/tmpfs/tmpfs.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/fs/tmpfs/tmpfs.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -57,4 +57,6 @@
 vfs_info_t tmpfs_vfs_info = {
 	.name = NAME,
+	.concurrent_read_write = false,
+	.write_retains_size = false,
 };
 
@@ -97,5 +99,5 @@
 	
 		callid = async_get_call(&call);
-		switch  (IPC_GET_METHOD(call)) {
+		switch  (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return;
Index: uspace/srv/hid/adb_mouse/adb_dev.c
===================================================================
--- uspace/srv/hid/adb_mouse/adb_dev.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/adb_mouse/adb_dev.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -68,5 +68,5 @@
 
 	/* NB: The callback connection is slotted for removal */
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) {
 		printf(NAME ": Failed to create callback from device\n");
@@ -89,5 +89,5 @@
 		int retval;
 
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/* TODO: Handle hangup */
Index: uspace/srv/hid/adb_mouse/adb_mouse.c
===================================================================
--- uspace/srv/hid/adb_mouse/adb_mouse.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/adb_mouse/adb_mouse.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -102,5 +102,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			if (client_phone != -1) {
Index: uspace/srv/hid/char_mouse/char_mouse.c
===================================================================
--- uspace/srv/hid/char_mouse/char_mouse.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/char_mouse/char_mouse.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -87,5 +87,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			if (client_phone != -1) {
Index: uspace/srv/hid/char_mouse/chardev.c
===================================================================
--- uspace/srv/hid/char_mouse/chardev.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/char_mouse/chardev.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -70,5 +70,5 @@
 
 	/* NB: The callback connection is slotted for removal */
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) {
 		printf(NAME ": Failed to create callback from device\n");
@@ -104,5 +104,5 @@
 		int retval;
 
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/* TODO: Handle hangup */
Index: uspace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/console/console.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -74,7 +74,7 @@
 struct {
 	int phone;           /**< Framebuffer phone */
-	ipcarg_t cols;       /**< Framebuffer columns */
-	ipcarg_t rows;       /**< Framebuffer rows */
-	ipcarg_t color_cap;  /**< Color capabilities (FB_CCAP_xxx) */
+	sysarg_t cols;       /**< Framebuffer columns */
+	sysarg_t rows;       /**< Framebuffer rows */
+	sysarg_t color_cap;  /**< Color capabilities (FB_CCAP_xxx) */
 } fb_info;
 
@@ -101,7 +101,7 @@
 /** Information on row-span yet unsent to FB driver. */
 struct {
-	ipcarg_t col;  /**< Leftmost column of the span. */
-	ipcarg_t row;  /**< Row where the span lies. */
-	ipcarg_t cnt;  /**< Width of the span. */
+	sysarg_t col;  /**< Leftmost column of the span. */
+	sysarg_t row;  /**< Row where the span lies. */
+	sysarg_t cnt;  /**< Width of the span. */
 } fb_pending;
 
@@ -119,5 +119,5 @@
 }
 
-static void curs_goto(ipcarg_t x, ipcarg_t y)
+static void curs_goto(sysarg_t x, sysarg_t y)
 {
 	async_msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y);
@@ -180,5 +180,5 @@
 }
 
-static int ccap_fb_to_con(ipcarg_t ccap_fb, ipcarg_t *ccap_con)
+static int ccap_fb_to_con(sysarg_t ccap_fb, sysarg_t *ccap_con)
 {
 	switch (ccap_fb) {
@@ -203,9 +203,9 @@
 
 /** Send an area of screenbuffer to the FB driver. */
-static void fb_update_area(console_t *cons, ipcarg_t x0, ipcarg_t y0, ipcarg_t width, ipcarg_t height)
+static void fb_update_area(console_t *cons, sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height)
 {
 	if (interbuffer) {
-		ipcarg_t x;
-		ipcarg_t y;
+		sysarg_t x;
+		sysarg_t y;
 		
 		for (y = 0; y < height; y++) {
@@ -237,5 +237,5 @@
  *
  */
-static void cell_mark_changed(ipcarg_t col, ipcarg_t row)
+static void cell_mark_changed(sysarg_t col, sysarg_t row)
 {
 	if (fb_pending.cnt != 0) {
@@ -255,5 +255,5 @@
 
 /** Print a character to the active VC with buffering. */
-static void fb_putchar(wchar_t c, ipcarg_t col, ipcarg_t row)
+static void fb_putchar(wchar_t c, sysarg_t col, sysarg_t row)
 {
 	async_msg_3(fb_info.phone, FB_PUTCHAR, c, col, row);
@@ -352,6 +352,6 @@
 		curs_visibility(false);
 		
-		ipcarg_t x;
-		ipcarg_t y;
+		sysarg_t x;
+		sysarg_t y;
 		int rc = 0;
 		
@@ -408,5 +408,5 @@
 		console_event_t ev;
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/* TODO: Handle hangup */
@@ -451,5 +451,5 @@
 		int retval;
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/* TODO: Handle hangup */
@@ -584,7 +584,7 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t arg1;
-	ipcarg_t arg2;
-	ipcarg_t arg3;
+	sysarg_t arg1;
+	sysarg_t arg2;
+	sysarg_t arg3;
 	
 	int rc;
@@ -608,5 +608,5 @@
 		arg3 = 0;
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			cons->refcount--;
@@ -726,5 +726,5 @@
 	
 	/* NB: The callback connection is slotted for removal */
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) {
 		printf(NAME ": Failed to create callback from input device\n");
@@ -804,5 +804,5 @@
 			if (screenbuffer_init(&consoles[i].scr,
 			    fb_info.cols, fb_info.rows) == NULL) {
-				printf(NAME ": Unable to allocate screen buffer %u\n", i);
+				printf(NAME ": Unable to allocate screen buffer %zu\n", i);
 				return false;
 			}
@@ -813,5 +813,5 @@
 			
 			char vc[DEVMAP_NAME_MAXLEN + 1];
-			snprintf(vc, DEVMAP_NAME_MAXLEN, "%s/vc%u", NAMESPACE, i);
+			snprintf(vc, DEVMAP_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i);
 			
 			if (devmap_device_register(vc, &consoles[i].devmap_handle) != EOK) {
Index: uspace/srv/hid/console/gcons.c
===================================================================
--- uspace/srv/hid/console/gcons.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/console/gcons.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -82,6 +82,6 @@
 
 static bool use_gcons = false;
-static ipcarg_t xres;
-static ipcarg_t yres;
+static sysarg_t xres;
+static sysarg_t yres;
 
 enum butstate {
@@ -107,10 +107,10 @@
 static size_t active_console = 0;
 
-static ipcarg_t mouse_x = 0;
-static ipcarg_t mouse_y= 0;
+static sysarg_t mouse_x = 0;
+static sysarg_t mouse_y= 0;
 
 static bool btn_pressed = false;
-static ipcarg_t btn_x = 0;
-static ipcarg_t btn_y = 0;
+static sysarg_t btn_x = 0;
+static sysarg_t btn_y = 0;
 
 static void vp_switch(int vp)
@@ -120,5 +120,5 @@
 
 /** Create view port */
-static int vp_create(ipcarg_t x, ipcarg_t y, ipcarg_t width, ipcarg_t height)
+static int vp_create(sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
 {
 	return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,
@@ -137,5 +137,5 @@
 
 /** Transparent putchar */
-static void tran_putch(wchar_t ch, ipcarg_t col, ipcarg_t row)
+static void tran_putch(wchar_t ch, sysarg_t col, sysarg_t row)
 {
 	async_msg_3(fbphone, FB_PUTCHAR, ch, col, row);
@@ -157,5 +157,5 @@
 		
 		char data[5];
-		snprintf(data, 5, "%u", index + 1);
+		snprintf(data, 5, "%zu", index + 1);
 		
 		size_t i;
@@ -297,7 +297,7 @@
 }
 
-static int gcons_find_conbut(ipcarg_t x, ipcarg_t y)
-{
-	ipcarg_t status_start = STATUS_START + (xres - 800) / 2;
+static int gcons_find_conbut(sysarg_t x, sysarg_t y)
+{
+	sysarg_t status_start = STATUS_START + (xres - 800) / 2;
 	
 	if ((y < STATUS_TOP) || (y >= STATUS_TOP + STATUS_HEIGHT))
@@ -313,5 +313,5 @@
 		return -1;
 	
-	ipcarg_t btn = (x - status_start) / (STATUS_WIDTH + STATUS_SPACE);
+	sysarg_t btn = (x - status_start) / (STATUS_WIDTH + STATUS_SPACE);
 	
 	if (btn < CONSOLE_COUNT)
@@ -363,5 +363,5 @@
  *
  */
-static void draw_pixmap(char *logo, size_t size, ipcarg_t x, ipcarg_t y)
+static void draw_pixmap(char *logo, size_t size, sysarg_t x, sysarg_t y)
 {
 	/* Create area */
@@ -374,5 +374,5 @@
 	
 	/* Send area */
-	int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
+	int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);
 	if (rc)
 		goto exit;
@@ -436,5 +436,5 @@
 	
 	/* Send area */
-	int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
+	int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);
 	if (rc)
 		goto exit;
@@ -513,5 +513,5 @@
 	
 	/* Create status buttons */
-	ipcarg_t status_start = STATUS_START + (xres - 800) / 2;
+	sysarg_t status_start = STATUS_START + (xres - 800) / 2;
 	size_t i;
 	for (i = 0; i < CONSOLE_COUNT; i++) {
Index: uspace/srv/hid/fb/ega.c
===================================================================
--- uspace/srv/hid/fb/ega.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/fb/ega.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -230,5 +230,5 @@
 static int save_screen(void)
 {
-	ipcarg_t i;
+	sysarg_t i;
 	
 	/* Find empty screen */
@@ -245,5 +245,5 @@
 }
 
-static int print_screen(ipcarg_t i)
+static int print_screen(sysarg_t i)
 {
 	if ((i >= MAX_SAVED_SCREENS) || (saved_screens[i].data))
@@ -276,8 +276,8 @@
 		wchar_t c;
 		
-		ipcarg_t col;
-		ipcarg_t row;
-		ipcarg_t w;
-		ipcarg_t h;
+		sysarg_t col;
+		sysarg_t row;
+		sysarg_t w;
+		sysarg_t h;
 		
 		ssize_t rows;
@@ -290,8 +290,8 @@
 		uint32_t bg_rgb;
 		
-		ipcarg_t scr;
+		sysarg_t scr;
 		int retval;
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			client_connected = 0;
@@ -370,10 +370,10 @@
 			
 			if (rows >= 0) {
-				if ((ipcarg_t) rows > scr_height) {
+				if ((sysarg_t) rows > scr_height) {
 					retval = EINVAL;
 					break;
 				}
 			} else {
-				if ((ipcarg_t) (-rows) > scr_height) {
+				if ((sysarg_t) (-rows) > scr_height) {
 					retval = EINVAL;
 					break;
Index: uspace/srv/hid/fb/fb.c
===================================================================
--- uspace/srv/hid/fb/fb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/fb/fb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -199,9 +199,9 @@
 static int rgb_from_attr(attr_rgb_t *rgb, const attrs_t *a);
 static int rgb_from_style(attr_rgb_t *rgb, int style);
-static int rgb_from_idx(attr_rgb_t *rgb, ipcarg_t fg_color,
-    ipcarg_t bg_color, ipcarg_t flags);
-
-static int fb_set_color(viewport_t *vport, ipcarg_t fg_color,
-    ipcarg_t bg_color, ipcarg_t attr);
+static int rgb_from_idx(attr_rgb_t *rgb, sysarg_t fg_color,
+    sysarg_t bg_color, sysarg_t flags);
+
+static int fb_set_color(viewport_t *vport, sysarg_t fg_color,
+    sysarg_t bg_color, sysarg_t attr);
 
 static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
@@ -1072,5 +1072,5 @@
 	
 	static unsigned char *shm = NULL;
-	static ipcarg_t shm_id = 0;
+	static sysarg_t shm_id = 0;
 	static size_t shm_size;
 	
@@ -1083,5 +1083,5 @@
 	unsigned int h;
 	
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_SHARE_OUT:
 		/* We accept one area for data interchange */
@@ -1360,5 +1360,5 @@
 	int newval;
 	
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case FB_ANIM_CREATE:
 		nvp = IPC_GET_ARG1(*call);
@@ -1435,5 +1435,5 @@
 			break;
 		}
-		newval = (IPC_GET_METHOD(*call) == FB_ANIM_START);
+		newval = (IPC_GET_IMETHOD(*call) == FB_ANIM_START);
 		if (newval ^ animations[i].enabled) {
 			animations[i].enabled = newval;
@@ -1459,5 +1459,5 @@
 	int i, nvp;
 	
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case FB_VP_DRAW_PIXMAP:
 		nvp = IPC_GET_ARG1(*call);
@@ -1529,6 +1529,6 @@
 }
 
-static int rgb_from_idx(attr_rgb_t *rgb, ipcarg_t fg_color,
-    ipcarg_t bg_color, ipcarg_t flags)
+static int rgb_from_idx(attr_rgb_t *rgb, sysarg_t fg_color,
+    sysarg_t bg_color, sysarg_t flags)
 {
 	fg_color = (fg_color & 7) | ((flags & CATTR_BRIGHT) ? 8 : 0);
@@ -1562,11 +1562,11 @@
 }
 
-static int fb_set_style(viewport_t *vport, ipcarg_t style)
+static int fb_set_style(viewport_t *vport, sysarg_t style)
 {
 	return rgb_from_style(&vport->attr, (int) style);
 }
 
-static int fb_set_color(viewport_t *vport, ipcarg_t fg_color,
-    ipcarg_t bg_color, ipcarg_t flags)
+static int fb_set_color(viewport_t *vport, sysarg_t fg_color,
+    sysarg_t bg_color, sysarg_t flags)
 {
 	return rgb_from_idx(&vport->attr, fg_color, bg_color, flags);
@@ -1621,5 +1621,5 @@
 			continue;
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			client_connected = false;
Index: uspace/srv/hid/fb/main.c
===================================================================
--- uspace/srv/hid/fb/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/fb/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -114,5 +114,5 @@
 		return -1;
 	
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	if (ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, 0, &phonead) != 0) 
 		return -1;
Index: uspace/srv/hid/fb/serial_console.c
===================================================================
--- uspace/srv/hid/fb/serial_console.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/fb/serial_console.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -47,4 +47,5 @@
 #include <io/style.h>
 #include <str.h>
+#include <inttypes.h>
 #include <io/screenbuffer.h>
 
@@ -54,12 +55,12 @@
 #define MAX_CONTROL 20
 
-static ipcarg_t scr_width;
-static ipcarg_t scr_height;
+static sysarg_t scr_width;
+static sysarg_t scr_height;
 static bool color = true;    /**< True if producing color output. */
 static bool utf8 = false;    /**< True if producing UTF8 output. */
 static putc_function_t putc_function;
 
-static ipcarg_t lastcol = 0;
-static ipcarg_t lastrow = 0;
+static sysarg_t lastcol = 0;
+static sysarg_t lastrow = 0;
 static attrs_t cur_attr = {
 	.t = at_style,
@@ -129,5 +130,5 @@
 }
 
-void serial_goto(const ipcarg_t col, const ipcarg_t row)
+void serial_goto(const sysarg_t col, const sysarg_t row)
 {
 	if ((col > scr_width) || (row > scr_height))
@@ -135,5 +136,6 @@
 	
 	char control[MAX_CONTROL];
-	snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1);
+	snprintf(control, MAX_CONTROL, "\033[%" PRIun ";%" PRIun "f",
+	    row + 1, col + 1);
 	serial_puts(control);
 }
@@ -250,8 +252,8 @@
 
 /** Set scrolling region. */
-void serial_set_scroll_region(ipcarg_t last_row)
+void serial_set_scroll_region(sysarg_t last_row)
 {
 	char control[MAX_CONTROL];
-	snprintf(control, MAX_CONTROL, "\033[0;%ur", last_row);
+	snprintf(control, MAX_CONTROL, "\033[0;%" PRIun "r", last_row);
 	serial_puts(control);
 }
@@ -267,5 +269,5 @@
 }
 
-void serial_console_init(putc_function_t putc_fn, ipcarg_t w, ipcarg_t h)
+void serial_console_init(putc_function_t putc_fn, sysarg_t w, sysarg_t h)
 {
 	scr_width = w;
@@ -284,15 +286,15 @@
  *
  */
-static void draw_text_data(keyfield_t *data, ipcarg_t x0, ipcarg_t y0,
-    ipcarg_t width, ipcarg_t height)
+static void draw_text_data(keyfield_t *data, sysarg_t x0, sysarg_t y0,
+    sysarg_t width, sysarg_t height)
 {
 	attrs_t *a0 = &data[0].attrs;
 	serial_set_attrs(a0);
 	
-	ipcarg_t y;
+	sysarg_t y;
 	for (y = 0; y < height; y++) {
 		serial_goto(x0, y0 + y);
 		
-		ipcarg_t x;
+		sysarg_t x;
 		for (x = 0; x < width; x++) {
 			attrs_t *attr = &data[y * width + x].attrs;
@@ -335,13 +337,13 @@
 		
 		wchar_t c;
-		ipcarg_t col;
-		ipcarg_t row;
-		ipcarg_t w;
-		ipcarg_t h;
+		sysarg_t col;
+		sysarg_t row;
+		sysarg_t w;
+		sysarg_t h;
 		ssize_t rows;
 		
 		int retval;
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			client_connected = 0;
@@ -440,10 +442,10 @@
 			
 			if (rows >= 0) {
-				if ((ipcarg_t) rows > scr_height) {
+				if ((sysarg_t) rows > scr_height) {
 					retval = EINVAL;
 					break;
 				}
 			} else {
-				if ((ipcarg_t) (-rows) > scr_height) {
+				if ((sysarg_t) (-rows) > scr_height) {
 					retval = EINVAL;
 					break;
Index: uspace/srv/hid/fb/serial_console.h
===================================================================
--- uspace/srv/hid/fb/serial_console.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/fb/serial_console.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -44,11 +44,11 @@
 
 extern void serial_puts(const char *);
-extern void serial_goto(const ipcarg_t, const ipcarg_t);
+extern void serial_goto(const sysarg_t, const sysarg_t);
 extern void serial_clrscr(void);
 extern void serial_scroll(ssize_t);
 extern void serial_cursor_disable(void);
 extern void serial_cursor_enable(void);
-extern void serial_set_scroll_region(ipcarg_t);
-extern void serial_console_init(putc_function_t, ipcarg_t, ipcarg_t);
+extern void serial_set_scroll_region(sysarg_t);
+extern void serial_console_init(putc_function_t, sysarg_t, sysarg_t);
 extern void serial_client_connection(ipc_callid_t, ipc_call_t *);
 
Index: uspace/srv/hid/kbd/genarch/gsp.c
===================================================================
--- uspace/srv/hid/kbd/genarch/gsp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/kbd/genarch/gsp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -198,6 +198,6 @@
 	if (t == NULL) {
 		printf("gsp_step: not found\n");
-		*mods = NULL;
-		*key = NULL;
+		*mods = 0;
+		*key = 0;
 		return 0;
 	}
Index: uspace/srv/hid/kbd/generic/kbd.c
===================================================================
--- uspace/srv/hid/kbd/generic/kbd.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/kbd/generic/kbd.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -177,5 +177,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			if (client_phone != -1) {
Index: uspace/srv/hid/kbd/port/adb.c
===================================================================
--- uspace/srv/hid/kbd/port/adb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/kbd/port/adb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -71,5 +71,5 @@
 
 	/* NB: The callback connection is slotted for removal */
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) {
 		printf(NAME ": Failed to create callback from device\n");
@@ -105,5 +105,5 @@
 		int retval;
 
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/* TODO: Handle hangup */
Index: uspace/srv/hid/kbd/port/chardev.c
===================================================================
--- uspace/srv/hid/kbd/port/chardev.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/kbd/port/chardev.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -91,5 +91,5 @@
 
 	/* NB: The callback connection is slotted for removal */
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) {
 		printf(NAME ": Failed to create callback from device\n");
@@ -125,5 +125,5 @@
 		int retval;
 
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			/* TODO: Handle hangup */
Index: uspace/srv/hid/kbd/port/ns16550.c
===================================================================
--- uspace/srv/hid/kbd/port/ns16550.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/kbd/port/ns16550.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -123,5 +123,5 @@
 	if (cir_service)
 		async_msg_1(cir_phone, BUS_CLEAR_INTERRUPT,
-		    IPC_GET_METHOD(*call));
+		    IPC_GET_IMETHOD(*call));
 }
 
Index: uspace/srv/hid/kbd/port/z8530.c
===================================================================
--- uspace/srv/hid/kbd/port/z8530.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/kbd/port/z8530.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -111,5 +111,5 @@
 	if (cir_service)
 		async_msg_1(cir_phone, BUS_CLEAR_INTERRUPT,
-		    IPC_GET_METHOD(*call));
+		    IPC_GET_IMETHOD(*call));
 }
 
Index: uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
===================================================================
--- uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -50,4 +50,5 @@
 #include <sysinfo.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include "s3c24xx_ts.h"
@@ -136,6 +137,6 @@
 	ts->last_y = 0;
 
-	printf(NAME ": device at physical address 0x%x, inr %d.\n",
-	    ts->paddr, inr);
+	printf(NAME ": device at physical address %p, inr %" PRIun ".\n",
+	    (void *) ts->paddr, inr);
 
 	async_set_interrupt_received(s3c24xx_ts_irq_handler);
@@ -381,5 +382,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			if (ts->client_phone != -1) {
Index: uspace/srv/hw/bus/cuda_adb/cuda_adb.c
===================================================================
--- uspace/srv/hw/bus/cuda_adb/cuda_adb.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/bus/cuda_adb/cuda_adb.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -195,5 +195,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	devmap_handle_t dh;
 	int retval;
@@ -220,5 +220,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
Index: uspace/srv/hw/char/i8042/i8042.c
===================================================================
--- uspace/srv/hw/char/i8042/i8042.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/char/i8042/i8042.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,4 +46,5 @@
 #include <stdio.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include "i8042.h"
@@ -201,5 +202,6 @@
 	ipc_register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd);
 	ipc_register_irq(inr_b, device_assign_devno(), 0, &i8042_kbd);
-	printf("%s: registered for interrupts %d and %d\n", NAME, inr_a, inr_b);
+	printf("%s: registered for interrupts %" PRIun " and %" PRIun "\n",
+	    NAME, inr_a, inr_b);
 
 	wait_ready();
@@ -217,5 +219,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	devmap_handle_t dh;
 	int retval;
@@ -246,5 +248,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
@@ -262,5 +264,5 @@
 			break;
 		case IPC_FIRST_USER_METHOD:
-			printf(NAME ": write %d to devid %d\n",
+			printf(NAME ": write %" PRIun " to devid %d\n",
 			    IPC_GET_ARG1(call), dev_id);
 			i8042_port_write(dev_id, IPC_GET_ARG1(call));
Index: uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
===================================================================
--- uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -48,4 +48,5 @@
 #include <sysinfo.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include "s3c24xx_uart.h"
@@ -95,5 +96,6 @@
 	if (rc != EOK) {
 		devmap_hangup_phone(DEVMAP_DRIVER);
-		printf(NAME ": Unable to register device %s.\n");
+		printf(NAME ": Unable to register device %s.\n",
+		    NAMESPACE "/" NAME);
 		return -1;
 	}
@@ -114,5 +116,5 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
-	ipcarg_t method;
+	sysarg_t method;
 	int retval;
 
@@ -122,5 +124,5 @@
 	while (1) {
 		callid = async_get_call(&call);
-		method = IPC_GET_METHOD(call);
+		method = IPC_GET_IMETHOD(call);
 		switch (method) {
 		case IPC_M_PHONE_HUNGUP:
@@ -134,5 +136,5 @@
 			break;
 		case CHAR_WRITE_BYTE:
-			printf(NAME ": write %d to device\n",
+			printf(NAME ": write %" PRIun " to device\n",
 			    IPC_GET_ARG1(call));
 			s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call));
@@ -185,6 +187,6 @@
 	uart->client_phone = -1;
 
-	printf(NAME ": device at physical address 0x%x, inr %d.\n",
-	    uart->paddr, inr);
+	printf(NAME ": device at physical address %p, inr %" PRIun ".\n",
+	    (void *) uart->paddr, inr);
 
 	async_set_interrupt_received(s3c24xx_uart_irq_handler);
Index: uspace/srv/hw/cir/fhc/fhc.c
===================================================================
--- uspace/srv/hw/cir/fhc/fhc.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/cir/fhc/fhc.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -82,5 +82,5 @@
 	
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case BUS_CLEAR_INTERRUPT:
 			inr = IPC_GET_ARG1(call);
@@ -129,9 +129,9 @@
 	}
 	
-	printf(NAME ": FHC UART registers at %p, %d bytes\n", fhc_uart_phys,
+	printf(NAME ": FHC UART registers at %p, %zu bytes\n", fhc_uart_phys,
 	    fhc_uart_size);
 	
 	async_set_client_connection(fhc_connection);
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	ipc_connect_to_me(PHONE_NS, SERVICE_FHC, 0, 0, &phonead);
 	
Index: uspace/srv/hw/cir/obio/obio.c
===================================================================
--- uspace/srv/hw/cir/obio/obio.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/cir/obio/obio.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -92,5 +92,5 @@
 	
 		callid = async_get_call(&call);
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case BUS_CLEAR_INTERRUPT:
 			inr = IPC_GET_ARG1(call);
@@ -134,5 +134,5 @@
 	
 	async_set_client_connection(obio_connection);
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	ipc_connect_to_me(PHONE_NS, SERVICE_OBIO, 0, 0, &phonead);
 	
Index: uspace/srv/hw/netif/dp8390/Makefile
===================================================================
--- uspace/srv/hw/netif/dp8390/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/netif/dp8390/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,8 +39,4 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	LIBS += $(USPACE_PREFIX)/srv/net/nil/eth/libeth.a
-endif
-
 BINARY = dp8390
 
Index: uspace/srv/hw/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/netif/dp8390/dp8390.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,5 +65,5 @@
  *  @return EINVAL 
  */
-int queue_packet(dpeth_t * dep, packet_t packet);
+int queue_packet(dpeth_t * dep, packet_t *packet);
 
 /** Reads a memory block byte by byte.
@@ -336,6 +336,6 @@
 }
 
-int queue_packet(dpeth_t * dep, packet_t packet){
-	packet_t tmp;
+int queue_packet(dpeth_t * dep, packet_t *packet){
+	packet_t *tmp;
 
 	if(dep->packet_count >= MAX_PACKETS){
@@ -361,5 +361,5 @@
  *			based on	do_vwrite				     *
  *===========================================================================*/
-int do_pwrite(dpeth_t * dep, packet_t packet, int from_int)
+int do_pwrite(dpeth_t * dep, packet_t *packet, int from_int)
 {
 //	int port, count, size;
@@ -432,5 +432,5 @@
 	dep->de_write_iovec.iod_iovec[0].iov_size = size;
 	dep->de_write_iovec.iod_iovec_s = 1;
-	dep->de_write_iovec.iod_iovec_addr = NULL;
+	dep->de_write_iovec.iod_iovec_addr = (uintptr_t) NULL;
 
 	if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
@@ -910,5 +910,5 @@
 dpeth_t *dep;
 {
-	packet_t packet;
+	packet_t *packet;
 
 //	if (!(dep->de_flags &DEF_SEND_AVAIL))
@@ -1003,5 +1003,5 @@
 {
 	int last, count;
-	packet_t packet;
+	packet_t *packet;
 
 //	if (!(dep->de_flags &DEF_READING))
@@ -1015,5 +1015,5 @@
 	dep->de_read_iovec.iod_iovec[0].iov_size = length;
 	dep->de_read_iovec.iod_iovec_s = 1;
-	dep->de_read_iovec.iod_iovec_addr = NULL;
+	dep->de_read_iovec.iod_iovec_addr = (uintptr_t) NULL;
 
 	last = page + (length - 1) / DP_PAGESIZE;
@@ -1516,6 +1516,6 @@
 	if (!wdeth_probe(dep) && !ne_probe(dep) && !el2_probe(dep))
 	{
-		printf("%s: No ethernet card found at 0x%x\n", 
-			dep->de_name, dep->de_base_port);
+		printf("%s: No ethernet card found at %#lx\n",
+		    dep->de_name, dep->de_base_port);
 		dep->de_mode= DEM_DISABLED;
 		return;
Index: uspace/srv/hw/netif/dp8390/dp8390.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/netif/dp8390/dp8390.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -313,5 +313,5 @@
 	/** Outgoing packets queue.
 	 */
-	packet_t packet_queue;
+	packet_t *packet_queue;
 	/** Outgoing packets count.
 	 */
@@ -320,5 +320,5 @@
 	/** Received packets queue.
 	 */
-	packet_t received_queue;
+	packet_t *received_queue;
 	/** Received packets count.
 	 */
Index: uspace/srv/hw/netif/dp8390/dp8390_drv.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_drv.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/netif/dp8390/dp8390_drv.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -72,5 +72,5 @@
  *  @returns 
  */
-int do_pwrite(dpeth_t * dep, packet_t packet, int from_int);
+int do_pwrite(dpeth_t * dep, packet_t *packet, int from_int);
 
 /** Prints out network interface information.
Index: uspace/srv/hw/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -63,5 +63,5 @@
  *  @param[in] call The interrupt call.
  */
-#define IRQ_GET_DEVICE(call)			(device_id_t) IPC_GET_METHOD(*call)
+#define IRQ_GET_DEVICE(call)			(device_id_t) IPC_GET_IMETHOD(*call)
 
 /** Returns the interrupt status register from the interrupt call.
@@ -103,5 +103,5 @@
 	netif_device_t * device;
 	dpeth_t * dep;
-	packet_t received;
+	packet_t *received;
 	device_id_t device_id;
 	int phone;
@@ -127,5 +127,5 @@
 		dep->received_count = 0;
 		fibril_rwlock_write_unlock(&netif_globals.lock);
-		nil_received_msg(phone, device_id, received, NULL);
+		nil_received_msg(phone, device_id, received, SERVICE_NONE);
 	}else{
 		fibril_rwlock_write_unlock(&netif_globals.lock);
@@ -197,5 +197,5 @@
 		return rc;
 	address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
-	address->length = CONVERT_SIZE(ether_addr_t, char, 1);
+	address->length = sizeof(ether_addr_t);
 	return EOK;
 }
@@ -247,8 +247,8 @@
 }
 
-int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){
-	netif_device_t * device;
-	dpeth_t * dep;
-	packet_t next;
+int netif_send_message(device_id_t device_id, packet_t *packet, services_t sender){
+	netif_device_t * device;
+	dpeth_t * dep;
+	packet_t *next;
 	int rc;
 
@@ -306,9 +306,9 @@
 
 int netif_initialize(void){
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 
 	async_set_interrupt_received(irq_handler);
 
-	return REGISTER_ME(SERVICE_DP8390, &phonehash);
+	return ipc_connect_to_me(PHONE_NS, SERVICE_DP8390, 0, 0, &phonehash);
 }
 
@@ -343,5 +343,5 @@
 		
 		/* End if said to either by the message or the processing result */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
 			return;
 		
Index: uspace/srv/hw/netif/dp8390/ne2000.c
===================================================================
--- uspace/srv/hw/netif/dp8390/ne2000.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/hw/netif/dp8390/ne2000.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -267,14 +267,14 @@
 	if (!debug)
 	{
-		printf("%s: NE%d000 at %X:%d\n",
-			dep->de_name, dep->de_16bit ? 2 : 1,
-			dep->de_base_port, dep->de_irq);
+		printf("%s: NE%d000 at %#lx:%d\n",
+		    dep->de_name, dep->de_16bit ? 2 : 1,
+		    dep->de_base_port, dep->de_irq);
 	}
 	else
 	{
 		printf("%s: Novell NE%d000 ethernet card at I/O address "
-			"0x%X, memory size 0x%X, irq %d\n",
-			dep->de_name, dep->de_16bit ? 2 : 1,
-			dep->de_base_port, dep->de_ramsize, dep->de_irq);
+		    "%#lx, memory size %#lx, irq %d\n",
+		    dep->de_name, dep->de_16bit ? 2 : 1,
+		    dep->de_base_port, dep->de_ramsize, dep->de_irq);
 	}
 }
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/loader/main.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -383,5 +383,5 @@
 		callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			exit(0);
@@ -411,8 +411,7 @@
 			break;
 		}
-		if ((callid & IPC_CALLID_NOTIFICATION) == 0 &&
-		    IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) {
+		if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP) {
 			DPRINTF("Responding EINVAL to method %d.\n",
-			    IPC_GET_METHOD(call));
+			    IPC_GET_IMETHOD(call));
 			ipc_answer_0(callid, EINVAL);
 		}
@@ -424,5 +423,5 @@
 int main(int argc, char *argv[])
 {
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	task_id_t id;
 	int rc;
Index: uspace/srv/net/cfg/Makefile
===================================================================
--- uspace/srv/net/cfg/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/cfg/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -36,11 +36,6 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	LO_SOURCE = lo.netif_nil_bundle
-	NE2K_SOURCE = ne2k.netif_nil_bundle
-else
-	LO_SOURCE = lo.netif_standalone
-	NE2K_SOURCE = ne2k.netif_standalone
-endif
+LO_SOURCE = lo.netif_standalone
+NE2K_SOURCE = ne2k.netif_standalone
 
 LO_TARGET = lo
Index: pace/srv/net/cfg/lo.netif_nil_bundle
===================================================================
--- uspace/srv/net/cfg/lo.netif_nil_bundle	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# loopback configuration
-
-NAME=lo
-
-NETIF=lo
-NIL=lo
-IL=ip
-
-IP_CONFIG=static
-IP_ADDR=127.0.0.1
-IP_NETMASK=255.0.0.0
-
-MTU=15535
Index: pace/srv/net/cfg/ne2k.netif_nil_bundle
===================================================================
--- uspace/srv/net/cfg/ne2k.netif_nil_bundle	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ 	(revision )
@@ -1,24 +1,0 @@
-# DP8390 (NE2k) configuration
-
-NAME=ne2k
-
-NETIF=dp8390
-NIL=dp8390
-IL=ip
-
-IRQ=9
-IO=300
-
-# 8023_2_LSAP, 8023_2_SNAP
-ETH_MODE=DIX
-ETH_DUMMY=no
-
-IP_CONFIG=static
-IP_ADDR=10.0.2.15
-IP_ROUTING=yes
-IP_NETMASK=255.255.255.240
-IP_BROADCAST=10.0.2.255
-IP_GATEWAY=10.0.2.2
-ARP=arp
-
-MTU=1492
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/il/arp/arp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -72,4 +72,7 @@
 #define NAME  "arp"
 
+/** Number of microseconds to wait for an ARP reply. */
+#define ARP_TRANS_WAIT	1000000
+
 /** ARP global data. */
 arp_globals_t arp_globals;
@@ -77,5 +80,27 @@
 DEVICE_MAP_IMPLEMENT(arp_cache, arp_device_t);
 INT_MAP_IMPLEMENT(arp_protos, arp_proto_t);
-GENERIC_CHAR_MAP_IMPLEMENT(arp_addr, measured_string_t);
+GENERIC_CHAR_MAP_IMPLEMENT(arp_addr, arp_trans_t);
+
+static void arp_clear_trans(arp_trans_t *trans)
+{
+	if (trans->hw_addr) {
+		free(trans->hw_addr);
+		trans->hw_addr = NULL;
+	}
+	fibril_condvar_broadcast(&trans->cv);
+}
+
+static void arp_clear_addr(arp_addr_t *addresses)
+{
+	int count;
+	arp_trans_t *trans;
+
+	for (count = arp_addr_count(addresses) - 1; count >= 0; count--) {
+		trans = arp_addr_items_get_index(&addresses->values, count);
+		if (trans)
+			arp_clear_trans(trans);
+	}
+}
+
 
 /** Clears the device specific data.
@@ -96,4 +121,5 @@
 			if (proto->addr_data)
 				free(proto->addr_data);
+			arp_clear_addr(&proto->addresses);
 			arp_addr_destroy(&proto->addresses);
 		}
@@ -107,5 +133,5 @@
 	arp_device_t *device;
 
-	fibril_rwlock_write_lock(&arp_globals.lock);
+	fibril_mutex_lock(&arp_globals.lock);
 	for (count = arp_cache_count(&arp_globals.cache) - 1; count >= 0;
 	    count--) {
@@ -120,5 +146,5 @@
 	}
 	arp_cache_clear(&arp_globals.cache);
-	fibril_rwlock_write_unlock(&arp_globals.lock);
+	fibril_mutex_unlock(&arp_globals.lock);
 	printf("Cache cleaned\n");
 	return EOK;
@@ -130,18 +156,22 @@
 	arp_device_t *device;
 	arp_proto_t *proto;
-
-	fibril_rwlock_write_lock(&arp_globals.lock);
+	arp_trans_t *trans;
+
+	fibril_mutex_lock(&arp_globals.lock);
 	device = arp_cache_find(&arp_globals.cache, device_id);
 	if (!device) {
-		fibril_rwlock_write_unlock(&arp_globals.lock);
+		fibril_mutex_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
 	proto = arp_protos_find(&device->protos, protocol);
 	if (!proto) {
-		fibril_rwlock_write_unlock(&arp_globals.lock);
+		fibril_mutex_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
+	trans = arp_addr_find(&proto->addresses, address->value, address->length);
+	if (trans)
+		arp_clear_trans(trans);
 	arp_addr_exclude(&proto->addresses, address->value, address->length);
-	fibril_rwlock_write_unlock(&arp_globals.lock);
+	fibril_mutex_unlock(&arp_globals.lock);
 	return EOK;
 }
@@ -152,13 +182,13 @@
 	arp_device_t *device;
 
-	fibril_rwlock_write_lock(&arp_globals.lock);
+	fibril_mutex_lock(&arp_globals.lock);
 	device = arp_cache_find(&arp_globals.cache, device_id);
 	if (!device) {
-		fibril_rwlock_write_unlock(&arp_globals.lock);
+		fibril_mutex_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
 	arp_clear_device(device);
 	printf("Device %d cleared\n", device_id);
-	fibril_rwlock_write_unlock(&arp_globals.lock);
+	fibril_mutex_unlock(&arp_globals.lock);
 	return EOK;
 }
@@ -221,5 +251,5 @@
 	int rc;
 
-	fibril_rwlock_write_lock(&arp_globals.lock);
+	fibril_mutex_lock(&arp_globals.lock);
 
 	/* An existing device? */
@@ -229,5 +259,5 @@
 		if (device->service != service) {
 			printf("Device %d already exists\n", device->device_id);
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			return EEXIST;
 		}
@@ -241,5 +271,5 @@
 			rc = arp_proto_create(&proto, protocol, address);
 			if (rc != EOK) {
-				fibril_rwlock_write_unlock(&arp_globals.lock);
+				fibril_mutex_unlock(&arp_globals.lock);
 				return rc;
 			}
@@ -247,5 +277,5 @@
 			    proto);
 			if (index < 0) {
-				fibril_rwlock_write_unlock(&arp_globals.lock);
+				fibril_mutex_unlock(&arp_globals.lock);
 				free(proto);
 				return index;
@@ -262,5 +292,5 @@
 		device = (arp_device_t *) malloc(sizeof(arp_device_t));
 		if (!device) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			return ENOMEM;
 		}
@@ -269,5 +299,5 @@
 		rc = arp_protos_initialize(&device->protos);
 		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			free(device);
 			return rc;
@@ -275,5 +305,5 @@
 		rc = arp_proto_create(&proto, protocol, address);
 		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			free(device);
 			return rc;
@@ -281,5 +311,5 @@
 		index = arp_protos_add(&device->protos, proto->service, proto);
 		if (index < 0) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			arp_protos_destroy(&device->protos);
 			free(device);
@@ -290,8 +320,8 @@
 		/* Bind the new one */
 		device->phone = nil_bind_service(device->service,
-		    (ipcarg_t) device->device_id, SERVICE_ARP,
+		    (sysarg_t) device->device_id, SERVICE_ARP,
 		    arp_globals.client_connection);
 		if (device->phone < 0) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			arp_protos_destroy(&device->protos);
 			free(device);
@@ -303,5 +333,5 @@
 		    &device->packet_dimension);
 		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			arp_protos_destroy(&device->protos);
 			free(device);
@@ -313,5 +343,5 @@
 		    &device->addr_data);
 		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			arp_protos_destroy(&device->protos);
 			free(device);
@@ -323,5 +353,5 @@
 		    &device->broadcast_addr, &device->broadcast_data);
 		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			free(device->addr);
 			free(device->addr_data);
@@ -334,5 +364,5 @@
 		    device);
 		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			free(device->addr);
 			free(device->addr_data);
@@ -347,5 +377,5 @@
 		    device->service, protocol);
 	}
-	fibril_rwlock_write_unlock(&arp_globals.lock);
+	fibril_mutex_unlock(&arp_globals.lock);
 	
 	return EOK;
@@ -363,9 +393,9 @@
 	int rc;
 
-	fibril_rwlock_initialize(&arp_globals.lock);
-	fibril_rwlock_write_lock(&arp_globals.lock);
+	fibril_mutex_initialize(&arp_globals.lock);
+	fibril_mutex_lock(&arp_globals.lock);
 	arp_globals.client_connection = client_connection;
 	rc = arp_cache_initialize(&arp_globals.cache);
-	fibril_rwlock_write_unlock(&arp_globals.lock);
+	fibril_mutex_unlock(&arp_globals.lock);
 	
 	return rc;
@@ -383,13 +413,13 @@
 	arp_device_t *device;
 
-	fibril_rwlock_write_lock(&arp_globals.lock);
+	fibril_mutex_lock(&arp_globals.lock);
 	device = arp_cache_find(&arp_globals.cache, device_id);
 	if (!device) {
-		fibril_rwlock_write_unlock(&arp_globals.lock);
+		fibril_mutex_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
 	device->packet_dimension.content = mtu;
-	fibril_rwlock_write_unlock(&arp_globals.lock);
-	printf("arp - device %d changed mtu to %d\n\n", device_id, mtu);
+	fibril_mutex_unlock(&arp_globals.lock);
+	printf("arp - device %d changed mtu to %zu\n\n", device_id, mtu);
 	return EOK;
 }
@@ -415,5 +445,5 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-static int arp_receive_message(device_id_t device_id, packet_t packet)
+static int arp_receive_message(device_id_t device_id, packet_t *packet)
 {
 	size_t length;
@@ -421,5 +451,5 @@
 	arp_device_t *device;
 	arp_proto_t *proto;
-	measured_string_t *hw_source;
+	arp_trans_t *trans;
 	uint8_t *src_hw;
 	uint8_t *src_proto;
@@ -452,34 +482,39 @@
 	des_hw = src_proto + header->protocol_length;
 	des_proto = des_hw + header->hardware_length;
-	hw_source = arp_addr_find(&proto->addresses, (char *) src_proto,
-	    CONVERT_SIZE(uint8_t, char, header->protocol_length));
+	trans = arp_addr_find(&proto->addresses, (char *) src_proto,
+	    header->protocol_length);
 	/* Exists? */
-	if (hw_source) {
-		if (hw_source->length != CONVERT_SIZE(uint8_t, char,
-		    header->hardware_length)) {
+	if (trans && trans->hw_addr) {
+		if (trans->hw_addr->length != header->hardware_length)
 			return EINVAL;
-		}
-		memcpy(hw_source->value, src_hw, hw_source->length);
+		memcpy(trans->hw_addr->value, src_hw, trans->hw_addr->length);
 	}
 	/* Is my protocol address? */
-	if (proto->addr->length != CONVERT_SIZE(uint8_t, char,
-	    header->protocol_length)) {
+	if (proto->addr->length != header->protocol_length)
 		return EINVAL;
-	}
 	if (!str_lcmp(proto->addr->value, (char *) des_proto,
 	    proto->addr->length)) {
 		/* Not already updated? */
-		if (!hw_source) {
-			hw_source = measured_string_create_bulk((char *) src_hw,
-			    CONVERT_SIZE(uint8_t, char,
-			    header->hardware_length));
-			if (!hw_source)
+		if (!trans) {
+			trans = (arp_trans_t *) malloc(sizeof(arp_trans_t));
+			if (!trans)
 				return ENOMEM;
-
+			trans->hw_addr = NULL;
+			fibril_condvar_initialize(&trans->cv);
 			rc = arp_addr_add(&proto->addresses, (char *) src_proto,
-			    CONVERT_SIZE(uint8_t, char,
-			    header->protocol_length), hw_source);
-			if (rc != EOK)
+			    header->protocol_length, trans);
+			if (rc != EOK) {
+				/* The generic char map has already freed trans! */
 				return rc;
+			}
+		}
+		if (!trans->hw_addr) {
+			trans->hw_addr = measured_string_create_bulk(
+			    (char *) src_hw, header->hardware_length);
+			if (!trans->hw_addr)
+				return ENOMEM;
+
+			/* Notify the fibrils that wait for the translation. */
+			fibril_condvar_broadcast(&trans->cv);
 		}
 		if (ntohs(header->operation) == ARPOP_REQUEST) {
@@ -490,5 +525,5 @@
 			memcpy(src_hw, device->addr->value,
 			    device->packet_dimension.addr_len);
-			memcpy(des_hw, hw_source->value,
+			memcpy(des_hw, trans->hw_addr->value,
 			    header->hardware_length);
 			
@@ -516,42 +551,56 @@
  * @param[in] protocol	The protocol service.
  * @param[in] target	The target protocol address.
- * @return		The hardware address of the target.
- * @return		NULL if the target parameter is NULL.
- * @return		NULL if the device is not found.
- * @return		NULL if the device packet is too small to send a
- *			request.
- * @return		NULL if the hardware address is not found in the cache.
- */
-static measured_string_t *
+ * @param[out] translation Where the hardware address of the target is stored.
+ * @return		EOK on success.
+ * @return		EAGAIN if the caller should try again.
+ * @return		Other error codes in case of error.
+ */
+static int
 arp_translate_message(device_id_t device_id, services_t protocol,
-    measured_string_t *target)
+    measured_string_t *target, measured_string_t **translation)
 {
 	arp_device_t *device;
 	arp_proto_t *proto;
-	measured_string_t *addr;
+	arp_trans_t *trans;
 	size_t length;
-	packet_t packet;
+	packet_t *packet;
 	arp_header_t *header;
-
-	if (!target)
-		return NULL;
+	bool retry = false;
+	int rc;
+
+restart:
+	if (!target || !translation)
+		return EBADMEM;
 
 	device = arp_cache_find(&arp_globals.cache, device_id);
 	if (!device)
-		return NULL;
+		return ENOENT;
 
 	proto = arp_protos_find(&device->protos, protocol);
 	if (!proto || (proto->addr->length != target->length))
-		return NULL;
-
-	addr = arp_addr_find(&proto->addresses, target->value, target->length);
-	if (addr)
-		return addr;
+		return ENOENT;
+
+	trans = arp_addr_find(&proto->addresses, target->value, target->length);
+	if (trans) {
+		if (trans->hw_addr) {
+			*translation = trans->hw_addr;
+			return EOK;
+		}
+		if (retry)
+			return EAGAIN;
+		rc = fibril_condvar_wait_timeout(&trans->cv, &arp_globals.lock,
+		    ARP_TRANS_WAIT);
+		if (rc == ETIMEOUT)
+			return ENOENT;
+		retry = true;
+		goto restart;
+	}
+	if (retry)
+		return EAGAIN;
 
 	/* ARP packet content size = header + (address + translation) * 2 */
-	length = 8 + 2 * (CONVERT_SIZE(char, uint8_t, proto->addr->length) +
-	    CONVERT_SIZE(char, uint8_t, device->addr->length));
+	length = 8 + 2 * (proto->addr->length + device->addr->length);
 	if (length > device->packet_dimension.content)
-		return NULL;
+		return ELIMIT;
 
 	packet = packet_get_4_remote(arp_globals.net_phone,
@@ -559,10 +608,10 @@
 	    length, device->packet_dimension.suffix);
 	if (!packet)
-		return NULL;
+		return ENOMEM;
 
 	header = (arp_header_t *) packet_suffix(packet, length);
 	if (!header) {
 		pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
-		return NULL;
+		return ENOMEM;
 	}
 
@@ -583,13 +632,31 @@
 	memcpy(((uint8_t *) header) + length, target->value, target->length);
 
-	if (packet_set_addr(packet, (uint8_t *) device->addr->value,
-	    (uint8_t *) device->broadcast_addr->value,
-	    CONVERT_SIZE(char, uint8_t, device->addr->length)) != EOK) {
+	rc = packet_set_addr(packet, (uint8_t *) device->addr->value,
+	    (uint8_t *) device->broadcast_addr->value, device->addr->length);
+	if (rc != EOK) {
 		pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
-		return NULL;
+		return rc;
 	}
 
 	nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
-	return NULL;
+
+	trans = (arp_trans_t *) malloc(sizeof(arp_trans_t));
+	if (!trans)
+		return ENOMEM;
+	trans->hw_addr = NULL;
+	fibril_condvar_initialize(&trans->cv);
+	rc = arp_addr_add(&proto->addresses, target->value, target->length,
+	    trans);
+	if (rc != EOK) {
+		/* The generic char map has already freed trans! */
+		return rc;
+	}
+	
+	rc = fibril_condvar_wait_timeout(&trans->cv, &arp_globals.lock,
+	    ARP_TRANS_WAIT);
+	if (rc == ETIMEOUT)
+		return ENOENT;
+	retry = true;
+	goto restart;
 }
 
@@ -615,10 +682,10 @@
 	measured_string_t *translation;
 	char *data;
-	packet_t packet;
-	packet_t next;
+	packet_t *packet;
+	packet_t *next;
 	int rc;
 	
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
@@ -642,15 +709,19 @@
 			return rc;
 		
-		fibril_rwlock_read_lock(&arp_globals.lock);
-		translation = arp_translate_message(IPC_GET_DEVICE(call),
-		    IPC_GET_SERVICE(call), address);
+		fibril_mutex_lock(&arp_globals.lock);
+		rc = arp_translate_message(IPC_GET_DEVICE(call),
+		    IPC_GET_SERVICE(call), address, &translation);
 		free(address);
 		free(data);
+		if (rc != EOK) {
+			fibril_mutex_unlock(&arp_globals.lock);
+			return rc;
+		}
 		if (!translation) {
-			fibril_rwlock_read_unlock(&arp_globals.lock);
+			fibril_mutex_unlock(&arp_globals.lock);
 			return ENOENT;
 		}
 		rc = measured_strings_reply(translation, 1);
-		fibril_rwlock_read_unlock(&arp_globals.lock);
+		fibril_mutex_unlock(&arp_globals.lock);
 		return rc;
 
@@ -682,5 +753,5 @@
 			return rc;
 		
-		fibril_rwlock_read_lock(&arp_globals.lock);
+		fibril_mutex_lock(&arp_globals.lock);
 		do {
 			next = pq_detach(packet);
@@ -692,5 +763,5 @@
 			packet = next;
 		} while (packet);
-		fibril_rwlock_read_unlock(&arp_globals.lock);
+		fibril_mutex_unlock(&arp_globals.lock);
 		
 		return EOK;
@@ -736,5 +807,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/il/arp/arp.h
===================================================================
--- uspace/srv/net/il/arp/arp.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/il/arp/arp.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,4 +65,9 @@
 typedef struct arp_proto arp_proto_t;
 
+/** Type definition of the ARP address translation record.
+ * @see arp_trans
+ */
+typedef struct arp_trans arp_trans_t;
+
 /** ARP address map.
  *
@@ -70,5 +75,5 @@
  * @see generic_char_map.h
  */
-GENERIC_CHAR_MAP_DECLARE(arp_addr, measured_string_t);
+GENERIC_CHAR_MAP_DECLARE(arp_addr, arp_trans_t);
 
 /** ARP address cache.
@@ -89,9 +94,9 @@
 struct arp_device {
 	/** Actual device hardware address. */
-	measured_string_t * addr;
+	measured_string_t *addr;
 	/** Actual device hardware address data. */
 	char *addr_data;
 	/** Broadcast device hardware address. */
-	measured_string_t * broadcast_addr;
+	measured_string_t *broadcast_addr;
 	/** Broadcast device hardware address data. */
 	char *broadcast_data;
@@ -129,5 +134,5 @@
 	int net_phone;
 	/** Safety lock. */
-	fibril_rwlock_t lock;
+	fibril_mutex_t lock;
 };
 
@@ -144,6 +149,18 @@
 };
 
+/** ARP address translation record. */
+struct arp_trans {
+	/**
+	 * Hardware address for the translation. NULL denotes an incomplete
+	 * record with possible waiters.
+	 */ 
+	measured_string_t *hw_addr;
+	/** Condition variable used for waiting for completion of the record. */
+	fibril_condvar_t cv;
+};
+
 #endif
 
 /** @}
  */
+
Index: uspace/srv/net/il/arp/arp_module.c
===================================================================
--- uspace/srv/net/il/arp/arp_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/il/arp/arp_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -65,5 +65,5 @@
 int il_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 	
@@ -79,5 +79,5 @@
 		goto out;
 	
-	rc = REGISTER_ME(SERVICE_ARP, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_ARP, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/il/ip/ip.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -129,5 +129,5 @@
  * @return		The result parameter.
  */
-static int ip_release_and_return(packet_t packet, int result)
+static int ip_release_and_return(packet_t *packet, int result)
 {
 	pq_release_remote(ip_globals.net_phone, packet_get_id(packet));
@@ -170,7 +170,7 @@
  * @return		Other error codes as defined for the packet_set_addr().
  */
-static int ip_prepare_icmp(packet_t packet, ip_header_t *header)
-{
-	packet_t next;
+static int ip_prepare_icmp(packet_t *packet, ip_header_t *header)
+{
+	packet_t *next;
 	struct sockaddr *dest;
 	struct sockaddr_in dest_in;
@@ -233,5 +233,5 @@
  */
 static int
-ip_prepare_icmp_and_get_phone(services_t error, packet_t packet,
+ip_prepare_icmp_and_get_phone(services_t error, packet_t *packet,
     ip_header_t *header)
 {
@@ -430,5 +430,5 @@
 	// binds the netif service which also initializes the device
 	ip_netif->phone = nil_bind_service(ip_netif->service,
-	    (ipcarg_t) ip_netif->device_id, SERVICE_IP,
+	    (sysarg_t) ip_netif->device_id, SERVICE_IP,
 	    ip_globals.client_connection);
 	if (ip_netif->phone < 0) {
@@ -442,5 +442,5 @@
 		if (route) {
 			address.value = (char *) &route->address.s_addr;
-			address.length = CONVERT_SIZE(in_addr_t, char, 1);
+			address.length = sizeof(in_addr_t);
 			
 			rc = arp_device_req(ip_netif->arp->phone,
@@ -461,5 +461,5 @@
 	
 	if (ip_netif->packet_dimension.content < IP_MIN_CONTENT) {
-		printf("Maximum transmission unit %d bytes is too small, at "
+		printf("Maximum transmission unit %zu bytes is too small, at "
 		    "least %d bytes are needed\n",
 		    ip_netif->packet_dimension.content, IP_MIN_CONTENT);
@@ -502,5 +502,5 @@
 	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 
-	printf("%s: Device %d changed MTU to %d\n", NAME, device_id, mtu);
+	printf("%s: Device %d changed MTU to %zu\n", NAME, device_id, mtu);
 
 	return EOK;
@@ -543,5 +543,5 @@
  */
 static ip_header_t *
-ip_create_middle_header(packet_t packet, ip_header_t *last)
+ip_create_middle_header(packet_t *packet, ip_header_t *last)
 {
 	ip_header_t *middle;
@@ -622,5 +622,5 @@
  */
 static int
-ip_prepare_packet(in_addr_t *source, in_addr_t dest, packet_t packet,
+ip_prepare_packet(in_addr_t *source, in_addr_t dest, packet_t *packet,
     measured_string_t *destination)
 {
@@ -629,5 +629,5 @@
 	ip_header_t *last_header;
 	ip_header_t *middle_header;
-	packet_t next;
+	packet_t *next;
 	int rc;
 
@@ -639,5 +639,5 @@
 	if (destination) {
 		rc = packet_set_addr(packet, NULL, (uint8_t *) destination->value,
-		    CONVERT_SIZE(char, uint8_t, destination->length));
+		    destination->length);
 	} else {
 		rc = packet_set_addr(packet, NULL, NULL, 0);
@@ -687,6 +687,5 @@
 				rc = packet_set_addr(next, NULL,
 				    (uint8_t *) destination->value,
-				    CONVERT_SIZE(char, uint8_t,
-				    destination->length));
+				    destination->length);
 				if (rc != EOK) {
 				    	free(last_header);
@@ -718,5 +717,5 @@
 			rc = packet_set_addr(next, NULL,
 			    (uint8_t *) destination->value,
-			    CONVERT_SIZE(char, uint8_t, destination->length));
+			    destination->length);
 			if (rc != EOK) {
 				free(last_header);
@@ -754,5 +753,5 @@
  */
 static int
-ip_fragment_packet_data(packet_t packet, packet_t new_packet,
+ip_fragment_packet_data(packet_t *packet, packet_t *new_packet,
     ip_header_t *header, ip_header_t *new_header, size_t length,
     const struct sockaddr *src, const struct sockaddr *dest, socklen_t addrlen)
@@ -816,8 +815,8 @@
  */
 static int
-ip_fragment_packet(packet_t packet, size_t length, size_t prefix, size_t suffix,
+ip_fragment_packet(packet_t *packet, size_t length, size_t prefix, size_t suffix,
     socklen_t addr_len)
 {
-	packet_t new_packet;
+	packet_t *new_packet;
 	ip_header_t *header;
 	ip_header_t *middle_header;
@@ -922,11 +921,11 @@
  * @return		NULL if there are no packets left.
  */
-static packet_t
-ip_split_packet(packet_t packet, size_t prefix, size_t content, size_t suffix,
+static packet_t *
+ip_split_packet(packet_t *packet, size_t prefix, size_t content, size_t suffix,
     socklen_t addr_len, services_t error)
 {
 	size_t length;
-	packet_t next;
-	packet_t new_packet;
+	packet_t *next;
+	packet_t *new_packet;
 	int result;
 	int phone;
@@ -993,5 +992,5 @@
  */
 static int
-ip_send_route(packet_t packet, ip_netif_t *netif, ip_route_t *route,
+ip_send_route(packet_t *packet, ip_netif_t *netif, ip_route_t *route,
     in_addr_t *src, in_addr_t dest, services_t error)
 {
@@ -1006,5 +1005,5 @@
 		destination.value = route->gateway.s_addr ?
 		    (char *) &route->gateway.s_addr : (char *) &dest.s_addr;
-		destination.length = CONVERT_SIZE(dest.s_addr, char, 1);
+		destination.length = sizeof(dest.s_addr);
 
 		rc = arp_translate_req(netif->arp->phone, netif->device_id,
@@ -1247,5 +1246,5 @@
 
 static int
-ip_send_msg_local(int il_phone, device_id_t device_id, packet_t packet,
+ip_send_msg_local(int il_phone, device_id_t device_id, packet_t *packet,
     services_t sender, services_t error)
 {
@@ -1451,5 +1450,5 @@
  */
 static int
-ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_t *header,
+ip_deliver_local(device_id_t device_id, packet_t *packet, ip_header_t *header,
     services_t error)
 {
@@ -1553,5 +1552,5 @@
  */
 static int
-ip_process_packet(device_id_t device_id, packet_t packet)
+ip_process_packet(device_id_t device_id, packet_t *packet)
 {
 	ip_header_t *header;
@@ -1715,5 +1714,5 @@
 static int
 ip_received_error_msg_local(int ip_phone, device_id_t device_id,
-    packet_t packet, services_t target, services_t error)
+    packet_t *packet, services_t target, services_t error)
 {
 	uint8_t *data;
@@ -1758,6 +1757,5 @@
 			// clear the ARP mapping if any
 			address.value = (char *) &header->destination_address;
-			address.length = CONVERT_SIZE(uint8_t, char,
-			    sizeof(header->destination_address));
+			address.length = sizeof(header->destination_address);
 			arp_clear_address_req(netif->arp->phone,
 			    netif->device_id, SERVICE_IP, &address);
@@ -1859,7 +1857,7 @@
  * @return		ENOMEM if there is not enough memory left.
  */
-static int ip_receive_message(device_id_t device_id, packet_t packet)
-{
-	packet_t next;
+static int ip_receive_message(device_id_t device_id, packet_t *packet)
+{
+	packet_t *next;
 
 	do {
@@ -1890,5 +1888,5 @@
     int *answer_count)
 {
-	packet_t packet;
+	packet_t *packet;
 	struct sockaddr *addr;
 	size_t addrlen;
@@ -1902,5 +1900,5 @@
 	
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
@@ -1951,5 +1949,6 @@
 
 	case NET_IP_GET_ROUTE:
-		rc = data_receive((void **) &addr, &addrlen);
+		rc = async_data_write_accept((void **) &addr, false, 0, 0, 0,
+		    &addrlen);
 		if (rc != EOK)
 			return rc;
@@ -2025,5 +2024,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP)) {
 			return;
Index: uspace/srv/net/il/ip/ip_module.c
===================================================================
--- uspace/srv/net/il/ip/ip_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/il/ip/ip_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -66,5 +66,5 @@
 int il_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 	
@@ -80,5 +80,5 @@
 		goto out;
 	
-	rc = REGISTER_ME(SERVICE_IP, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_IP, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/net/net.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -322,5 +322,5 @@
 static int net_module_start(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 	
@@ -335,5 +335,5 @@
 		goto out;
 	
-	rc = REGISTER_ME(SERVICE_NETWORKING, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_NETWORKING, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
@@ -632,5 +632,5 @@
 	
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
@@ -697,5 +697,5 @@
 		
 		/* End if told to either by the message or the processing result */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
 			return;
 		
Index: uspace/srv/net/netif/lo/Makefile
===================================================================
--- uspace/srv/net/netif/lo/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/netif/lo/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,8 +39,4 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	LIBS += $(USPACE_PREFIX)/srv/net/nil/nildummy/libnildummy.a
-endif
-
 BINARY = lo
 
Index: uspace/srv/net/netif/lo/lo.c
===================================================================
--- uspace/srv/net/netif/lo/lo.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/netif/lo/lo.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -164,7 +164,7 @@
 int netif_initialize(void)
 {
-	ipcarg_t phonehash;
-
-	return REGISTER_ME(SERVICE_LO, &phonehash);
+	sysarg_t phonehash;
+
+	return ipc_connect_to_me(PHONE_NS, SERVICE_LO, 0, 0, &phonehash);
 }
 
@@ -185,9 +185,9 @@
 }
 
-int netif_send_message(device_id_t device_id, packet_t packet, services_t sender)
+int netif_send_message(device_id_t device_id, packet_t *packet, services_t sender)
 {
 	netif_device_t *device;
 	size_t length;
-	packet_t next;
+	packet_t *next;
 	int phone;
 	int rc;
@@ -262,5 +262,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/nil/eth/Makefile
===================================================================
--- uspace/srv/net/nil/eth/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/nil/eth/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,9 +39,5 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	LIBRARY = libeth
-else
-	BINARY = eth
-endif
+BINARY = eth
 
 SOURCES = \
Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/nil/eth/eth.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -201,6 +201,5 @@
 
 	eth_globals.broadcast_addr =
-	    measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF",
-	    CONVERT_SIZE(uint8_t, char, ETH_ADDR));
+	    measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF", ETH_ADDR);
 	if (!eth_globals.broadcast_addr) {
 		rc = ENOMEM;
@@ -234,9 +233,9 @@
 static void eth_receiver(ipc_callid_t iid, ipc_call_t *icall)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
 	while (true) {
-		switch (IPC_GET_METHOD(*icall)) {
+		switch (IPC_GET_IMETHOD(*icall)) {
 		case NET_NIL_DEVICE_STATE:
 			nil_device_state_msg_local(0, IPC_GET_DEVICE(icall),
@@ -251,8 +250,8 @@
 				    IPC_GET_DEVICE(icall), packet, 0);
 			}
-			ipc_answer_0(iid, (ipcarg_t) rc);
+			ipc_answer_0(iid, (sysarg_t) rc);
 			break;
 		default:
-			ipc_answer_0(iid, (ipcarg_t) ENOTSUP);
+			ipc_answer_0(iid, (sysarg_t) ENOTSUP);
 		}
 		
@@ -315,5 +314,5 @@
 			device->mtu = ETH_MAX_TAGGED_CONTENT(device->flags);
 		
-		printf("Device %d already exists:\tMTU\t= %d\n",
+		printf("Device %d already exists:\tMTU\t= %zu\n",
 		    device->device_id, device->mtu);
 		fibril_rwlock_write_unlock(&eth_globals.devices_lock);
@@ -407,5 +406,5 @@
 	}
 	
-	printf("%s: Device registered (id: %d, service: %d: mtu: %d, "
+	printf("%s: Device registered (id: %d, service: %d: mtu: %zu, "
 	    "mac: %x:%x:%x:%x:%x:%x, flags: 0x%x)\n",
 	    NAME, device->device_id, device->service, device->mtu,
@@ -429,5 +428,5 @@
  * @return		NULL if the packet address length is not big enough.
  */
-static eth_proto_t *eth_process_packet(int flags, packet_t packet)
+static eth_proto_t *eth_process_packet(int flags, packet_t *packet)
 {
 	eth_header_snap_t *header;
@@ -509,8 +508,8 @@
 
 int nil_received_msg_local(int nil_phone, device_id_t device_id,
-    packet_t packet, services_t target)
+    packet_t *packet, services_t target)
 {
 	eth_proto_t *proto;
-	packet_t next;
+	packet_t *next;
 	eth_device_t *device;
 	int flags;
@@ -680,5 +679,5 @@
  */
 static int
-eth_prepare_packet(int flags, packet_t packet, uint8_t *src_addr, int ethertype,
+eth_prepare_packet(int flags, packet_t *packet, uint8_t *src_addr, int ethertype,
     size_t mtu)
 {
@@ -787,10 +786,10 @@
  * @return		EINVAL if the service parameter is not known.
  */
-static int eth_send_message(device_id_t device_id, packet_t packet,
+static int eth_send_message(device_id_t device_id, packet_t *packet,
     services_t sender)
 {
 	eth_device_t *device;
-	packet_t next;
-	packet_t tmp;
+	packet_t *next;
+	packet_t *tmp;
 	int ethertype;
 	int rc;
@@ -841,5 +840,5 @@
 {
 	measured_string_t *address;
-	packet_t packet;
+	packet_t *packet;
 	size_t addrlen;
 	size_t prefix;
@@ -849,5 +848,5 @@
 	
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
@@ -926,5 +925,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/nil/eth/eth_module.c
===================================================================
--- uspace/srv/net/nil/eth/eth_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/nil/eth/eth_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,5 +52,5 @@
 int nil_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 	
@@ -66,5 +66,5 @@
 		goto out;
 
-	rc = REGISTER_ME(SERVICE_ETHERNET, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_ETHERNET, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/net/nil/nildummy/Makefile
===================================================================
--- uspace/srv/net/nil/nildummy/Makefile	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/nil/nildummy/Makefile	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,9 +39,5 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
-	LIBRARY = libnildummy
-else
-	BINARY = nildummy
-endif
+BINARY = nildummy
 
 SOURCES = \
Index: uspace/srv/net/nil/nildummy/nildummy.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/nil/nildummy/nildummy.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -106,13 +106,13 @@
 static void nildummy_receiver(ipc_callid_t iid, ipc_call_t *icall)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
 	while (true) {
-		switch (IPC_GET_METHOD(*icall)) {
+		switch (IPC_GET_IMETHOD(*icall)) {
 		case NET_NIL_DEVICE_STATE:
 			rc = nil_device_state_msg_local(0,
 			    IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
-			ipc_answer_0(iid, (ipcarg_t) rc);
+			ipc_answer_0(iid, (sysarg_t) rc);
 			break;
 		
@@ -124,9 +124,9 @@
 				    IPC_GET_DEVICE(icall), packet, 0);
 			}
-			ipc_answer_0(iid, (ipcarg_t) rc);
+			ipc_answer_0(iid, (sysarg_t) rc);
 			break;
 		
 		default:
-			ipc_answer_0(iid, (ipcarg_t) ENOTSUP);
+			ipc_answer_0(iid, (sysarg_t) ENOTSUP);
 		}
 		
@@ -175,5 +175,5 @@
 			device->mtu = NET_DEFAULT_MTU;
 		
-		printf("Device %d already exists:\tMTU\t= %d\n",
+		printf("Device %d already exists:\tMTU\t= %zu\n",
 		    device->device_id, device->mtu);
 		fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
@@ -232,5 +232,5 @@
 	}
 	
-	printf("%s: Device registered (id: %d, service: %d, mtu: %d)\n",
+	printf("%s: Device registered (id: %d, service: %d, mtu: %zu)\n",
 	    NAME, device->device_id, device->service, device->mtu);
 	fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
@@ -304,7 +304,7 @@
 
 int nil_received_msg_local(int nil_phone, device_id_t device_id,
-    packet_t packet, services_t target)
-{
-	packet_t next;
+    packet_t *packet, services_t target)
+{
+	packet_t *next;
 
 	fibril_rwlock_read_lock(&nildummy_globals.protos_lock);
@@ -354,5 +354,5 @@
  * @return		EINVAL if the service parameter is not known.
  */
-static int nildummy_send_message(device_id_t device_id, packet_t packet,
+static int nildummy_send_message(device_id_t device_id, packet_t *packet,
     services_t sender)
 {
@@ -378,5 +378,5 @@
 {
 	measured_string_t *address;
-	packet_t packet;
+	packet_t *packet;
 	size_t addrlen;
 	size_t prefix;
@@ -386,5 +386,5 @@
 	
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case IPC_M_PHONE_HUNGUP:
 		return EOK;
@@ -466,5 +466,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/nil/nildummy/nildummy_module.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/nil/nildummy/nildummy_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -52,5 +52,5 @@
 int nil_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 	
@@ -67,5 +67,5 @@
 		goto out;
 	
-	rc = REGISTER_ME(SERVICE_NILDUMMY, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_NILDUMMY, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -130,5 +130,5 @@
  * @return		The result parameter.
  */
-static int icmp_release_and_return(packet_t packet, int result)
+static int icmp_release_and_return(packet_t *packet, int result)
 {
 	pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
@@ -155,5 +155,5 @@
  * @return		EPERM if the error message is not allowed.
  */
-static int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t packet,
+static int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t *packet,
     icmp_header_t *header, services_t error, ip_ttl_t ttl, ip_tos_t tos,
     int dont_fragment)
@@ -189,5 +189,5 @@
  * @return NULL on errors.
  */
-static icmp_header_t *icmp_prepare_packet(packet_t packet)
+static icmp_header_t *icmp_prepare_packet(packet_t *packet)
 {
 	icmp_header_t *header;
@@ -248,5 +248,5 @@
 {
 	icmp_header_t *header;
-	packet_t packet;
+	packet_t *packet;
 	size_t length;
 	uint8_t *data;
@@ -340,5 +340,5 @@
 
 static int icmp_destination_unreachable_msg_local(int icmp_phone,
-    icmp_code_t code, icmp_param_t mtu, packet_t packet)
+    icmp_code_t code, icmp_param_t mtu, packet_t *packet)
 {
 	icmp_header_t *header;
@@ -355,5 +355,5 @@
 }
 
-static int icmp_source_quench_msg_local(int icmp_phone, packet_t packet)
+static int icmp_source_quench_msg_local(int icmp_phone, packet_t *packet)
 {
 	icmp_header_t *header;
@@ -368,5 +368,5 @@
 
 static int icmp_time_exceeded_msg_local(int icmp_phone, icmp_code_t code,
-    packet_t packet)
+    packet_t *packet)
 {
 	icmp_header_t *header;
@@ -381,5 +381,5 @@
 
 static int icmp_parameter_problem_msg_local(int icmp_phone, icmp_code_t code,
-    icmp_param_t pointer, packet_t packet)
+    icmp_param_t pointer, packet_t *packet)
 {
 	icmp_header_t *header;
@@ -479,5 +479,5 @@
  * @param[in] code	The received reply message code.
  */
-static void  icmp_process_echo_reply(packet_t packet, icmp_header_t *header,
+static void  icmp_process_echo_reply(packet_t *packet, icmp_header_t *header,
     icmp_type_t type, icmp_code_t code)
 {
@@ -518,5 +518,5 @@
  *			ip_client_process_packet() function.
  */
-static int icmp_process_packet(packet_t packet, services_t error)
+static int icmp_process_packet(packet_t *packet, services_t error)
 {
 	size_t length;
@@ -658,5 +658,5 @@
  *			icmp_process_packet() function.
  */
-static int icmp_received_msg_local(device_id_t device_id, packet_t packet,
+static int icmp_received_msg_local(device_id_t device_id, packet_t *packet,
     services_t receiver, services_t error)
 {
@@ -690,8 +690,8 @@
 static int icmp_process_message(ipc_call_t *call)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case NET_ICMP_DEST_UNREACH:
 		rc = packet_translate_remote(icmp_globals.net_phone, &packet,
@@ -824,5 +824,5 @@
 
 		/* Process the call */
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			keep_on_going = false;
@@ -896,9 +896,9 @@
     ipc_call_t *answer, int *answer_count)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case NET_TL_RECEIVED:
 		rc = packet_translate_remote(icmp_globals.net_phone, &packet,
@@ -953,5 +953,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/tl/icmp/icmp_module.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/icmp/icmp_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -58,5 +58,5 @@
 int tl_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 
@@ -74,5 +74,5 @@
 		goto out;
 
-	rc = REGISTER_ME(SERVICE_ICMP, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_ICMP, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -160,5 +160,5 @@
 };
 
-static int tcp_release_and_return(packet_t, int);
+static int tcp_release_and_return(packet_t *, int);
 static void tcp_prepare_operation_header(socket_core_t *, tcp_socket_data_t *,
     tcp_header_t *, int synchronize, int);
@@ -171,23 +171,23 @@
 static int tcp_release_after_timeout(void *);
 
-static int tcp_process_packet(device_id_t, packet_t, services_t);
+static int tcp_process_packet(device_id_t, packet_t *, services_t);
 static int tcp_connect_core(socket_core_t *, socket_cores_t *,
     struct sockaddr *, socklen_t);
 static int tcp_queue_prepare_packet(socket_core_t *, tcp_socket_data_t *,
-    packet_t, size_t);
-static int tcp_queue_packet(socket_core_t *, tcp_socket_data_t *, packet_t,
+    packet_t *, size_t);
+static int tcp_queue_packet(socket_core_t *, tcp_socket_data_t *, packet_t *,
     size_t);
-static packet_t tcp_get_packets_to_send(socket_core_t *, tcp_socket_data_t *);
-static void tcp_send_packets(device_id_t, packet_t);
+static packet_t *tcp_get_packets_to_send(socket_core_t *, tcp_socket_data_t *);
+static void tcp_send_packets(device_id_t, packet_t *);
 
 static void tcp_process_acknowledgement(socket_core_t *, tcp_socket_data_t *,
     tcp_header_t *);
-static packet_t tcp_send_prepare_packet(socket_core_t *, tcp_socket_data_t *,
-    packet_t, size_t, size_t);
-static packet_t tcp_prepare_copy(socket_core_t *, tcp_socket_data_t *, packet_t,
-    size_t, size_t);
+static packet_t *tcp_send_prepare_packet(socket_core_t *, tcp_socket_data_t *,
+    packet_t *, size_t, size_t);
+static packet_t *tcp_prepare_copy(socket_core_t *, tcp_socket_data_t *,
+    packet_t *, size_t, size_t);
 /* static */ void tcp_retransmit_packet(socket_core_t *, tcp_socket_data_t *,
     size_t);
-static int tcp_create_notification_packet(packet_t *, socket_core_t *,
+static int tcp_create_notification_packet(packet_t **, socket_core_t *,
     tcp_socket_data_t *, int, int);
 static void tcp_refresh_socket_data(tcp_socket_data_t *);
@@ -196,15 +196,15 @@
 
 static int tcp_process_listen(socket_core_t *, tcp_socket_data_t *,
-    tcp_header_t *, packet_t, struct sockaddr *, struct sockaddr *, size_t);
+    tcp_header_t *, packet_t *, struct sockaddr *, struct sockaddr *, size_t);
 static int tcp_process_syn_sent(socket_core_t *, tcp_socket_data_t *,
-    tcp_header_t *, packet_t);
+    tcp_header_t *, packet_t *);
 static int tcp_process_syn_received(socket_core_t *, tcp_socket_data_t *,
-    tcp_header_t *, packet_t);
+    tcp_header_t *, packet_t *);
 static int tcp_process_established(socket_core_t *, tcp_socket_data_t *,
-    tcp_header_t *, packet_t, int, size_t);
+    tcp_header_t *, packet_t *, int, size_t);
 static int tcp_queue_received_packet(socket_core_t *, tcp_socket_data_t *,
-    packet_t, int, size_t);
-
-static int tcp_received_msg(device_id_t, packet_t, services_t, services_t);
+    packet_t *, int, size_t);
+
+static int tcp_received_msg(device_id_t, packet_t *, services_t, services_t);
 static int tcp_process_client_messages(ipc_callid_t, ipc_call_t);
 
@@ -262,5 +262,5 @@
 }
 
-int tcp_received_msg(device_id_t device_id, packet_t packet,
+int tcp_received_msg(device_id_t device_id, packet_t *packet,
     services_t receiver, services_t error)
 {
@@ -280,5 +280,5 @@
 }
 
-int tcp_process_packet(device_id_t device_id, packet_t packet, services_t error)
+int tcp_process_packet(device_id_t device_id, packet_t *packet, services_t error)
 {
 	size_t length;
@@ -288,5 +288,5 @@
 	socket_core_t *socket;
 	tcp_socket_data_t *socket_data;
-	packet_t next_packet;
+	packet_t *next_packet;
 	size_t total_length;
 	uint32_t checksum;
@@ -453,5 +453,5 @@
 
 has_error_service:
-	fibril_rwlock_read_unlock(&tcp_globals.lock);
+	fibril_rwlock_write_unlock(&tcp_globals.lock);
 
 	/* TODO error reporting/handling */
@@ -493,9 +493,9 @@
 
 int tcp_process_established(socket_core_t *socket, tcp_socket_data_t *
-    socket_data, tcp_header_t *header, packet_t packet, int fragments,
+    socket_data, tcp_header_t *header, packet_t *packet, int fragments,
     size_t total_length)
 {
-	packet_t next_packet;
-	packet_t tmp_packet;
+	packet_t *next_packet;
+	packet_t *tmp_packet;
 	uint32_t old_incoming;
 	size_t order;
@@ -801,5 +801,5 @@
 
 int tcp_queue_received_packet(socket_core_t *socket,
-    tcp_socket_data_t *socket_data, packet_t packet, int fragments,
+    tcp_socket_data_t *socket_data, packet_t *packet, int fragments,
     size_t total_length)
 {
@@ -829,8 +829,8 @@
 	/* Notify the destination socket */
 	async_msg_5(socket->phone, NET_SOCKET_RECEIVED,
-	    (ipcarg_t) socket->socket_id,
+	    (sysarg_t) socket->socket_id,
 	    ((packet_dimension->content < socket_data->data_fragment_size) ?
 	    packet_dimension->content : socket_data->data_fragment_size), 0, 0,
-	    (ipcarg_t) fragments);
+	    (sysarg_t) fragments);
 
 	return EOK;
@@ -838,7 +838,7 @@
 
 int tcp_process_syn_sent(socket_core_t *socket, tcp_socket_data_t *
-    socket_data, tcp_header_t *header, packet_t packet)
-{
-	packet_t next_packet;
+    socket_data, tcp_header_t *header, packet_t *packet)
+{
+	packet_t *next_packet;
 	int rc;
 
@@ -897,8 +897,8 @@
 int tcp_process_listen(socket_core_t *listening_socket,
     tcp_socket_data_t *listening_socket_data, tcp_header_t *header,
-    packet_t packet, struct sockaddr *src, struct sockaddr *dest,
+    packet_t *packet, struct sockaddr *src, struct sockaddr *dest,
     size_t addrlen)
 {
-	packet_t next_packet;
+	packet_t *next_packet;
 	socket_core_t *socket;
 	tcp_socket_data_t *socket_data;
@@ -1056,5 +1056,5 @@
 
 int tcp_process_syn_received(socket_core_t *socket,
-    tcp_socket_data_t *socket_data, tcp_header_t *header, packet_t packet)
+    tcp_socket_data_t *socket_data, tcp_header_t *header, packet_t *packet)
 {
 	socket_core_t *listening_socket;
@@ -1090,7 +1090,7 @@
 			/* Notify the destination socket */
 			async_msg_5(socket->phone, NET_SOCKET_ACCEPTED,
-			    (ipcarg_t) listening_socket->socket_id,
+			    (sysarg_t) listening_socket->socket_id,
 			    socket_data->data_fragment_size, TCP_HEADER_SIZE,
-			    0, (ipcarg_t) socket->socket_id);
+			    0, (sysarg_t) socket->socket_id);
 
 			fibril_rwlock_write_unlock(socket_data->local_lock);
@@ -1127,7 +1127,7 @@
 	size_t number;
 	size_t length;
-	packet_t packet;
-	packet_t next;
-	packet_t acknowledged = NULL;
+	packet_t *packet;
+	packet_t *next;
+	packet_t *acknowledged = NULL;
 	uint32_t old;
 
@@ -1232,5 +1232,5 @@
     ipc_call_t *answer, int *answer_count)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
@@ -1240,5 +1240,5 @@
 
 	*answer_count = 0;
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case NET_TL_RECEIVED:
 //		fibril_rwlock_read_lock(&tcp_globals.lock);
@@ -1323,5 +1323,5 @@
 
 		/* Process the call */
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			keep_on_going = false;
@@ -1365,5 +1365,6 @@
 
 		case NET_SOCKET_BIND:
-			res = data_receive((void **) &addr, &addrlen);
+			res = async_data_write_accept((void **) &addr, false,
+			    0, 0, 0, &addrlen);
 			if (res != EOK)
 				break;
@@ -1402,5 +1403,6 @@
 
 		case NET_SOCKET_CONNECT:
-			res = data_receive((void **) &addr, &addrlen);
+			res = async_data_write_accept((void **) &addr, false,
+			    0, 0, 0, &addrlen);
 			if (res != EOK)
 				break;
@@ -1453,5 +1455,6 @@
 
 		case NET_SOCKET_SENDTO:
-			res = data_receive((void **) &addr, &addrlen);
+			res = async_data_write_accept((void **) &addr, false,
+			    0, 0, 0, &addrlen);
 			if (res != EOK)
 				break;
@@ -1654,6 +1657,6 @@
     socket_data, size_t sequence_number)
 {
-	packet_t packet;
-	packet_t copy;
+	packet_t *packet;
+	packet_t *copy;
 	size_t data_length;
 
@@ -1736,5 +1739,5 @@
 {
 	tcp_socket_data_t *socket_data;
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
@@ -1800,4 +1803,6 @@
 			fibril_rwlock_write_unlock(socket_data->local_lock);
 
+			socket_data->state = TCP_SOCKET_SYN_SENT;
+
 			/* Send the packet */
 			printf("connecting %d\n", packet_get_id(packet));
@@ -1824,5 +1829,5 @@
 
 int tcp_queue_prepare_packet(socket_core_t *socket,
-    tcp_socket_data_t *socket_data, packet_t packet, size_t data_length)
+    tcp_socket_data_t *socket_data, packet_t *packet, size_t data_length)
 {
 	tcp_header_t *header;
@@ -1855,5 +1860,5 @@
 
 int tcp_queue_packet(socket_core_t *socket, tcp_socket_data_t *socket_data,
-    packet_t packet, size_t data_length)
+    packet_t *packet, size_t data_length)
 {
 	int rc;
@@ -1876,11 +1881,11 @@
 }
 
-packet_t tcp_get_packets_to_send(socket_core_t *socket, tcp_socket_data_t *
+packet_t *tcp_get_packets_to_send(socket_core_t *socket, tcp_socket_data_t *
     socket_data)
 {
-	packet_t packet;
-	packet_t copy;
-	packet_t sending = NULL;
-	packet_t previous = NULL;
+	packet_t *packet;
+	packet_t *copy;
+	packet_t *sending = NULL;
+	packet_t *previous = NULL;
 	size_t data_length;
 	int rc;
@@ -1936,6 +1941,6 @@
 }
 
-packet_t tcp_send_prepare_packet(socket_core_t *socket, tcp_socket_data_t *
-    socket_data, packet_t packet, size_t data_length, size_t sequence_number)
+packet_t *tcp_send_prepare_packet(socket_core_t *socket, tcp_socket_data_t *
+    socket_data, packet_t *packet, size_t data_length, size_t sequence_number)
 {
 	tcp_header_t *header;
@@ -1997,8 +2002,8 @@
 }
 
-packet_t tcp_prepare_copy(socket_core_t *socket, tcp_socket_data_t *
-    socket_data, packet_t packet, size_t data_length, size_t sequence_number)
-{
-	packet_t copy;
+packet_t *tcp_prepare_copy(socket_core_t *socket, tcp_socket_data_t *
+    socket_data, packet_t *packet, size_t data_length, size_t sequence_number)
+{
+	packet_t *copy;
 
 	assert(socket);
@@ -2015,7 +2020,7 @@
 }
 
-void tcp_send_packets(device_id_t device_id, packet_t packet)
-{
-	packet_t next;
+void tcp_send_packets(device_id_t device_id, packet_t *packet)
+{
+	packet_t *next;
 
 	while (packet) {
@@ -2082,6 +2087,7 @@
 	if (!fibril) {
 		free(operation_timeout);
-		return EPARTY;	/* FIXME: use another EC */
-	}
+		return ENOMEM;
+	}
+
 //      fibril_mutex_lock(&socket_data->operation.mutex);
 	/* Start the timeout fibril */
@@ -2097,5 +2103,5 @@
 	tcp_socket_data_t *socket_data;
 	int packet_id;
-	packet_t packet;
+	packet_t *packet;
 	size_t length;
 	int rc;
@@ -2155,5 +2161,5 @@
 	tcp_socket_data_t *socket_data;
 	packet_dimension_t *packet_dimension;
-	packet_t packet;
+	packet_t *packet;
 	size_t total_length;
 	tcp_header_t *header;
@@ -2229,5 +2235,5 @@
 	socket_core_t *socket;
 	tcp_socket_data_t *socket_data;
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
@@ -2293,5 +2299,5 @@
 }
 
-int tcp_create_notification_packet(packet_t *packet, socket_core_t *socket,
+int tcp_create_notification_packet(packet_t **packet, socket_core_t *socket,
     tcp_socket_data_t *socket_data, int synchronize, int finalize)
 {
@@ -2442,5 +2448,5 @@
  * @return		The result parameter.
  */
-int tcp_release_and_return(packet_t packet, int result)
+int tcp_release_and_return(packet_t *packet, int result)
 {
 	pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
@@ -2481,5 +2487,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/tl/tcp/tcp.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/tcp/tcp.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -239,5 +239,5 @@
 	 * Packets metric is set as their data length.
 	 */
-	packet_t incoming;
+	packet_t *incoming;
 	
 	/** Outgoing packet queue.
@@ -249,5 +249,5 @@
 	 * Packets metric is set as their data length.
 	 */
-	packet_t outgoing;
+	packet_t *outgoing;
 	
 	/** IP pseudo header. */
Index: uspace/srv/net/tl/tcp/tcp_module.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/tcp/tcp_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -61,5 +61,5 @@
 int tl_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 
@@ -75,5 +75,5 @@
 		goto out;
 
-	rc = REGISTER_ME(SERVICE_TCP, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_TCP, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/udp/udp.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -190,5 +190,5 @@
  * @return		The result parameter.
  */
-static int udp_release_and_return(packet_t packet, int result)
+static int udp_release_and_return(packet_t *packet, int result)
 {
 	pq_release_remote(udp_globals.net_phone, packet_get_id(packet));
@@ -217,5 +217,5 @@
  *			ip_client_process_packet() function.
  */
-static int udp_process_packet(device_id_t device_id, packet_t packet,
+static int udp_process_packet(device_id_t device_id, packet_t *packet,
     services_t error)
 {
@@ -225,9 +225,9 @@
 	udp_header_t *header;
 	socket_core_t *socket;
-	packet_t next_packet;
+	packet_t *next_packet;
 	size_t total_length;
 	uint32_t checksum;
 	int fragments;
-	packet_t tmp_packet;
+	packet_t *tmp_packet;
 	icmp_type_t type;
 	icmp_code_t code;
@@ -393,6 +393,6 @@
 	fibril_rwlock_write_unlock(&udp_globals.lock);
 	async_msg_5(socket->phone, NET_SOCKET_RECEIVED,
-	    (ipcarg_t) socket->socket_id, packet_dimension->content, 0, 0,
-	    (ipcarg_t) fragments);
+	    (sysarg_t) socket->socket_id, packet_dimension->content, 0, 0,
+	    (sysarg_t) fragments);
 
 	return EOK;
@@ -413,5 +413,5 @@
  *			udp_process_packet() function.
  */
-static int udp_received_msg(device_id_t device_id, packet_t packet,
+static int udp_received_msg(device_id_t device_id, packet_t *packet,
     services_t receiver, services_t error)
 {
@@ -458,6 +458,6 @@
 {
 	socket_core_t *socket;
-	packet_t packet;
-	packet_t next_packet;
+	packet_t *packet;
+	packet_t *next_packet;
 	udp_header_t *header;
 	int index;
@@ -614,5 +614,5 @@
 	socket_core_t *socket;
 	int packet_id;
-	packet_t packet;
+	packet_t *packet;
 	udp_header_t *header;
 	struct sockaddr *addr;
@@ -742,5 +742,5 @@
 
 		/* Process the call */
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			keep_on_going = false;
@@ -771,5 +771,6 @@
 
 		case NET_SOCKET_BIND:
-			res = data_receive((void **) &addr, &addrlen);
+			res = async_data_write_accept((void **) &addr, false,
+			    0, 0, 0, &addrlen);
 			if (res != EOK)
 				break;
@@ -784,5 +785,6 @@
 
 		case NET_SOCKET_SENDTO:
-			res = data_receive((void **) &addr, &addrlen);
+			res = async_data_write_accept((void **) &addr, false,
+			    0, 0, 0, &addrlen);
 			if (res != EOK)
 				break;
@@ -861,10 +863,10 @@
     ipc_call_t *answer, int *answer_count)
 {
-	packet_t packet;
+	packet_t *packet;
 	int rc;
 
 	*answer_count = 0;
 
-	switch (IPC_GET_METHOD(*call)) {
+	switch (IPC_GET_IMETHOD(*call)) {
 	case NET_TL_RECEIVED:
 		rc = packet_translate_remote(udp_globals.net_phone, &packet,
@@ -913,5 +915,5 @@
 		 * result.
 		 */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
 		    (res == EHANGUP))
 			return;
Index: uspace/srv/net/tl/udp/udp_module.c
===================================================================
--- uspace/srv/net/tl/udp/udp_module.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/net/tl/udp/udp_module.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -59,5 +59,5 @@
 int tl_module_start_standalone(async_client_conn_t client_connection)
 {
-	ipcarg_t phonehash;
+	sysarg_t phonehash;
 	int rc;
 
@@ -75,5 +75,5 @@
 		goto out;
 	
-	rc = REGISTER_ME(SERVICE_UDP, &phonehash);
+	rc = ipc_connect_to_me(PHONE_NS, SERVICE_UDP, 0, 0, &phonehash);
 	if (rc != EOK)
 		goto out;
Index: uspace/srv/ns/clonable.c
===================================================================
--- uspace/srv/ns/clonable.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/ns/clonable.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -46,5 +46,5 @@
 typedef struct {
 	link_t link;
-	ipcarg_t service;
+	sysarg_t service;
 	ipc_call_t call;
 	ipc_callid_t callid;
@@ -73,5 +73,5 @@
  *
  */
-void register_clonable(ipcarg_t service, ipcarg_t phone, ipc_call_t *call,
+void register_clonable(sysarg_t service, sysarg_t phone, ipc_call_t *call,
     ipc_callid_t callid)
 {
@@ -107,5 +107,5 @@
  *
  */
-void connect_to_clonable(ipcarg_t service, ipc_call_t *call,
+void connect_to_clonable(sysarg_t service, ipc_call_t *call,
     ipc_callid_t callid)
 {
Index: uspace/srv/ns/clonable.h
===================================================================
--- uspace/srv/ns/clonable.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/ns/clonable.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -40,7 +40,7 @@
 
 extern bool service_clonable(int service);
-extern void register_clonable(ipcarg_t service, ipcarg_t phone,
+extern void register_clonable(sysarg_t service, sysarg_t phone,
     ipc_call_t *call, ipc_callid_t callid);
-extern void connect_to_clonable(ipcarg_t service, ipc_call_t *call,
+extern void connect_to_clonable(sysarg_t service, ipc_call_t *call,
     ipc_callid_t callid);
 
Index: uspace/srv/ns/ns.c
===================================================================
--- uspace/srv/ns/ns.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/ns/ns.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -78,5 +78,5 @@
 	}
 	
-	ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
+	ipc_answer_2(callid, EOK, (sysarg_t) *addr, AS_AREA_READ);
 }
 
@@ -135,7 +135,7 @@
 		
 		task_id_t id;
-		ipcarg_t retval;
-		
-		switch (IPC_GET_METHOD(call)) {
+		sysarg_t retval;
+		
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_SHARE_IN:
 			switch (IPC_GET_ARG3(call)) {
Index: uspace/srv/ns/service.c
===================================================================
--- uspace/srv/ns/service.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/ns/service.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -43,7 +43,7 @@
 typedef struct {
 	link_t link;
-	ipcarg_t service;        /**< Number of the service. */
-	ipcarg_t phone;          /**< Phone registered with the service. */
-	ipcarg_t in_phone_hash;  /**< Incoming phone hash. */
+	sysarg_t service;        /**< Number of the service. */
+	sysarg_t phone;          /**< Phone registered with the service. */
+	sysarg_t in_phone_hash;  /**< Incoming phone hash. */
 } hashed_service_t;
 
@@ -115,8 +115,8 @@
 typedef struct {
 	link_t link;
-	ipcarg_t service;        /**< Number of the service. */
+	sysarg_t service;        /**< Number of the service. */
 	ipc_callid_t callid;     /**< Call ID waiting for the connection */
-	ipcarg_t arg2;           /**< Second argument */
-	ipcarg_t arg3;           /**< Third argument */
+	sysarg_t arg2;           /**< Second argument */
+	sysarg_t arg3;           /**< Third argument */
 } pending_conn_t;
 
@@ -174,5 +174,5 @@
  *
  */
-int register_service(ipcarg_t service, ipcarg_t phone, ipc_call_t *call)
+int register_service(sysarg_t service, sysarg_t phone, ipc_call_t *call)
 {
 	unsigned long keys[3] = {
@@ -207,7 +207,7 @@
  *
  */
-void connect_to_service(ipcarg_t service, ipc_call_t *call, ipc_callid_t callid)
-{
-	ipcarg_t retval;
+void connect_to_service(sysarg_t service, ipc_call_t *call, ipc_callid_t callid)
+{
+	sysarg_t retval;
 	unsigned long keys[3] = {
 		service,
Index: uspace/srv/ns/service.h
===================================================================
--- uspace/srv/ns/service.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/ns/service.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -39,6 +39,6 @@
 extern void process_pending_conn(void);
 
-extern int register_service(ipcarg_t service, ipcarg_t phone, ipc_call_t *call);
-extern void connect_to_service(ipcarg_t service, ipc_call_t *call,
+extern int register_service(sysarg_t service, sysarg_t phone, ipc_call_t *call);
+extern void connect_to_service(sysarg_t service, ipc_call_t *call,
      ipc_callid_t callid);
 
Index: uspace/srv/ns/task.c
===================================================================
--- uspace/srv/ns/task.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/ns/task.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -45,5 +45,5 @@
 #define P2I_HASH_TABLE_CHAINS  256
 
-static int get_id_by_phone(ipcarg_t phone_hash, task_id_t *id);
+static int get_id_by_phone(sysarg_t phone_hash, task_id_t *id);
 
 /* TODO:
@@ -124,5 +124,5 @@
 typedef struct {
 	link_t link;
-	ipcarg_t phash;    /**< Task ID. */
+	sysarg_t phash;    /**< Task ID. */
 	task_id_t id;    /**< Task ID. */
 } p2i_entry_t;
@@ -248,5 +248,5 @@
 void wait_for_task(task_id_t id, ipc_call_t *call, ipc_callid_t callid)
 {
-	ipcarg_t retval;
+	sysarg_t retval;
 	task_exit_t texit;
 
@@ -262,6 +262,6 @@
 	if (ht == NULL) {
 		/* No such task exists. */
-		retval = ENOENT;
-		goto out;
+		ipc_answer_0(callid, ENOENT);
+		return;
 	}
 
@@ -393,5 +393,5 @@
 }
 
-static int get_id_by_phone(ipcarg_t phone_hash, task_id_t *id)
+static int get_id_by_phone(sysarg_t phone_hash, task_id_t *id)
 {
 	unsigned long keys[1];
Index: uspace/srv/taskmon/taskmon.c
===================================================================
--- uspace/srv/taskmon/taskmon.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/taskmon/taskmon.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -60,10 +60,11 @@
 	thread = IPC_GET_ARG3(*call);
 
-	if (asprintf(&s_taskid, "%" PRIuTASKID, taskid) < 0) {
+	if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) {
 		printf("Memory allocation failed.\n");
 		return;
 	}
 
-	printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread);
+	printf(NAME ": Task %" PRIu64 " fault in thread %p.\n", taskid,
+	    (void *) thread);
 
 	fname = "/app/taskdump";
@@ -72,14 +73,14 @@
 	char *dump_fname;
 
-	if (asprintf(&dump_fname, "/data/core%" PRIuTASKID, taskid) < 0) {
+	if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) {
 		printf("Memory allocation failed.\n");
 		return;
 	}
 
-	printf(NAME ": Executing %s -c %s -t %s\n", dump_fname, s_taskid);
+	printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid);
 	rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
 	    NULL);
 #else
-	printf(NAME ": Executing %s -t %s\n", s_taskid);
+	printf(NAME ": Executing %s -t %s\n", fname, s_taskid);
 	rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);
 #endif
Index: uspace/srv/vfs/vfs.c
===================================================================
--- uspace/srv/vfs/vfs.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/vfs/vfs.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -73,5 +73,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 		
-		switch (IPC_GET_METHOD(call)) {
+		switch (IPC_GET_IMETHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
 			keep_on_going = false;
@@ -173,5 +173,5 @@
 	 * Register at the naming service.
 	 */
-	ipcarg_t phonead;
+	sysarg_t phonead;
 	ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, 0, &phonead);
 	
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/vfs/vfs.h	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -54,5 +54,5 @@
 	fs_handle_t fs_handle;
 	fibril_mutex_t phone_lock;
-	ipcarg_t phone;
+	sysarg_t phone;
 } fs_info_t;
 
@@ -172,4 +172,5 @@
 
 extern fs_handle_t fs_name_to_handle(char *, bool);
+extern vfs_info_t *fs_handle_to_info(fs_handle_t);
 
 extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *,
Index: uspace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/vfs/vfs_lookup.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -161,10 +161,10 @@
 	ipc_call_t answer;
 	int phone = vfs_grab_phone(root->fs_handle);
-	aid_t req = async_send_5(phone, VFS_OUT_LOOKUP, (ipcarg_t) first,
-	    (ipcarg_t) (first + len - 1) % PLB_SIZE,
-	    (ipcarg_t) root->devmap_handle, (ipcarg_t) lflag, (ipcarg_t) index,
+	aid_t req = async_send_5(phone, VFS_OUT_LOOKUP, (sysarg_t) first,
+	    (sysarg_t) (first + len - 1) % PLB_SIZE,
+	    (sysarg_t) root->devmap_handle, (sysarg_t) lflag, (sysarg_t) index,
 	    &answer);
 	
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	vfs_release_phone(root->fs_handle, phone);
@@ -179,6 +179,9 @@
 	fibril_mutex_unlock(&plb_mutex);
 	
-	if (((int) rc < EOK) || (!result))
+	if ((int) rc < EOK)
 		return (int) rc;
+
+	if (!result)
+		return EOK;
 	
 	result->triplet.fs_handle = (fs_handle_t) rc;
@@ -210,8 +213,8 @@
 	ipc_call_t answer;
 	aid_t req = async_send_2(phone, VFS_OUT_OPEN_NODE,
-	    (ipcarg_t) result->triplet.devmap_handle,
-	    (ipcarg_t) result->triplet.index, &answer);
-	
-	ipcarg_t rc;
+	    (sysarg_t) result->triplet.devmap_handle,
+	    (sysarg_t) result->triplet.index, &answer);
+	
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	vfs_release_phone(result->triplet.fs_handle, phone);
Index: uspace/srv/vfs/vfs_node.c
===================================================================
--- uspace/srv/vfs/vfs_node.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/vfs/vfs_node.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -129,7 +129,7 @@
 		 */
 		int phone = vfs_grab_phone(node->fs_handle);
-		ipcarg_t rc;
+		sysarg_t rc;
 		rc = async_req_2_0(phone, VFS_OUT_DESTROY,
-		    (ipcarg_t)node->devmap_handle, (ipcarg_t)node->index);
+		    (sysarg_t)node->devmap_handle, (sysarg_t)node->index);
 		assert(rc == EOK);
 		vfs_release_phone(node->fs_handle, phone);
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/vfs/vfs_ops.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -55,5 +55,6 @@
 
 /* Forward declarations of static functions. */
-static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, aoff64_t);
+static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t,
+    aoff64_t);
 
 /**
@@ -78,5 +79,5 @@
 	size_t rsize;
 	unsigned rlnkcnt;
-	ipcarg_t rc;
+	sysarg_t rc;
 	int phone;
 	aid_t msg;
@@ -125,5 +126,5 @@
 			phone = vfs_grab_phone(fs_handle);
 			msg = async_send_1(phone, VFS_OUT_MOUNTED,
-			    (ipcarg_t) devmap_handle, &answer);
+			    (sysarg_t) devmap_handle, &answer);
 			/* send the mount options */
 			rc = async_data_write_start(phone, (void *)opts,
@@ -187,8 +188,8 @@
 	phone = vfs_grab_phone(mp_res.triplet.fs_handle);
 	msg = async_send_4(phone, VFS_OUT_MOUNT,
-	    (ipcarg_t) mp_res.triplet.devmap_handle,
-	    (ipcarg_t) mp_res.triplet.index,
-	    (ipcarg_t) fs_handle,
-	    (ipcarg_t) devmap_handle, &answer);
+	    (sysarg_t) mp_res.triplet.devmap_handle,
+	    (sysarg_t) mp_res.triplet.index,
+	    (sysarg_t) fs_handle,
+	    (sysarg_t) devmap_handle, &answer);
 	
 	/* send connection */
@@ -250,4 +251,6 @@
 void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
 {
+	devmap_handle_t devmap_handle;
+
 	/*
 	 * We expect the library to do the device-name to device-handle
@@ -255,5 +258,5 @@
 	 * in the request.
 	 */
-	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	
 	/*
@@ -291,6 +294,6 @@
 	 */
 	char *fs_name;
-	rc = async_data_write_accept((void **) &fs_name, true, 0, FS_NAME_MAXLEN,
-	    0, NULL);
+	rc = async_data_write_accept((void **) &fs_name, true, 0,
+	    FS_NAME_MAXLEN, 0, NULL);
 	if (rc != EOK) {
 		free(mp);
@@ -306,5 +309,5 @@
 	ipc_call_t data;
 	ipc_callid_t callid = async_get_call(&data);
-	if (IPC_GET_METHOD(data) != IPC_M_PING) {
+	if (IPC_GET_IMETHOD(data) != IPC_M_PING) {
 		ipc_answer_0(callid, ENOTSUP);
 		ipc_answer_0(rid, ENOTSUP);
@@ -458,6 +461,6 @@
 
 		phone = vfs_grab_phone(mp_node->fs_handle);
-		rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->devmap_handle,
-		    mp_node->index);
+		rc = async_req_2_0(phone, VFS_OUT_UNMOUNT,
+		    mp_node->devmap_handle, mp_node->index);
 		vfs_release_phone(mp_node->fs_handle, phone);
 		if (rc != EOK) {
@@ -713,5 +716,5 @@
 
 	/* Wait for reply from the FS server. */
-	ipcarg_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
@@ -740,9 +743,9 @@
 		aid_t msg;
 		ipc_call_t answer;
-		msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->devmap_handle,
-		    file->node->index, &answer);
+		msg = async_send_2(fs_phone, VFS_OUT_CLOSE,
+		    file->node->devmap_handle, file->node->index, &answer);
 		
 		/* Wait for reply from the FS server. */
-		ipcarg_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 		
@@ -778,4 +781,5 @@
 static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read)
 {
+	vfs_info_t *vi;
 
 	/*
@@ -804,9 +808,13 @@
 	fibril_mutex_lock(&file->lock);
 
+	vi = fs_handle_to_info(file->node->fs_handle);
+	assert(vi);
+
 	/*
 	 * Lock the file's node so that no other client can read/write to it at
-	 * the same time.
-	 */
-	if (read)
+	 * the same time unless the FS supports concurrent reads/writes and its
+	 * write implementation does not modify the file size.
+	 */
+	if (read || (vi->concurrent_read_write && vi->write_retains_size))
 		fibril_rwlock_read_lock(&file->node->contents_rwlock);
 	else
@@ -831,14 +839,14 @@
 	 * don't have to bother.
 	 */
-	ipcarg_t rc;
+	sysarg_t rc;
 	ipc_call_t answer;
 	if (read) {
-		if (file->append)
-			file->pos = file->node->size;
-		
 		rc = async_data_read_forward_3_1(fs_phone, VFS_OUT_READ,
 		    file->node->devmap_handle, file->node->index, file->pos,
 		    &answer);
 	} else {
+		if (file->append)
+			file->pos = file->node->size;
+		
 		rc = async_data_write_forward_3_1(fs_phone, VFS_OUT_WRITE,
 		    file->node->devmap_handle, file->node->index, file->pos,
@@ -854,5 +862,5 @@
 	
 	/* Unlock the VFS node. */
-	if (read)
+	if (read || (vi->concurrent_read_write && vi->write_retains_size))
 		fibril_rwlock_read_unlock(&file->node->contents_rwlock);
 	else {
@@ -888,6 +896,6 @@
 {
 	int fd = (int) IPC_GET_ARG1(*request);
-	off64_t off =
-	    (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request));
+	off64_t off = (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),
+	    IPC_GET_ARG3(*request));
 	int whence = (int) IPC_GET_ARG4(*request);
 	
@@ -903,56 +911,57 @@
 	off64_t newoff;
 	switch (whence) {
-		case SEEK_SET:
-			if (off >= 0) {
-				file->pos = (aoff64_t) off;
-				fibril_mutex_unlock(&file->lock);
-				ipc_answer_1(rid, EOK, off);
-				return;
-			}
-			break;
-		case SEEK_CUR:
-			if ((off >= 0) && (file->pos + off < file->pos)) {
-				fibril_mutex_unlock(&file->lock);
-				ipc_answer_0(rid, EOVERFLOW);
-				return;
-			}
-			
-			if ((off < 0) && (file->pos < (aoff64_t) -off)) {
-				fibril_mutex_unlock(&file->lock);
-				ipc_answer_0(rid, EOVERFLOW);
-				return;
-			}
-			
-			file->pos += off;
-			newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos;
-			
+	case SEEK_SET:
+		if (off >= 0) {
+			file->pos = (aoff64_t) off;
 			fibril_mutex_unlock(&file->lock);
-			ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
-			return;
-		case SEEK_END:
-			fibril_rwlock_read_lock(&file->node->contents_rwlock);
-			aoff64_t size = file->node->size;
-			
-			if ((off >= 0) && (size + off < size)) {
-				fibril_rwlock_read_unlock(&file->node->contents_rwlock);
-				fibril_mutex_unlock(&file->lock);
-				ipc_answer_0(rid, EOVERFLOW);
-				return;
-			}
-			
-			if ((off < 0) && (size < (aoff64_t) -off)) {
-				fibril_rwlock_read_unlock(&file->node->contents_rwlock);
-				fibril_mutex_unlock(&file->lock);
-				ipc_answer_0(rid, EOVERFLOW);
-				return;
-			}
-			
-			file->pos = size + off;
-			newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos;
-			
+			ipc_answer_1(rid, EOK, off);
+			return;
+		}
+		break;
+	case SEEK_CUR:
+		if ((off >= 0) && (file->pos + off < file->pos)) {
+			fibril_mutex_unlock(&file->lock);
+			ipc_answer_0(rid, EOVERFLOW);
+			return;
+		}
+		
+		if ((off < 0) && (file->pos < (aoff64_t) -off)) {
+			fibril_mutex_unlock(&file->lock);
+			ipc_answer_0(rid, EOVERFLOW);
+			return;
+		}
+		
+		file->pos += off;
+		newoff = (file->pos > OFF64_MAX) ?  OFF64_MAX : file->pos;
+		
+		fibril_mutex_unlock(&file->lock);
+		ipc_answer_2(rid, EOK, LOWER32(newoff),
+		    UPPER32(newoff));
+		return;
+	case SEEK_END:
+		fibril_rwlock_read_lock(&file->node->contents_rwlock);
+		aoff64_t size = file->node->size;
+		
+		if ((off >= 0) && (size + off < size)) {
 			fibril_rwlock_read_unlock(&file->node->contents_rwlock);
 			fibril_mutex_unlock(&file->lock);
-			ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
-			return;
+			ipc_answer_0(rid, EOVERFLOW);
+			return;
+		}
+		
+		if ((off < 0) && (size < (aoff64_t) -off)) {
+			fibril_rwlock_read_unlock(&file->node->contents_rwlock);
+			fibril_mutex_unlock(&file->lock);
+			ipc_answer_0(rid, EOVERFLOW);
+			return;
+		}
+		
+		file->pos = size + off;
+		newoff = (file->pos > OFF64_MAX) ?  OFF64_MAX : file->pos;
+		
+		fibril_rwlock_read_unlock(&file->node->contents_rwlock);
+		fibril_mutex_unlock(&file->lock);
+		ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
+		return;
 	}
 	
@@ -964,10 +973,10 @@
     fs_index_t index, aoff64_t size)
 {
-	ipcarg_t rc;
+	sysarg_t rc;
 	int fs_phone;
 	
 	fs_phone = vfs_grab_phone(fs_handle);
-	rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t) devmap_handle,
-	    (ipcarg_t) index, LOWER32(size), UPPER32(size));
+	rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (sysarg_t) devmap_handle,
+	    (sysarg_t) index, LOWER32(size), UPPER32(size));
 	vfs_release_phone(fs_handle, fs_phone);
 	return (int)rc;
@@ -977,6 +986,6 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	aoff64_t size =
-	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request));
+	aoff64_t size = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),
+	    IPC_GET_ARG3(*request));
 	int rc;
 
@@ -996,5 +1005,5 @@
 
 	fibril_mutex_unlock(&file->lock);
-	ipc_answer_0(rid, (ipcarg_t)rc);
+	ipc_answer_0(rid, (sysarg_t)rc);
 }
 
@@ -1002,5 +1011,5 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	ipcarg_t rc;
+	sysarg_t rc;
 
 	vfs_file_t *file = vfs_file_get(fd);
@@ -1075,5 +1084,5 @@
 	ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
 	
-	ipcarg_t rv;
+	sysarg_t rv;
 	async_wait_for(msg, &rv);
 	vfs_release_phone(node->fs_handle, fs_phone);
Index: uspace/srv/vfs/vfs_register.c
===================================================================
--- uspace/srv/vfs/vfs_register.c	(revision 1bfd3d3b2991b8f2df4cff87d9723059528b9bd1)
+++ uspace/srv/vfs/vfs_register.c	(revision 973ef9fc2302afd44bcf569cc300f71adbc0acdf)
@@ -177,6 +177,6 @@
 	ipc_call_t call;
 	ipc_callid_t callid = async_get_call(&call);
-	if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) {
-		dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call));
+	if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
+		dprintf("Unexpected call, method = %d\n", IPC_GET_IMETHOD(call));
 		list_remove(&fs_info->fs_link);
 		fibril_mutex_unlock(&fs_head_lock);
@@ -197,5 +197,5 @@
 	size_t size;
 	if (!async_share_in_receive(&callid, &size)) {
-		dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call));
+		dprintf("Unexpected call, method = %d\n", IPC_GET_IMETHOD(call));
 		list_remove(&fs_info->fs_link);
 		fibril_mutex_unlock(&fs_head_lock);
@@ -235,5 +235,5 @@
 	 */
 	fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next);
-	ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle);
+	ipc_answer_1(rid, EOK, (sysarg_t) fs_info->fs_handle);
 	
 	fibril_condvar_broadcast(&fs_head_cv);
@@ -333,4 +333,27 @@
 }
 
+/** Find the VFS info structure.
+ *
+ * @param handle	FS handle for which the VFS info structure is sought.
+ * @return		VFS info structure on success or NULL otherwise.
+ */
+vfs_info_t *fs_handle_to_info(fs_handle_t handle)
+{
+	vfs_info_t *info = NULL;
+	link_t *cur;
+
+	fibril_mutex_lock(&fs_head_lock);
+	for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
+		fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
+		if (fs->fs_handle == handle) { 
+			info = &fs->vfs_info;
+			break;
+		}
+	}
+	fibril_mutex_unlock(&fs_head_lock);
+
+	return info;
+}
+
 /**
  * @}
