Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/Makefile	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -108,4 +108,5 @@
 	generic/adt/measured_strings.c \
 	generic/adt/char_map.c \
+	generic/adt/prodcons.c \
 	generic/time.c \
 	generic/stdlib.c \
Index: uspace/lib/c/arch/ia32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia32/Makefile.common	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/arch/ia32/Makefile.common	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -28,5 +28,5 @@
 
 CLANG_ARCH = i386
-GCC_CFLAGS += -march=pentium
+GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
 
 ENDIANESS = LE
Index: uspace/lib/c/arch/ppc32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ppc32/_link.ld.in	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/arch/ppc32/_link.ld.in	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -10,4 +10,5 @@
 #endif
 	data PT_LOAD FLAGS(6);
+	debug PT_NOTE;
 }
 
@@ -55,4 +56,17 @@
 	} :data
 	
+#ifdef CONFIG_LINE_DEBUG
+	.comment 0 : { *(.comment); } :debug
+	.debug_abbrev 0 : { *(.debug_abbrev); } :debug
+	.debug_aranges 0 : { *(.debug_aranges); } :debug
+	.debug_info 0 : { *(.debug_info); } :debug
+	.debug_line 0 : { *(.debug_line); } :debug
+	.debug_loc 0 : { *(.debug_loc); } :debug
+	.debug_pubnames 0 : { *(.debug_pubnames); } :debug
+	.debug_pubtypes 0 : { *(.debug_pubtypes); } :debug
+	.debug_ranges 0 : { *(.debug_ranges); } :debug
+	.debug_str 0 : { *(.debug_str); } :debug
+#endif
+	
 	/DISCARD/ : {
 		*(*);
Index: uspace/lib/c/generic/adt/prodcons.c
===================================================================
--- uspace/lib/c/generic/adt/prodcons.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
+++ uspace/lib/c/generic/adt/prodcons.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <adt/prodcons.h>
+#include <adt/list.h>
+#include <fibril_synch.h>
+
+void prodcons_initialize(prodcons_t *pc)
+{
+	list_initialize(&pc->list);
+	fibril_mutex_initialize(&pc->mtx);
+	fibril_condvar_initialize(&pc->cv);
+}
+
+void prodcons_produce(prodcons_t *pc, link_t *item)
+{
+	fibril_mutex_lock(&pc->mtx);
+	
+	list_append(item, &pc->list);
+	fibril_condvar_signal(&pc->cv);
+	
+	fibril_mutex_unlock(&pc->mtx);
+}
+
+link_t *prodcons_consume(prodcons_t *pc)
+{
+	fibril_mutex_lock(&pc->mtx);
+	
+	while (list_empty(&pc->list))
+		fibril_condvar_wait(&pc->cv, &pc->mtx);
+	
+	link_t *head = pc->list.next;
+	list_remove(head);
+	
+	fibril_mutex_unlock(&pc->mtx);
+	
+	return head;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/as.c
===================================================================
--- uspace/lib/c/generic/as.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/as.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -51,5 +51,5 @@
  *
  */
-void *as_area_create(void *address, size_t size, int flags)
+void *as_area_create(void *address, size_t size, unsigned int flags)
 {
 	return (void *) __SYSCALL3(SYS_AS_AREA_CREATE, (sysarg_t) address,
@@ -67,5 +67,5 @@
  *
  */
-int as_area_resize(void *address, size_t size, int flags)
+int as_area_resize(void *address, size_t size, unsigned int flags)
 {
 	return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t) address,
@@ -95,5 +95,5 @@
  *
  */
-int as_area_change_flags(void *address, int flags)
+int as_area_change_flags(void *address, unsigned int flags)
 {
 	return __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
Index: uspace/lib/c/generic/assert.c
===================================================================
--- uspace/lib/c/generic/assert.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/assert.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -33,12 +33,35 @@
 #include <assert.h>
 #include <stdio.h>
+#include <io/klog.h>
 #include <stdlib.h>
+#include <atomic.h>
 #include <stacktrace.h>
+#include <stdint.h>
+
+static atomic_t failed_asserts = {0};
 
 void assert_abort(const char *cond, const char *file, unsigned int line)
 {
+	/*
+	 * Send the message safely to klog. Nested asserts should not occur.
+	 */
+	klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
+	    cond, file, line);
+	
+	/*
+	 * Check if this is a nested or parallel assert.
+	 */
+	if (atomic_postinc(&failed_asserts))
+		abort();
+	
+	/*
+	 * Attempt to print the message to standard output and display
+	 * the stack trace. These operations can theoretically trigger nested
+	 * assertions.
+	 */
 	printf("Assertion failed (%s) in file \"%s\", line %u.\n",
 	    cond, file, line);
 	stacktrace_print();
+	
 	abort();
 }
Index: uspace/lib/c/generic/event.c
===================================================================
--- uspace/lib/c/generic/event.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/event.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -41,14 +41,28 @@
 #include <kernel/ipc/event_types.h>
 
-/** Subscribe for event notifications.
+/** Subscribe event notifications.
  *
- * @param evno   Event number.
- * @param method Use this method for notifying me.
+ * @param evno    Event type to subscribe.
+ * @param imethod Use this interface and method for notifying me.
  *
  * @return Value returned by the kernel.
+ *
  */
-int event_subscribe(event_type_t e, sysarg_t method)
+int event_subscribe(event_type_t evno, sysarg_t imethod)
 {
-	return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) e, (sysarg_t) method);
+	return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) evno,
+	    (sysarg_t) imethod);
+}
+
+/** Unmask event notifications.
+ *
+ * @param evno Event type to unmask.
+ *
+ * @return Value returned by the kernel.
+ *
+ */
+int event_unmask(event_type_t evno)
+{
+	return __SYSCALL1(SYS_EVENT_UNMASK, (sysarg_t) evno);
 }
 
Index: uspace/lib/c/generic/io/klog.c
===================================================================
--- uspace/lib/c/generic/io/klog.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/io/klog.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -38,5 +38,7 @@
 #include <sys/types.h>
 #include <unistd.h>
+#include <errno.h>
 #include <io/klog.h>
+#include <io/printf_core.h>
 
 size_t klog_write(const void *buf, size_t size)
@@ -55,4 +57,67 @@
 }
 
+/** Print formatted text to klog.
+ *
+ * @param fmt Format string
+ *
+ * \see For more details about format string see printf_core.
+ *
+ */
+int klog_printf(const char *fmt, ...)
+{
+	va_list args;
+	va_start(args, fmt);
+	
+	int ret = klog_vprintf(fmt, args);
+	
+	va_end(args);
+	
+	return ret;
+}
+
+static int klog_vprintf_str_write(const char *str, size_t size, void *data)
+{
+	size_t wr = klog_write(str, size);
+	return str_nlength(str, wr);
+}
+
+static int klog_vprintf_wstr_write(const wchar_t *str, size_t size, void *data)
+{
+	size_t offset = 0;
+	size_t chars = 0;
+	
+	while (offset < size) {
+		char buf[STR_BOUNDS(1)];
+		size_t sz = 0;
+		
+		if (chr_encode(str[chars], buf, &sz, STR_BOUNDS(1)) == EOK)
+			klog_write(buf, sz);
+		
+		chars++;
+		offset += sizeof(wchar_t);
+	}
+	
+	return chars;
+}
+
+/** Print formatted text to klog.
+ *
+ * @param fmt Format string
+ * @param ap  Format parameters
+ *
+ * \see For more details about format string see printf_core.
+ *
+ */
+int klog_vprintf(const char *fmt, va_list ap)
+{
+	printf_spec_t ps = {
+		klog_vprintf_str_write,
+		klog_vprintf_wstr_write,
+		NULL
+	};
+	
+	return printf_core(fmt, &ps, ap);
+}
+
 /** @}
  */
Index: uspace/lib/c/generic/io/vprintf.c
===================================================================
--- uspace/lib/c/generic/io/vprintf.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/io/vprintf.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -96,7 +96,6 @@
 /** Print formatted text to stdout.
  *
- * @param file Output stream
- * @param fmt  Format string
- * @param ap   Format parameters
+ * @param fmt Format string
+ * @param ap  Format parameters
  *
  * \see For more details about format string see printf_core.
Index: uspace/lib/c/generic/malloc.c
===================================================================
--- uspace/lib/c/generic/malloc.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/malloc.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -65,8 +65,22 @@
 #define BASE_ALIGN  16
 
+/** Heap shrink granularity
+ *
+ * Try not to pump and stress the heap to much
+ * by shrinking and enlarging it too often.
+ * A heap area won't shrunk if it the released
+ * free block is smaller than this constant.
+ *
+ */
+#define SHRINK_GRANULARITY  (64 * PAGE_SIZE)
+
 /** Overhead of each heap block. */
 #define STRUCT_OVERHEAD \
 	(sizeof(heap_block_head_t) + sizeof(heap_block_foot_t))
 
+/** Overhead of each area. */
+#define AREA_OVERHEAD(size) \
+	(ALIGN_UP(size + sizeof(heap_area_t), BASE_ALIGN))
+
 /** Calculate real size of a heap block.
  *
@@ -86,6 +100,19 @@
  *
  */
-#define AREA_FIRST_BLOCK(area) \
+#define AREA_FIRST_BLOCK_HEAD(area) \
 	(ALIGN_UP(((uintptr_t) (area)) + sizeof(heap_area_t), BASE_ALIGN))
+
+/** Get last block in heap area.
+ *
+ */
+#define AREA_LAST_BLOCK_FOOT(area) \
+	(((uintptr_t) (area)->end) - sizeof(heap_block_foot_t))
+
+/** Get header in heap block.
+ *
+ */
+#define BLOCK_HEAD(foot) \
+	((heap_block_head_t *) \
+	    (((uintptr_t) (foot)) + sizeof(heap_block_foot_t) - (foot)->size))
 
 /** Get footer in heap block.
@@ -94,5 +121,5 @@
 #define BLOCK_FOOT(head) \
 	((heap_block_foot_t *) \
-	    (((uintptr_t) head) + head->size - sizeof(heap_block_foot_t)))
+	    (((uintptr_t) (head)) + (head)->size - sizeof(heap_block_foot_t)))
 
 /** Heap area.
@@ -115,4 +142,7 @@
 	void *end;
 	
+	/** Previous heap area */
+	struct heap_area *prev;
+	
 	/** Next heap area */
 	struct heap_area *next;
@@ -157,8 +187,24 @@
 
 /** Next heap block to examine (next fit algorithm) */
-static heap_block_head_t *next = NULL;
+static heap_block_head_t *next_fit = NULL;
 
 /** Futex for thread-safe heap manipulation */
 static futex_t malloc_futex = FUTEX_INITIALIZER;
+
+#ifndef NDEBUG
+
+#define malloc_assert(expr) \
+	do { \
+		if (!(expr)) {\
+			futex_up(&malloc_futex); \
+			assert_abort(#expr, __FILE__, __LINE__); \
+		} \
+	} while (0)
+
+#else /* NDEBUG */
+
+#define malloc_assert(expr)
+
+#endif /* NDEBUG */
 
 /** Initialize a heap block
@@ -202,14 +248,16 @@
 	heap_block_head_t *head = (heap_block_head_t *) addr;
 	
-	assert(head->magic == HEAP_BLOCK_HEAD_MAGIC);
+	malloc_assert(head->magic == HEAP_BLOCK_HEAD_MAGIC);
 	
 	heap_block_foot_t *foot = BLOCK_FOOT(head);
 	
-	assert(foot->magic == HEAP_BLOCK_FOOT_MAGIC);
-	assert(head->size == foot->size);
+	malloc_assert(foot->magic == HEAP_BLOCK_FOOT_MAGIC);
+	malloc_assert(head->size == foot->size);
 }
 
 /** Check a heap area structure
  *
+ * Should be called only inside the critical section.
+ *
  * @param addr Address of the heap area.
  *
@@ -219,14 +267,16 @@
 	heap_area_t *area = (heap_area_t *) addr;
 	
-	assert(area->magic == HEAP_AREA_MAGIC);
-	assert(area->start < area->end);
-	assert(((uintptr_t) area->start % PAGE_SIZE) == 0);
-	assert(((uintptr_t) area->end % PAGE_SIZE) == 0);
+	malloc_assert(area->magic == HEAP_AREA_MAGIC);
+	malloc_assert(addr == area->start);
+	malloc_assert(area->start < area->end);
+	malloc_assert(((uintptr_t) area->start % PAGE_SIZE) == 0);
+	malloc_assert(((uintptr_t) area->end % PAGE_SIZE) == 0);
 }
 
 /** Create new heap area
  *
- * @param start Preffered starting address of the new area.
- * @param size  Size of the area.
+ * Should be called only inside the critical section.
+ *
+ * @param size Size of the area.
  *
  */
@@ -248,10 +298,10 @@
 	
 	area->start = astart;
-	area->end = (void *)
-	    ALIGN_DOWN((uintptr_t) astart + asize, BASE_ALIGN);
+	area->end = (void *) ((uintptr_t) astart + asize);
+	area->prev = NULL;
 	area->next = NULL;
 	area->magic = HEAP_AREA_MAGIC;
 	
-	void *block = (void *) AREA_FIRST_BLOCK(area);
+	void *block = (void *) AREA_FIRST_BLOCK_HEAD(area);
 	size_t bsize = (size_t) (area->end - block);
 	
@@ -262,4 +312,5 @@
 		last_heap_area = area;
 	} else {
+		area->prev = last_heap_area;
 		last_heap_area->next = area;
 		last_heap_area = area;
@@ -271,6 +322,10 @@
 /** Try to enlarge a heap area
  *
+ * Should be called only inside the critical section.
+ *
  * @param area Heap area to grow.
- * @param size Gross size of item to allocate (bytes).
+ * @param size Gross size to grow (bytes).
+ *
+ * @return True if successful.
  *
  */
@@ -282,10 +337,8 @@
 	area_check(area);
 	
-	size_t asize = ALIGN_UP((size_t) (area->end - area->start) + size,
-	    PAGE_SIZE);
-	
 	/* New heap area size */
-	void *end = (void *)
-	    ALIGN_DOWN((uintptr_t) area->start + asize, BASE_ALIGN);
+	size_t gross_size = (size_t) (area->end - area->start) + size;
+	size_t asize = ALIGN_UP(gross_size, PAGE_SIZE);
+	void *end = (void *) ((uintptr_t) area->start + asize);
 	
 	/* Check for overflow */
@@ -299,5 +352,7 @@
 	
 	/* Add new free block */
-	block_init(area->end, (size_t) (end - area->end), true, area);
+	size_t net_size = (size_t) (end - area->end);
+	if (net_size > 0)
+		block_init(area->end, net_size, true, area);
 	
 	/* Update heap area parameters */
@@ -309,4 +364,6 @@
 /** Try to enlarge any of the heap areas
  *
+ * Should be called only inside the critical section.
+ *
  * @param size Gross size of item to allocate (bytes).
  *
@@ -318,6 +375,6 @@
 	
 	/* First try to enlarge some existing area */
-	heap_area_t *area;
-	for (area = first_heap_area; area != NULL; area = area->next) {
+	for (heap_area_t *area = first_heap_area; area != NULL;
+	    area = area->next) {
 		if (area_grow(area, size))
 			return true;
@@ -325,15 +382,110 @@
 	
 	/* Eventually try to create a new area */
-	return area_create(AREA_FIRST_BLOCK(size));
-}
-
-/** Try to shrink heap space
- *
+	return area_create(AREA_OVERHEAD(size));
+}
+
+/** Try to shrink heap
+ *
+ * Should be called only inside the critical section.
  * In all cases the next pointer is reset.
  *
- */
-static void heap_shrink(void)
-{
-	next = NULL;
+ * @param area Last modified heap area.
+ *
+ */
+static void heap_shrink(heap_area_t *area)
+{
+	area_check(area);
+	
+	heap_block_foot_t *last_foot =
+	    (heap_block_foot_t *) AREA_LAST_BLOCK_FOOT(area);
+	heap_block_head_t *last_head = BLOCK_HEAD(last_foot);
+	
+	block_check((void *) last_head);
+	malloc_assert(last_head->area == area);
+	
+	if (last_head->free) {
+		/*
+		 * The last block of the heap area is
+		 * unused. The area might be potentially
+		 * shrunk.
+		 */
+		
+		heap_block_head_t *first_head =
+		    (heap_block_head_t *) AREA_FIRST_BLOCK_HEAD(area);
+		
+		block_check((void *) first_head);
+		malloc_assert(first_head->area == area);
+		
+		size_t shrink_size = ALIGN_DOWN(last_head->size, PAGE_SIZE);
+		
+		if (first_head == last_head) {
+			/*
+			 * The entire heap area consists of a single
+			 * free heap block. This means we can get rid
+			 * of it entirely.
+			 */
+			
+			heap_area_t *prev = area->prev;
+			heap_area_t *next = area->next;
+			
+			if (prev != NULL) {
+				area_check(prev);
+				prev->next = next;
+			} else
+				first_heap_area = next;
+			
+			if (next != NULL) {
+				area_check(next);
+				next->prev = prev;
+			} else
+				last_heap_area = prev;
+			
+			as_area_destroy(area->start);
+		} else if (shrink_size >= SHRINK_GRANULARITY) {
+			/*
+			 * Make sure that we always shrink the area
+			 * by a multiple of page size and update
+			 * the block layout accordingly.
+			 */
+			
+			size_t asize = (size_t) (area->end - area->start) - shrink_size;
+			void *end = (void *) ((uintptr_t) area->start + asize);
+			
+			/* Resize the address space area */
+			int ret = as_area_resize(area->start, asize, 0);
+			if (ret != EOK)
+				abort();
+			
+			/* Update heap area parameters */
+			area->end = end;
+			size_t excess = ((size_t) area->end) - ((size_t) last_head);
+			
+			if (excess > 0) {
+				if (excess >= STRUCT_OVERHEAD) {
+					/*
+					 * The previous block cannot be free and there
+					 * is enough free space left in the area to
+					 * create a new free block.
+					 */
+					block_init((void *) last_head, excess, true, area);
+				} else {
+					/*
+					 * The excess is small. Therefore just enlarge
+					 * the previous block.
+					 */
+					heap_block_foot_t *prev_foot = (heap_block_foot_t *)
+					    (((uintptr_t) last_head) - sizeof(heap_block_foot_t));
+					heap_block_head_t *prev_head = BLOCK_HEAD(prev_foot);
+					
+					block_check((void *) prev_head);
+					
+					block_init(prev_head, prev_head->size + excess,
+					    prev_head->free, area);
+				}
+			}
+		}
+	}
+	
+	next_fit = NULL;
 }
 
@@ -362,5 +514,5 @@
 static void split_mark(heap_block_head_t *cur, const size_t size)
 {
-	assert(cur->size >= size);
+	malloc_assert(cur->size >= size);
 	
 	/* See if we should split the block. */
@@ -398,9 +550,8 @@
 {
 	area_check((void *) area);
-	assert((void *) first_block >= (void *) AREA_FIRST_BLOCK(area));
-	assert((void *) first_block < area->end);
-	
-	heap_block_head_t *cur;
-	for (cur = first_block; (void *) cur < area->end;
+	malloc_assert((void *) first_block >= (void *) AREA_FIRST_BLOCK_HEAD(area));
+	malloc_assert((void *) first_block < area->end);
+	
+	for (heap_block_head_t *cur = first_block; (void *) cur < area->end;
 	    cur = (heap_block_head_t *) (((void *) cur) + cur->size)) {
 		block_check(cur);
@@ -425,5 +576,5 @@
 				split_mark(cur, real_size);
 				
-				next = cur;
+				next_fit = cur;
 				return addr;
 			} else {
@@ -436,5 +587,5 @@
 					 * data in (including alignment).
 					 */
-					if ((void *) cur > (void *) AREA_FIRST_BLOCK(area)) {
+					if ((void *) cur > (void *) AREA_FIRST_BLOCK_HEAD(area)) {
 						/*
 						 * There is a block before the current block.
@@ -477,5 +628,5 @@
 						split_mark(next_head, real_size);
 						
-						next = next_head;
+						next_fit = next_head;
 						return aligned;
 					} else {
@@ -496,12 +647,12 @@
 							size_t reduced_size = cur->size - excess;
 							cur = (heap_block_head_t *)
-							    (AREA_FIRST_BLOCK(area) + excess);
+							    (AREA_FIRST_BLOCK_HEAD(area) + excess);
 							
-							block_init((void *) AREA_FIRST_BLOCK(area), excess,
-							    true, area);
+							block_init((void *) AREA_FIRST_BLOCK_HEAD(area),
+							    excess, true, area);
 							block_init(cur, reduced_size, true, area);
 							split_mark(cur, real_size);
 							
-							next = cur;
+							next_fit = cur;
 							return aligned;
 						}
@@ -527,5 +678,5 @@
 static void *malloc_internal(const size_t size, const size_t align)
 {
-	assert(first_heap_area != NULL);
+	malloc_assert(first_heap_area != NULL);
 	
 	if (align == 0)
@@ -541,5 +692,5 @@
 	
 	/* Try the next fit approach */
-	split = next;
+	split = next_fit;
 	
 	if (split != NULL) {
@@ -552,8 +703,8 @@
 	
 	/* Search the entire heap */
-	heap_area_t *area;
-	for (area = first_heap_area; area != NULL; area = area->next) {
+	for (heap_area_t *area = first_heap_area; area != NULL;
+	    area = area->next) {
 		heap_block_head_t *first = (heap_block_head_t *)
-		    AREA_FIRST_BLOCK(area);
+		    AREA_FIRST_BLOCK_HEAD(area);
 		
 		void *addr = malloc_area(area, first, split, real_size,
@@ -652,11 +803,11 @@
 	
 	block_check(head);
-	assert(!head->free);
+	malloc_assert(!head->free);
 	
 	heap_area_t *area = head->area;
 	
 	area_check(area);
-	assert((void *) head >= (void *) AREA_FIRST_BLOCK(area));
-	assert((void *) head < area->end);
+	malloc_assert((void *) head >= (void *) AREA_FIRST_BLOCK_HEAD(area));
+	malloc_assert((void *) head < area->end);
 	
 	void *ptr = NULL;
@@ -675,5 +826,5 @@
 			block_init((void *) head + real_size,
 			    orig_size - real_size, true, area);
-			heap_shrink();
+			heap_shrink(area);
 		}
 		
@@ -697,5 +848,5 @@
 			
 			ptr = ((void *) head) + sizeof(heap_block_head_t);
-			next = NULL;
+			next_fit = NULL;
 		} else
 			reloc = true;
@@ -729,11 +880,11 @@
 	
 	block_check(head);
-	assert(!head->free);
+	malloc_assert(!head->free);
 	
 	heap_area_t *area = head->area;
 	
 	area_check(area);
-	assert((void *) head >= (void *) AREA_FIRST_BLOCK(area));
-	assert((void *) head < area->end);
+	malloc_assert((void *) head >= (void *) AREA_FIRST_BLOCK_HEAD(area));
+	malloc_assert((void *) head < area->end);
 	
 	/* Mark the block itself as free. */
@@ -751,5 +902,5 @@
 	
 	/* Look at the previous block. If it is free, merge the two. */
-	if ((void *) head > (void *) AREA_FIRST_BLOCK(area)) {
+	if ((void *) head > (void *) AREA_FIRST_BLOCK_HEAD(area)) {
 		heap_block_foot_t *prev_foot =
 		    (heap_block_foot_t *) (((void *) head) - sizeof(heap_block_foot_t));
@@ -765,9 +916,58 @@
 	}
 	
-	heap_shrink();
+	heap_shrink(area);
 	
 	futex_up(&malloc_futex);
 }
 
+void *heap_check(void)
+{
+	futex_down(&malloc_futex);
+	
+	if (first_heap_area == NULL) {
+		futex_up(&malloc_futex);
+		return (void *) -1;
+	}
+	
+	/* Walk all heap areas */
+	for (heap_area_t *area = first_heap_area; area != NULL;
+	    area = area->next) {
+		
+		/* Check heap area consistency */
+		if ((area->magic != HEAP_AREA_MAGIC) ||
+		    ((void *) area != area->start) ||
+		    (area->start >= area->end) ||
+		    (((uintptr_t) area->start % PAGE_SIZE) != 0) ||
+		    (((uintptr_t) area->end % PAGE_SIZE) != 0)) {
+			futex_up(&malloc_futex);
+			return (void *) area;
+		}
+		
+		/* Walk all heap blocks */
+		for (heap_block_head_t *head = (heap_block_head_t *)
+		    AREA_FIRST_BLOCK_HEAD(area); (void *) head < area->end;
+		    head = (heap_block_head_t *) (((void *) head) + head->size)) {
+			
+			/* Check heap block consistency */
+			if (head->magic != HEAP_BLOCK_HEAD_MAGIC) {
+				futex_up(&malloc_futex);
+				return (void *) head;
+			}
+			
+			heap_block_foot_t *foot = BLOCK_FOOT(head);
+			
+			if ((foot->magic != HEAP_BLOCK_FOOT_MAGIC) ||
+			    (head->size != foot->size)) {
+				futex_up(&malloc_futex);
+				return (void *) foot;
+			}
+		}
+	}
+	
+	futex_up(&malloc_futex);
+	
+	return NULL;
+}
+
 /** @}
  */
Index: uspace/lib/c/generic/thread.c
===================================================================
--- uspace/lib/c/generic/thread.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/generic/thread.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -44,5 +44,5 @@
 
 #ifndef THREAD_INITIAL_STACK_PAGES_NO
-#define THREAD_INITIAL_STACK_PAGES_NO 1
+#define THREAD_INITIAL_STACK_PAGES_NO	2 
 #endif
 
Index: uspace/lib/c/include/adt/fifo.h
===================================================================
--- uspace/lib/c/include/adt/fifo.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/adt/fifo.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -51,10 +51,10 @@
 typedef unsigned long fifo_index_t;
 
-#define FIFO_CREATE_STATIC(name, t, itms)		\
-	struct {					\
-		t fifo[(itms)];				\
-		fifo_count_t items;			\
-		fifo_index_t head;			\
-		fifo_index_t tail;			\
+#define FIFO_CREATE_STATIC(name, t, itms) \
+	struct { \
+		t fifo[(itms)]; \
+		fifo_count_t items; \
+		fifo_index_t head; \
+		fifo_index_t tail; \
 	} name
 
Index: uspace/lib/c/include/adt/list.h
===================================================================
--- uspace/lib/c/include/adt/list.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/adt/list.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -47,9 +47,18 @@
  *
  * @param name Name of the new statically allocated list.
- */
-#define LIST_INITIALIZE(name)  link_t name = { \
-	.prev = &name, \
-	.next = &name \
-}
+ *
+ */
+#define LIST_INITIALIZE(name) \
+	link_t name = { \
+		.prev = &name, \
+		.next = &name \
+	}
+
+#define list_get_instance(link, type, member) \
+	((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member))))
+
+#define list_foreach(list, iterator) \
+	for (link_t *iterator = (list).next; \
+	    iterator != &(list); iterator = iterator->next)
 
 /** Initialize doubly-linked circular list link
@@ -58,4 +67,5 @@
  *
  * @param link Pointer to link_t structure to be initialized.
+ *
  */
 static inline void link_initialize(link_t *link)
@@ -69,10 +79,11 @@
  * Initialize doubly-linked circular list.
  *
- * @param head Pointer to link_t structure representing head of the list.
- */
-static inline void list_initialize(link_t *head)
-{
-	head->prev = head;
-	head->next = head;
+ * @param list Pointer to link_t structure representing the list.
+ *
+ */
+static inline void list_initialize(link_t *list)
+{
+	list->prev = list;
+	list->next = list;
 }
 
@@ -82,12 +93,13 @@
  *
  * @param link Pointer to link_t structure to be added.
- * @param head Pointer to link_t structure representing head of the list.
- */
-static inline void list_prepend(link_t *link, link_t *head)
-{
-	link->next = head->next;
-	link->prev = head;
-	head->next->prev = link;
-	head->next = link;
+ * @param list Pointer to link_t structure representing the list.
+ *
+ */
+static inline void list_prepend(link_t *link, link_t *list)
+{
+	link->next = list->next;
+	link->prev = list;
+	list->next->prev = link;
+	list->next = link;
 }
 
@@ -97,24 +109,29 @@
  *
  * @param link Pointer to link_t structure to be added.
- * @param head Pointer to link_t structure representing head of the list.
- */
-static inline void list_append(link_t *link, link_t *head)
-{
-	link->prev = head->prev;
-	link->next = head;
-	head->prev->next = link;
-	head->prev = link;
-}
-
-/** Insert item before another item in doubly-linked circular list. */
-static inline void list_insert_before(link_t *l, link_t *r)
-{
-	list_append(l, r);
-}
-
-/** Insert item after another item in doubly-linked circular list. */
-static inline void list_insert_after(link_t *r, link_t *l)
-{
-	list_prepend(l, r);
+ * @param list Pointer to link_t structure representing the list.
+ *
+ */
+static inline void list_append(link_t *link, link_t *list)
+{
+	link->prev = list->prev;
+	link->next = list;
+	list->prev->next = link;
+	list->prev = link;
+}
+
+/** Insert item before another item in doubly-linked circular list.
+ *
+ */
+static inline void list_insert_before(link_t *link, link_t *list)
+{
+	list_append(link, list);
+}
+
+/** Insert item after another item in doubly-linked circular list.
+ *
+ */
+static inline void list_insert_after(link_t *link, link_t *list)
+{
+	list_prepend(list, link);
 }
 
@@ -123,5 +140,7 @@
  * Remove item from doubly-linked circular list.
  *
- * @param link Pointer to link_t structure to be removed from the list it is contained in.
+ * @param link Pointer to link_t structure to be removed from the list
+ *             it is contained in.
+ *
  */
 static inline void list_remove(link_t *link)
@@ -136,11 +155,24 @@
  * Query emptiness of doubly-linked circular list.
  *
- * @param head Pointer to link_t structure representing head of the list.
- */
-static inline int list_empty(link_t *head)
-{
-	return ((head->next == head) ? 1 : 0);
-}
-
+ * @param list Pointer to link_t structure representing the list.
+ *
+ */
+static inline int list_empty(link_t *list)
+{
+	return (list->next == list);
+}
+
+/** Get head item of a list.
+ *
+ * @param list Pointer to link_t structure representing the list.
+ *
+ * @return Head item of the list.
+ * @return NULL if the list is empty.
+ *
+ */
+static inline link_t *list_head(link_t *list)
+{
+	return ((list->next == list) ? NULL : list->next);
+}
 
 /** Split or concatenate headless doubly-linked circular list
@@ -151,6 +183,9 @@
  * concatenates splitted lists and splits concatenated lists.
  *
- * @param part1 Pointer to link_t structure leading the first (half of the headless) list.
- * @param part2 Pointer to link_t structure leading the second (half of the headless) list. 
+ * @param part1 Pointer to link_t structure leading the first
+ *              (half of the headless) list.
+ * @param part2 Pointer to link_t structure leading the second
+ *              (half of the headless) list.
+ *
  */
 static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)
@@ -165,11 +200,13 @@
 }
 
-
 /** Split headless doubly-linked circular list
  *
  * Split headless doubly-linked circular list.
  *
- * @param part1 Pointer to link_t structure leading the first half of the headless list.
- * @param part2 Pointer to link_t structure leading the second half of the headless list. 
+ * @param part1 Pointer to link_t structure leading
+ *              the first half of the headless list.
+ * @param part2 Pointer to link_t structure leading
+ *              the second half of the headless list.
+ *
  */
 static inline void headless_list_split(link_t *part1, link_t *part2)
@@ -182,6 +219,9 @@
  * Concatenate two headless doubly-linked circular lists.
  *
- * @param part1 Pointer to link_t structure leading the first headless list.
- * @param part2 Pointer to link_t structure leading the second headless list. 
+ * @param part1 Pointer to link_t structure leading
+ *              the first headless list.
+ * @param part2 Pointer to link_t structure leading
+ *              the second headless list.
+ *
  */
 static inline void headless_list_concat(link_t *part1, link_t *part2)
@@ -190,9 +230,30 @@
 }
 
-#define list_get_instance(link, type, member)  ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member))))
-
-extern int list_member(const link_t *link, const link_t *head);
-extern void list_concat(link_t *head1, link_t *head2);
-extern unsigned int list_count(const link_t *link);
+/** Get n-th item of a list.
+ *
+ * @param list Pointer to link_t structure representing the list.
+ * @param n    Item number (indexed from zero).
+ *
+ * @return n-th item of the list.
+ * @return NULL if no n-th item found.
+ *
+ */
+static inline link_t *list_nth(link_t *list, unsigned int n)
+{
+	unsigned int cnt = 0;
+	
+	list_foreach(*list, link) {
+		if (cnt == n)
+			return link;
+		
+		cnt++;
+	}
+	
+	return NULL;
+}
+
+extern int list_member(const link_t *, const link_t *);
+extern void list_concat(link_t *, link_t *);
+extern unsigned int list_count(const link_t *);
 
 #endif
Index: uspace/lib/c/include/adt/measured_strings.h
===================================================================
--- uspace/lib/c/include/adt/measured_strings.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/adt/measured_strings.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -61,4 +61,5 @@
 extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t);
 extern measured_string_t *measured_string_copy(measured_string_t *);
+
 extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t);
 extern int measured_strings_reply(const measured_string_t *, size_t);
Index: uspace/lib/c/include/adt/prodcons.h
===================================================================
--- uspace/lib/c/include/adt/prodcons.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
+++ uspace/lib/c/include/adt/prodcons.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_PRODCONS_H_
+#define LIBC_PRODCONS_H_
+
+#include <adt/list.h>
+#include <fibril_synch.h>
+
+typedef struct {
+	fibril_mutex_t mtx;
+	fibril_condvar_t cv;
+	link_t list;
+} prodcons_t;
+
+extern void prodcons_initialize(prodcons_t *);
+extern void prodcons_produce(prodcons_t *, link_t *);
+extern link_t *prodcons_consume(prodcons_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/as.h
===================================================================
--- uspace/lib/c/include/as.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/as.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -54,10 +54,10 @@
 }
 
-extern void *as_area_create(void *address, size_t size, int flags);
-extern int as_area_resize(void *address, size_t size, int flags);
-extern int as_area_change_flags(void *address, int flags);
-extern int as_area_destroy(void *address);
-extern void *set_maxheapsize(size_t mhs);
-extern void * as_get_mappable_page(size_t sz);
+extern void *as_area_create(void *, size_t, unsigned int);
+extern int as_area_resize(void *, size_t, unsigned int);
+extern int as_area_change_flags(void *, unsigned int);
+extern int as_area_destroy(void *);
+extern void *set_maxheapsize(size_t);
+extern void *as_get_mappable_page(size_t);
 
 #endif
Index: uspace/lib/c/include/event.h
===================================================================
--- uspace/lib/c/include/event.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/event.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -39,4 +39,5 @@
 
 extern int event_subscribe(event_type_t, sysarg_t);
+extern int event_unmask(event_type_t);
 
 #endif
Index: uspace/lib/c/include/fibril.h
===================================================================
--- uspace/lib/c/include/fibril.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/fibril.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -70,9 +70,9 @@
 	int (*func)(void *);
 	tcb_t *tcb;
-
+	
 	struct fibril *clean_after_me;
 	int retval;
 	int flags;
-
+	
 	fibril_owner_info_t *waits_for;
 } fibril_t;
Index: uspace/lib/c/include/io/klog.h
===================================================================
--- uspace/lib/c/include/io/klog.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/io/klog.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -37,7 +37,10 @@
 
 #include <sys/types.h>
+#include <stdarg.h>
 
 extern size_t klog_write(const void *, size_t);
 extern void klog_update(void);
+extern int klog_printf(const char *, ...);
+extern int klog_vprintf(const char *, va_list);
 
 #endif
Index: uspace/lib/c/include/malloc.h
===================================================================
--- uspace/lib/c/include/malloc.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/c/include/malloc.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -46,4 +46,5 @@
 extern void *realloc(const void *addr, const size_t size);
 extern void free(const void *addr);
+extern void *heap_check(void);
 
 #endif
Index: uspace/lib/net/il/ip_client.c
===================================================================
--- uspace/lib/net/il/ip_client.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/net/il/ip_client.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -181,6 +181,6 @@
 	/* Set the header */
 	header = (ip_header_t *) data;
-	header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) +
-	    ipopt_length);
+	SET_IP_HEADER_LENGTH(header,
+	    (IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length)));
 	header->ttl = (ttl ? ttl : IPDEFTTL);
 	header->tos = tos;
@@ -188,5 +188,5 @@
 
 	if (dont_fragment)
-		header->flags = IPFLAG_DONT_FRAGMENT;
+		SET_IP_HEADER_FLAGS(header, IPFLAG_DONT_FRAGMENT);
 
 	return EOK;
@@ -227,5 +227,5 @@
 		*tos = header->tos;
 	if (dont_fragment)
-		*dont_fragment = header->flags & IPFLAG_DONT_FRAGMENT;
+		*dont_fragment = GET_IP_HEADER_FLAGS(header) & IPFLAG_DONT_FRAGMENT;
 	if (ipopt_length) {
 		*ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
Index: uspace/lib/net/include/ip_header.h
===================================================================
--- uspace/lib/net/include/ip_header.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/net/include/ip_header.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -64,5 +64,5 @@
  */
 #define IP_FRAGMENT_OFFSET(header) \
-	((((header)->fragment_offset_high << 8) + \
+	(((GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) << 8) + \
 	    (header)->fragment_offset_low) * 8U)
 
@@ -83,5 +83,5 @@
  */
 #define IP_HEADER_LENGTH(header) \
-	((header)->header_length * 4U)
+	(GET_IP_HEADER_LENGTH(header) * 4U)
 
 /** Returns the actual IP packet total length.
@@ -143,11 +143,17 @@
  */
 struct ip_header {
-#ifdef ARCH_IS_BIG_ENDIAN
-	uint8_t version : 4;
-	uint8_t header_length : 4;
-#else
-	uint8_t header_length : 4;
-	uint8_t version : 4;
-#endif
+	uint8_t vhl; /* version, header_length */
+
+#define GET_IP_HEADER_VERSION(header) \
+	(((header)->vhl & 0xf0) >> 4)
+#define SET_IP_HEADER_VERSION(header, version) \
+	((header)->vhl = \
+	 ((version & 0x0f) << 4) | ((header)->vhl & 0x0f))
+
+#define GET_IP_HEADER_LENGTH(header) \
+	((header)->vhl & 0x0f)
+#define SET_IP_HEADER_LENGTH(header, length) \
+	((header)->vhl = \
+	 (length & 0x0f) | ((header)->vhl & 0xf0))
 
 	uint8_t tos;
@@ -155,11 +161,17 @@
 	uint16_t identification;
 
-#ifdef ARCH_IS_BIG_ENDIAN
-	uint8_t flags : 3;
-	uint8_t fragment_offset_high : 5;
-#else
-	uint8_t fragment_offset_high : 5;
-	uint8_t flags : 3;
-#endif
+	uint8_t ffoh; /* flags, fragment_offset_high */
+
+#define GET_IP_HEADER_FLAGS(header) \
+	(((header)->ffoh & 0xe0) >> 5)
+#define SET_IP_HEADER_FLAGS(header, flags) \
+	((header)->ffoh = \
+	 ((flags & 0x07) << 5) | ((header)->ffoh & 0x1f))
+
+#define GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) \
+	((header)->ffoh & 0x1f)
+#define SET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header, fragment_offset_high) \
+	((header)->ffoh = \
+	 (fragment_offset_high & 0x1f) | ((header)->ffoh & 0xe0))
 
 	uint8_t fragment_offset_low;
@@ -181,11 +193,18 @@
 	uint8_t pointer;
 
-#ifdef ARCH_IS_BIG_ENDIAN
-	uint8_t overflow : 4;
-	uint8_t flags : 4;
-#else
-	uint8_t flags : 4;
-	uint8_t overflow : 4;
-#endif
+	uint8_t of; /* overflow, flags */
+
+#define GET_IP_OPTION_OVERFLOW(option) \
+	(((option)->of & 0xf0) >> 4)
+#define SET_IP_OPTION_OVERFLOW(option, overflow) \
+	((option)->of = \
+	 ((overflow & 0x0f) << 4) | ((option)->of & 0x0f))
+
+#define GET_IP_OPTION_FLAGS(option) \
+	((option)->of & 0x0f)
+#define SET_IP_OPTION_FLAGS(option, flags) \
+	((option)->of = \
+	 (flags & 0x0f) | ((option)->of & 0xf0))
+
 } __attribute__ ((packed));
 
Index: uspace/lib/softfloat/generic/add.c
===================================================================
--- uspace/lib/softfloat/generic/add.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/add.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -33,7 +33,7 @@
  */
 
-#include<sftypes.h>
-#include<add.h>
-#include<comparison.h>
+#include <sftypes.h>
+#include <add.h>
+#include <comparison.h>
 
 /** Add two Float32 numbers with same signs
@@ -139,9 +139,8 @@
 	a.parts.exp = exp1;
 	
-	/*Clear hidden bit and shift */
+	/* Clear hidden bit and shift */
 	a.parts.fraction = ((frac1 >> 6) & (~FLOAT32_HIDDEN_BIT_MASK)) ; 
 	return a;
 }
-
 
 /** Add two Float64 numbers with same signs
@@ -250,5 +249,5 @@
 	
 	a.parts.exp = exp1;
-	/*Clear hidden bit and shift */
+	/* Clear hidden bit and shift */
 	a.parts.fraction = ( (frac1 >> 6 ) & (~FLOAT64_HIDDEN_BIT_MASK));
 	
Index: uspace/lib/softfloat/generic/common.c
===================================================================
--- uspace/lib/softfloat/generic/common.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/common.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -33,6 +33,6 @@
  */
 
-#include<sftypes.h>
-#include<common.h>
+#include <sftypes.h>
+#include <common.h>
 
 /* Table for fast leading zeroes counting */
@@ -213,3 +213,2 @@
 /** @}
  */
-
Index: uspace/lib/softfloat/generic/comparison.c
===================================================================
--- uspace/lib/softfloat/generic/comparison.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/comparison.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -33,43 +33,47 @@
  */
 
-#include<sftypes.h>
-#include<comparison.h>
+#include <sftypes.h>
+#include <comparison.h>
 
-inline int isFloat32NaN(float32 f)
-{	/* NaN : exp = 0xff and nonzero fraction */
-	return ((f.parts.exp==0xFF)&&(f.parts.fraction));
+/* NaN : exp = 0xff and nonzero fraction */
+int isFloat32NaN(float32 f)
+{
+	return ((f.parts.exp == 0xFF) && (f.parts.fraction));
 }
 
-inline int isFloat64NaN(float64 d)
-{	/* NaN : exp = 0x7ff and nonzero fraction */
-	return ((d.parts.exp==0x7FF)&&(d.parts.fraction));
+/* NaN : exp = 0x7ff and nonzero fraction */
+int isFloat64NaN(float64 d)
+{
+	return ((d.parts.exp == 0x7FF) && (d.parts.fraction));
 }
 
-inline int isFloat32SigNaN(float32 f)
-{	/* SigNaN : exp = 0xff fraction = 0xxxxx..x (binary), where at least one x is nonzero */
-	return ((f.parts.exp==0xFF)&&(f.parts.fraction<0x400000)&&(f.parts.fraction));
+/* SigNaN : exp = 0xff fraction = 0xxxxx..x (binary), where at least one x is nonzero */
+int isFloat32SigNaN(float32 f)
+{
+	return ((f.parts.exp == 0xFF) && (f.parts.fraction < 0x400000) && (f.parts.fraction));
 }
 
-inline int isFloat64SigNaN(float64 d)
-{	/* SigNaN : exp = 0x7ff fraction = 0xxxxx..x (binary), where at least one x is nonzero */
-	return ((d.parts.exp==0x7FF)&&(d.parts.fraction)&&(d.parts.fraction<0x8000000000000ll));
+/* SigNaN : exp = 0x7ff fraction = 0xxxxx..x (binary), where at least one x is nonzero */
+int isFloat64SigNaN(float64 d)
+{
+	return ((d.parts.exp == 0x7FF) && (d.parts.fraction) && (d.parts.fraction < 0x8000000000000ll));
 }
 
-inline int isFloat32Infinity(float32 f) 
+int isFloat32Infinity(float32 f)
 {
-	return ((f.parts.exp==0xFF)&&(f.parts.fraction==0x0));
+	return ((f.parts.exp == 0xFF) && (f.parts.fraction == 0x0));
 }
 
-inline int isFloat64Infinity(float64 d) 
+int isFloat64Infinity(float64 d) 
 {
-	return ((d.parts.exp==0x7FF)&&(d.parts.fraction==0x0));
+	return ((d.parts.exp == 0x7FF) && (d.parts.fraction == 0x0));
 }
 
-inline int isFloat32Zero(float32 f)
+int isFloat32Zero(float32 f)
 {
 	return (((f.binary) & 0x7FFFFFFF) == 0);
 }
 
-inline int isFloat64Zero(float64 d)
+int isFloat64Zero(float64 d)
 {
 	return (((d.binary) & 0x7FFFFFFFFFFFFFFFll) == 0);
@@ -77,51 +81,46 @@
 
 /**
- * @return 1, if both floats are equal - but NaNs are not recognized 
+ * @return 1 if both floats are equal - but NaNs are not recognized
  */
-inline int isFloat32eq(float32 a, float32 b)
+int isFloat32eq(float32 a, float32 b)
 {
-	return ((a.binary==b.binary)||(((a.binary| b.binary)&0x7FFFFFFF)==0)); /* a equals to b or both are zeros (with any sign) */
+	/* a equals to b or both are zeros (with any sign) */
+	return ((a.binary==b.binary) || (((a.binary | b.binary) & 0x7FFFFFFF) == 0));
 }
 
 /**
- * @return 1, if a<b - but NaNs are not recognized 
+ * @return 1 if a < b - but NaNs are not recognized 
  */
-inline int isFloat32lt(float32 a, float32 b) 
+int isFloat32lt(float32 a, float32 b) 
 {
-	if (((a.binary| b.binary)&0x7FFFFFFF)==0) {
+	if (((a.binary | b.binary) & 0x7FFFFFFF) == 0)
 		return 0; /* +- zeroes */
-	};
 	
-	if ((a.parts.sign)&&(b.parts.sign)) {
-		/*if both are negative, smaller is that with greater binary value*/
-		return (a.binary>b.binary);
-		};
+	if ((a.parts.sign) && (b.parts.sign))
+		/* if both are negative, smaller is that with greater binary value */
+		return (a.binary > b.binary);
 	
-	/* lets negate signs - now will be positive numbers allways bigger than negative (first bit will be set for unsigned integer comparison)*/
-	a.parts.sign=!a.parts.sign;
-	b.parts.sign=!b.parts.sign;
-	return (a.binary<b.binary);
-			
+	/* lets negate signs - now will be positive numbers allways bigger than negative (first bit will be set for unsigned integer comparison) */
+	a.parts.sign = !a.parts.sign;
+	b.parts.sign = !b.parts.sign;
+	return (a.binary < b.binary);
 }
 
 /**
- * @return 1, if a>b - but NaNs are not recognized 
+ * @return 1 if a > b - but NaNs are not recognized 
  */
-inline int isFloat32gt(float32 a, float32 b) 
+int isFloat32gt(float32 a, float32 b) 
 {
-	if (((a.binary| b.binary)&0x7FFFFFFF)==0) {
+	if (((a.binary | b.binary) & 0x7FFFFFFF) == 0)
 		return 0; /* zeroes are equal with any sign */
-	};
 	
-	if ((a.parts.sign)&&(b.parts.sign)) {
-		/*if both are negative, greater is that with smaller binary value*/
-		return (a.binary<b.binary);
-		};
+	if ((a.parts.sign) && (b.parts.sign))
+		/* if both are negative, greater is that with smaller binary value */
+		return (a.binary < b.binary);
 	
-	/* lets negate signs - now will be positive numbers allways bigger than negative (first bit will be set for unsigned integer comparison)*/
-	a.parts.sign=!a.parts.sign;
-	b.parts.sign=!b.parts.sign;
-	return (a.binary>b.binary);
-			
+	/* lets negate signs - now will be positive numbers allways bigger than negative (first bit will be set for unsigned integer comparison) */
+	a.parts.sign = !a.parts.sign;
+	b.parts.sign = !b.parts.sign;
+	return (a.binary > b.binary);
 }
 
Index: uspace/lib/softfloat/generic/div.c
===================================================================
--- uspace/lib/softfloat/generic/div.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/div.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -33,11 +33,10 @@
  */
 
-#include<sftypes.h>
-#include<add.h>
-#include<div.h>
-#include<comparison.h>
-#include<mul.h>
-#include<common.h>
-
+#include <sftypes.h>
+#include <add.h>
+#include <div.h>
+#include <comparison.h>
+#include <mul.h>
+#include <common.h>
 
 float32 divFloat32(float32 a, float32 b) 
Index: uspace/lib/softfloat/generic/mul.c
===================================================================
--- uspace/lib/softfloat/generic/mul.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/mul.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -33,8 +33,8 @@
  */
 
-#include<sftypes.h>
-#include<mul.h>
-#include<comparison.h>
-#include<common.h>
+#include <sftypes.h>
+#include <mul.h>
+#include <comparison.h>
+#include <common.h>
 
 /** Multiply two 32 bit float numbers
Index: uspace/lib/softfloat/generic/other.c
===================================================================
--- uspace/lib/softfloat/generic/other.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/other.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
Index: uspace/lib/softfloat/generic/softfloat.c
===================================================================
--- uspace/lib/softfloat/generic/softfloat.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/softfloat.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -35,17 +35,17 @@
  */
 
-#include<softfloat.h>
-#include<sftypes.h>
-
-#include<add.h>
-#include<sub.h>
-#include<mul.h>
-#include<div.h>
-
-#include<conversion.h>
-#include<comparison.h>
-#include<other.h>
-
-#include<functions.h>
+#include <softfloat.h>
+#include <sftypes.h>
+
+#include <add.h>
+#include <sub.h>
+#include <mul.h>
+#include <div.h>
+
+#include <conversion.h>
+#include <comparison.h>
+#include <other.h>
+
+#include <functions.h>
 
 /* Arithmetic functions */
@@ -494,6 +494,4 @@
 }
 
-
 /** @}
  */
-
Index: uspace/lib/softfloat/generic/sub.c
===================================================================
--- uspace/lib/softfloat/generic/sub.c	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/generic/sub.c	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -33,7 +33,7 @@
  */
 
-#include<sftypes.h>
-#include<sub.h>
-#include<comparison.h>
+#include <sftypes.h>
+#include <sub.h>
+#include <comparison.h>
 
 /** Subtract two float32 numbers with same signs
@@ -260,6 +260,4 @@
 }
 
-
- /** @}
- */
-
+/** @}
+ */
Index: uspace/lib/softfloat/include/add.h
===================================================================
--- uspace/lib/softfloat/include/add.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/add.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,12 +36,9 @@
 #define __ADD_H__
 
-float32 addFloat32(float32 a, float32 b);
-
-float64 addFloat64(float64 a, float64 b);
+extern float32 addFloat32(float32, float32);
+extern float64 addFloat64(float64, float64);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/common.h
===================================================================
--- uspace/lib/softfloat/include/common.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/common.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,18 +36,17 @@
 #define __COMMON_H__
 
-#include<sftypes.h>
+#include <sftypes.h>
 
-float64 finishFloat64(int32_t cexp, uint64_t cfrac, char sign);
+extern float64 finishFloat64(int32_t, uint64_t, char);
 
-int countZeroes64(uint64_t i);
-int countZeroes32(uint32_t i);
-int countZeroes8(uint8_t i);
+extern int countZeroes64(uint64_t);
+extern int countZeroes32(uint32_t);
+extern int countZeroes8(uint8_t);
 
-void roundFloat32(int32_t *exp, uint32_t *fraction);
-void roundFloat64(int32_t *exp, uint64_t *fraction);
+extern void roundFloat32(int32_t *, uint32_t *);
+extern void roundFloat64(int32_t *, uint64_t *);
 
 #endif
 
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/comparison.h
===================================================================
--- uspace/lib/softfloat/include/comparison.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/comparison.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,24 +36,22 @@
 #define __COMPARISON_H__
 
-inline int isFloat32NaN(float32 f);
-inline int isFloat32SigNaN(float32 f);
+extern int isFloat32NaN(float32);
+extern int isFloat32SigNaN(float32);
 
-inline int isFloat32Infinity(float32 f);
-inline int isFloat32Zero(float32 f);
+extern int isFloat32Infinity(float32);
+extern int isFloat32Zero(float32);
 
-inline int isFloat64NaN(float64 d);
-inline int isFloat64SigNaN(float64 d);
+extern int isFloat64NaN(float64);
+extern int isFloat64SigNaN(float64);
 
-inline int isFloat64Infinity(float64 d);
-inline int isFloat64Zero(float64 d);
+extern int isFloat64Infinity(float64);
+extern int isFloat64Zero(float64);
 
-inline int isFloat32eq(float32 a, float32 b);
-inline int isFloat32lt(float32 a, float32 b);
-inline int isFloat32gt(float32 a, float32 b);
+extern int isFloat32eq(float32, float32);
+extern int isFloat32lt(float32, float32);
+extern int isFloat32gt(float32, float32);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/conversion.h
===================================================================
--- uspace/lib/softfloat/include/conversion.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/conversion.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+ /** @addtogroup softfloat
  * @{
  */
@@ -36,36 +36,33 @@
 #define __CONVERSION_H__
 
-float64 convertFloat32ToFloat64(float32 a);
+extern float64 convertFloat32ToFloat64(float32);
+extern float32 convertFloat64ToFloat32(float64);
 
-float32 convertFloat64ToFloat32(float64 a);
+extern uint32_t float32_to_uint32(float32);
+extern int32_t float32_to_int32(float32);
 
-uint32_t float32_to_uint32(float32 a);
-int32_t float32_to_int32(float32 a);
+extern uint64_t float32_to_uint64(float32);
+extern int64_t float32_to_int64(float32);
 
-uint64_t float32_to_uint64(float32 a);
-int64_t float32_to_int64(float32 a);
+extern uint64_t float64_to_uint64(float64);
+extern int64_t float64_to_int64(float64);
 
-uint64_t float64_to_uint64(float64 a);
-int64_t float64_to_int64(float64 a);
+extern uint32_t float64_to_uint32(float64);
+extern int32_t float64_to_int32(float64);
 
-uint32_t float64_to_uint32(float64 a);
-int32_t float64_to_int32(float64 a);
+extern float32 uint32_to_float32(uint32_t);
+extern float32 int32_to_float32(int32_t);
 
-float32 uint32_to_float32(uint32_t i);
-float32 int32_to_float32(int32_t i);
+extern float32 uint64_to_float32(uint64_t);
+extern float32 int64_to_float32(int64_t);
 
-float32 uint64_to_float32(uint64_t i);
-float32 int64_to_float32(int64_t i);
+extern float64 uint32_to_float64(uint32_t);
+extern float64 int32_to_float64(int32_t);
 
-float64 uint32_to_float64(uint32_t i);
-float64 int32_to_float64(int32_t i);
-
-float64 uint64_to_float64(uint64_t i);
-float64 int64_to_float64(int64_t i);
+extern float64 uint64_to_float64(uint64_t);
+extern float64 int64_to_float64(int64_t);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/div.h
===================================================================
--- uspace/lib/softfloat/include/div.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/div.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,13 +36,11 @@
 #define __DIV_H__
 
-float32 divFloat32(float32 a, float32 b);
-float64 divFloat64(float64 a, float64 b);
+extern float32 divFloat32(float32, float32);
+extern float64 divFloat64(float64, float64);
 
-uint64_t divFloat64estim(uint64_t a, uint64_t b);
+extern uint64_t divFloat64estim(uint64_t, uint64_t);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/mul.h
===================================================================
--- uspace/lib/softfloat/include/mul.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/mul.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,14 +36,11 @@
 #define __MUL_H__
 
-float32 mulFloat32(float32 a, float32 b);
+extern float32 mulFloat32(float32, float32);
+extern float64 mulFloat64(float64, float64);
 
-float64 mulFloat64(float64 a, float64 b);
-
-void mul64integers(uint64_t a,uint64_t b, uint64_t *lo, uint64_t *hi);
+extern void mul64integers(uint64_t, uint64_t, uint64_t *, uint64_t *);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/other.h
===================================================================
--- uspace/lib/softfloat/include/other.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/other.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -38,6 +38,4 @@
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/sftypes.h
===================================================================
--- uspace/lib/softfloat/include/sftypes.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/sftypes.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -55,5 +55,5 @@
 	#error Unknown endianess
 #endif
-		} parts __attribute__ ((packed));
+	} parts __attribute__ ((packed));
 } float32;
 
@@ -77,6 +77,6 @@
 } float64;
 
-#define FLOAT32_MAX 0x7f800000
-#define FLOAT32_MIN 0xff800000
+#define FLOAT32_MAX  0x7f800000
+#define FLOAT32_MIN  0xff800000
 #define FLOAT64_MAX
 #define FLOAT64_MIN
@@ -86,25 +86,25 @@
  * comparing with these constants is not sufficient.
  */
-#define FLOAT32_NAN 0x7FC00001
-#define FLOAT32_SIGNAN 0x7F800001
-#define FLOAT32_INF 0x7F800000
 
-#define FLOAT64_NAN 0x7FF8000000000001ll
-#define FLOAT64_SIGNAN 0x7FF0000000000001ll
-#define FLOAT64_INF 0x7FF0000000000000ll
+#define FLOAT32_NAN     0x7FC00001
+#define FLOAT32_SIGNAN  0x7F800001
+#define FLOAT32_INF     0x7F800000
 
-#define FLOAT32_FRACTION_SIZE 23
-#define FLOAT64_FRACTION_SIZE 52
+#define FLOAT64_NAN     0x7FF8000000000001ll
+#define FLOAT64_SIGNAN  0x7FF0000000000001ll
+#define FLOAT64_INF     0x7FF0000000000000ll
 
-#define FLOAT32_HIDDEN_BIT_MASK 0x800000
-#define FLOAT64_HIDDEN_BIT_MASK 0x10000000000000ll
+#define FLOAT32_FRACTION_SIZE  23
+#define FLOAT64_FRACTION_SIZE  52
 
-#define FLOAT32_MAX_EXPONENT 0xFF
-#define FLOAT64_MAX_EXPONENT 0x7FF
+#define FLOAT32_HIDDEN_BIT_MASK  0x800000
+#define FLOAT64_HIDDEN_BIT_MASK  0x10000000000000ll
 
-#define FLOAT32_BIAS 0x7F
-#define FLOAT64_BIAS 0x3FF
-#define FLOAT80_BIAS 0x3FFF
+#define FLOAT32_MAX_EXPONENT  0xFF
+#define FLOAT64_MAX_EXPONENT  0x7FF
 
+#define FLOAT32_BIAS  0x7F
+#define FLOAT64_BIAS  0x3FF
+#define FLOAT80_BIAS  0x3FFF
 
 #endif
Index: uspace/lib/softfloat/include/softfloat.h
===================================================================
--- uspace/lib/softfloat/include/softfloat.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/softfloat.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,139 +36,137 @@
 #define __SOFTFLOAT_H__
 
-float __addsf3(float a, float b);
-double __adddf3(double a, double b);
-long double __addtf3(long double a, long double b);
-long double __addxf3(long double a, long double b);
- 
-float __subsf3(float a, float b);
-double __subdf3(double a, double b);
-long double __subtf3(long double a, long double b);
-long double __subxf3(long double a, long double b);
- 
-float __mulsf3(float a, float b);
-double __muldf3(double a, double b);
-long double __multf3(long double a, long double b);
-long double __mulxf3(long double a, long double b);
- 
-float __divsf3(float a, float b);
-double __divdf3(double a, double b);
-long double __divtf3(long double a, long double b);
-long double __divxf3(long double a, long double b);
- 
-float __negsf2(float a);
-double __negdf2(double a);
-long double __negtf2(long double a);
-long double __negxf2(long double a);
- 
-double __extendsfdf2(float a);
-long double __extendsftf2(float a);
-long double __extendsfxf2(float a);
-long double __extenddftf2(double a);
-long double __extenddfxf2(double a);
- 
-double __truncxfdf2(long double a);
-double __trunctfdf2(long double a);
-float __truncxfsf2(long double a);
-float __trunctfsf2(long double a);
-float __truncdfsf2(double a);
- 
-int __fixsfsi(float a);
-int __fixdfsi(double a);
-int __fixtfsi(long double a);
-int __fixxfsi(long double a);
- 
-long __fixsfdi(float a);
-long __fixdfdi(double a);
-long __fixtfdi(long double a);
-long __fixxfdi(long double a);
- 
-long long __fixsfti(float a);
-long long __fixdfti(double a);
-long long __fixtfti(long double a);
-long long __fixxfti(long double a);
- 
-unsigned int __fixunssfsi(float a);
-unsigned int __fixunsdfsi(double a);
-unsigned int __fixunstfsi(long double a);
-unsigned int __fixunsxfsi(long double a);
- 
-unsigned long __fixunssfdi(float a);
-unsigned long __fixunsdfdi(double a);
-unsigned long __fixunstfdi(long double a);
-unsigned long __fixunsxfdi(long double a);
- 
-unsigned long long __fixunssfti(float a);
-unsigned long long __fixunsdfti(double a);
-unsigned long long __fixunstfti(long double a);
-unsigned long long __fixunsxfti(long double a);
- 
-float __floatsisf(int i);
-double __floatsidf(int i);
-long double __floatsitf(int i);
-long double __floatsixf(int i);
- 
-float __floatdisf(long i);
-double __floatdidf(long i);
-long double __floatditf(long i);
-long double __floatdixf(long i);
- 
-float __floattisf(long long i);
-double __floattidf(long long i);
-long double __floattitf(long long i);
-long double __floattixf(long long i);
- 
-float __floatunsisf(unsigned int i);
-double __floatunsidf(unsigned int i);
-long double __floatunsitf(unsigned int i);
-long double __floatunsixf(unsigned int i);
- 
-float __floatundisf(unsigned long i);
-double __floatundidf(unsigned long i);
-long double __floatunditf(unsigned long i);
-long double __floatundixf(unsigned long i);
- 
-float __floatuntisf(unsigned long long i);
-double __floatuntidf(unsigned long long i);
-long double __floatuntitf(unsigned long long i);
-long double __floatuntixf(unsigned long long i);
- 
-int __cmpsf2(float a, float b);
-int __cmpdf2(double a, double b);
-int __cmptf2(long double a, long double b);
- 
-int __unordsf2(float a, float b);
-int __unorddf2(double a, double b);
-int __unordtf2(long double a, long double b);
- 
-int __eqsf2(float a, float b);
-int __eqdf2(double a, double b);
-int __eqtf2(long double a, long double b);
- 
-int __nesf2(float a, float b);
-int __nedf2(double a, double b);
-int __netf2(long double a, long double b);
- 
-int __gesf2(float a, float b);
-int __gedf2(double a, double b);
-int __getf2(long double a, long double b);
- 
-int __ltsf2(float a, float b);
-int __ltdf2(double a, double b);
-int __lttf2(long double a, long double b);
-int __lesf2(float a, float b);
-int __ledf2(double a, double b);
-int __letf2(long double a, long double b);
- 
-int __gtsf2(float a, float b);
-int __gtdf2(double a, double b);
-int __gttf2(long double a, long double b);
- 
-/* Not implemented yet*/ 
-float __powisf2(float a, int b);
+extern float __addsf3(float, float);
+extern double __adddf3(double, double);
+extern long double __addtf3(long double, long double);
+extern long double __addxf3(long double, long double);
+
+extern float __subsf3(float, float);
+extern double __subdf3(double, double);
+extern long double __subtf3(long double, long double);
+extern long double __subxf3(long double, long double);
+
+extern float __mulsf3(float, float);
+extern double __muldf3(double, double);
+extern long double __multf3(long double, long double);
+extern long double __mulxf3(long double, long double);
+
+extern float __divsf3(float, float);
+extern double __divdf3(double, double);
+extern long double __divtf3(long double, long double);
+extern long double __divxf3(long double, long double);
+
+extern float __negsf2(float);
+extern double __negdf2(double);
+extern long double __negtf2(long double);
+extern long double __negxf2(long double);
+
+extern double __extendsfdf2(float);
+extern long double __extendsftf2(float);
+extern long double __extendsfxf2(float);
+extern long double __extenddftf2(double);
+extern long double __extenddfxf2(double);
+
+extern double __truncxfdf2(long double);
+extern double __trunctfdf2(long double);
+extern float __truncxfsf2(long double);
+extern float __trunctfsf2(long double);
+extern float __truncdfsf2(double);
+
+extern int __fixsfsi(float);
+extern int __fixdfsi(double);
+extern int __fixtfsi(long double);
+extern int __fixxfsi(long double);
+
+extern long __fixsfdi(float);
+extern long __fixdfdi(double);
+extern long __fixtfdi(long double);
+extern long __fixxfdi(long double);
+
+extern long long __fixsfti(float);
+extern long long __fixdfti(double);
+extern long long __fixtfti(long double);
+extern long long __fixxfti(long double);
+
+extern unsigned int __fixunssfsi(float);
+extern unsigned int __fixunsdfsi(double);
+extern unsigned int __fixunstfsi(long double);
+extern unsigned int __fixunsxfsi(long double);
+
+extern unsigned long __fixunssfdi(float);
+extern unsigned long __fixunsdfdi(double);
+extern unsigned long __fixunstfdi(long double);
+extern unsigned long __fixunsxfdi(long double);
+
+extern unsigned long long __fixunssfti(float);
+extern unsigned long long __fixunsdfti(double);
+extern unsigned long long __fixunstfti(long double);
+extern unsigned long long __fixunsxfti(long double);
+
+extern float __floatsisf(int);
+extern double __floatsidf(int);
+extern long double __floatsitf(int);
+extern long double __floatsixf(int);
+
+extern float __floatdisf(long);
+extern double __floatdidf(long);
+extern long double __floatditf(long);
+extern long double __floatdixf(long);
+
+extern float __floattisf(long long);
+extern double __floattidf(long long);
+extern long double __floattitf(long long);
+extern long double __floattixf(long long);
+
+extern float __floatunsisf(unsigned int);
+extern double __floatunsidf(unsigned int);
+extern long double __floatunsitf(unsigned int);
+extern long double __floatunsixf(unsigned int);
+
+extern float __floatundisf(unsigned long);
+extern double __floatundidf(unsigned long);
+extern long double __floatunditf(unsigned long);
+extern long double __floatundixf(unsigned long);
+
+extern float __floatuntisf(unsigned long long);
+extern double __floatuntidf(unsigned long long);
+extern long double __floatuntitf(unsigned long long);
+extern long double __floatuntixf(unsigned long long);
+
+extern int __cmpsf2(float, float);
+extern int __cmpdf2(double, double);
+extern int __cmptf2(long double, long double);
+
+extern int __unordsf2(float, float);
+extern int __unorddf2(double, double);
+extern int __unordtf2(long double, long double);
+
+extern int __eqsf2(float, float);
+extern int __eqdf2(double, double);
+extern int __eqtf2(long double, long double);
+
+extern int __nesf2(float, float);
+extern int __nedf2(double, double);
+extern int __netf2(long double, long double);
+
+extern int __gesf2(float, float);
+extern int __gedf2(double, double);
+extern int __getf2(long double, long double);
+
+extern int __ltsf2(float, float);
+extern int __ltdf2(double, double);
+extern int __lttf2(long double, long double);
+extern int __lesf2(float, float);
+extern int __ledf2(double, double);
+extern int __letf2(long double, long double);
+
+extern int __gtsf2(float, float);
+extern int __gtdf2(double, double);
+extern int __gttf2(long double, long double);
+
+/* Not implemented yet */
+extern float __powisf2(float, int);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
Index: uspace/lib/softfloat/include/sub.h
===================================================================
--- uspace/lib/softfloat/include/sub.h	(revision 9bd5746c4f2e0a7570a3b6931555da06d7d99b7f)
+++ uspace/lib/softfloat/include/sub.h	(revision cf5e86e549aa562979bea4debb3f5231e65b77c5)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -36,12 +36,9 @@
 #define __SUB_H__
 
-float32 subFloat32(float32 a, float32 b);
-
-float64 subFloat64(float64 a, float64 b);
+extern float32 subFloat32(float32, float32);
+extern float64 subFloat64(float64, float64);
 
 #endif
 
-
- /** @}
+/** @}
  */
-
