Index: kernel/generic/src/adt/avl.c
===================================================================
--- kernel/generic/src/adt/avl.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/adt/avl.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -44,5 +44,5 @@
  * Every node has a pointer to its parent which allows insertion of multiple
  * identical keys into the tree.
- * 
+ *
  * Be careful when using this tree because of the base atribute which is added
  * to every inserted node key. There is no rule in which order nodes with the
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/console/cmd.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -530,5 +530,5 @@
 	}
 	
-	spinlock_unlock(&cmd_lock);	
+	spinlock_unlock(&cmd_lock);
 
 	return 1;
Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/console/console.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -127,7 +127,5 @@
 	
 	klog_parea.pbase = (uintptr_t) faddr;
-	klog_parea.vbase = (uintptr_t) klog;
 	klog_parea.frames = SIZE2FRAMES(KLOG_SIZE);
-	klog_parea.cacheable = true;
 	ddi_parea_register(&klog_parea);
 
Index: kernel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/ddi/ddi.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -48,5 +48,5 @@
 #include <synch/spinlock.h>
 #include <syscall/copy.h>
-#include <adt/btree.h>
+#include <adt/list.h>
 #include <arch.h>
 #include <align.h>
@@ -56,11 +56,15 @@
 SPINLOCK_INITIALIZE(parea_lock);
 
-/** B+tree with enabled physical memory areas. */
-static btree_t parea_btree;
+/** List with enabled physical memory areas. */
+static LIST_INITIALIZE(parea_head);
+
+/** Physical memory area for devices. */
+static parea_t dev_area;
 
 /** Initialize DDI. */
 void ddi_init(void)
 {
-	btree_create(&parea_btree);
+	hw_area(&dev_area.pbase, &dev_area.frames);
+	ddi_parea_register(&dev_area);
 }
 
@@ -75,5 +79,5 @@
 {
 	ipl_t ipl;
-
+	
 	ipl = interrupts_disable();
 	spinlock_lock(&parea_lock);
@@ -81,11 +85,11 @@
 	/*
 	 * TODO: we should really check for overlaps here.
-	 * However, we should be safe because the kernel is pretty sane and
-	 * memory of different devices doesn't overlap. 
-	 */
-	btree_insert(&parea_btree, (btree_key_t) parea->pbase, parea, NULL);
-
+	 * However, we should be safe because the kernel is pretty sane.
+	 */
+	link_initialize(&parea->link);
+	list_append(&parea->link, &parea_head);
+	
 	spinlock_unlock(&parea_lock);
-	interrupts_restore(ipl);	
+	interrupts_restore(ipl);
 }
 
@@ -98,14 +102,14 @@
  *
  * @return 0 on success, EPERM if the caller lacks capabilities to use this
- * 	syscall, ENOENT if there is no task matching the specified ID or the
- * 	physical address space is not enabled for mapping and ENOMEM if there
- * 	was a problem in creating address space area.
- */
-static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags)
+ *  syscall, ENOENT if there is no task matching the specified ID or the
+ *  physical address space is not enabled for mapping and ENOMEM if there
+ *  was a problem in creating address space area.
+ */
+static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, pfn_t pages, int flags)
 {
 	ipl_t ipl;
 	cap_t caps;
 	mem_backend_data_t backend_data;
-
+	
 	backend_data.base = pf;
 	backend_data.frames = pages;
@@ -117,28 +121,33 @@
 	if (!(caps & CAP_MEM_MANAGER))
 		return EPERM;
-
+	
 	ipl = interrupts_disable();
-
+	
 	/*
 	 * Check if the physical memory area is enabled for mapping.
-	 * If the architecture supports virtually indexed caches, intercept
-	 * attempts to create an illegal address alias.
 	 */
 	spinlock_lock(&parea_lock);
-	parea_t *parea;
-	btree_node_t *nodep;
-	parea = (parea_t *) btree_search(&parea_btree, (btree_key_t) pf, &nodep);
-	if (!parea || parea->frames < pages || ((flags & AS_AREA_CACHEABLE) &&
-	    !parea->cacheable) || (!(flags & AS_AREA_CACHEABLE) &&
-	    parea->cacheable)) {
+	
+	bool fnd = false;
+	link_t *cur;
+	
+	for (cur = parea_head.next; cur != &parea_head; cur = cur->next) {
+		parea_t *parea = list_get_instance(cur, parea_t, link);
+		if ((parea->pbase <= pf) && (ADDR2PFN(pf - parea->pbase) + pages <= parea->frames)) {
+			fnd = true;
+			break;
+		}
+	}
+	
+	spinlock_unlock(&parea_lock);
+	
+	if (!fnd) {
 		/*
-		 * This physical memory area cannot be mapped.
+		 * Physical memory area cannot be mapped.
 		 */
-		spinlock_unlock(&parea_lock);
 		interrupts_restore(ipl);
 		return ENOENT;
 	}
-	spinlock_unlock(&parea_lock);
-
+	
 	spinlock_lock(&TASK->lock);
 	
@@ -227,5 +236,5 @@
 	return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
 	    FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
-	    (count_t) pages, (int) flags);
+	    (pfn_t) pages, (int) flags);
 }
 
@@ -259,11 +268,11 @@
 unative_t sys_preempt_control(int enable)
 {
-        if (!cap_get(TASK) & CAP_PREEMPT_CONTROL)
-                return EPERM;
-        if (enable)
-                preemption_enable();
-        else
-                preemption_disable();
-        return 0;
+	if (!cap_get(TASK) & CAP_PREEMPT_CONTROL)
+		return EPERM;
+	if (enable)
+		preemption_enable();
+	else
+		preemption_disable();
+	return 0;
 }
 
Index: kernel/generic/src/lib/rd.c
===================================================================
--- kernel/generic/src/lib/rd.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/lib/rd.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -89,7 +89,5 @@
 	rd_parea.pbase = ALIGN_DOWN((uintptr_t) KA2PA((void *) header + hsize),
 	    FRAME_SIZE);
-	rd_parea.vbase = (uintptr_t) ((void *) header + hsize);
 	rd_parea.frames = SIZE2FRAMES(dsize);
-	rd_parea.cacheable = true;
 	ddi_parea_register(&rd_parea);
 
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/proc/task.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -340,5 +340,5 @@
 		
 		thr = list_get_instance(cur, thread_t, th_link);
-			
+		
 		spinlock_lock(&thr->lock);
 		thr->interrupted = true;
Index: kernel/generic/src/time/clock.c
===================================================================
--- kernel/generic/src/time/clock.c	(revision 6cd9aa607e6515e17e369c7e888779416251db4d)
+++ kernel/generic/src/time/clock.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
@@ -89,7 +89,5 @@
 
 	clock_parea.pbase = (uintptr_t) faddr;
-	clock_parea.vbase = (uintptr_t) uptime;
 	clock_parea.frames = 1;
-	clock_parea.cacheable = true;
 	ddi_parea_register(&clock_parea);
 
