Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/Makefile	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -228,5 +228,4 @@
 	generic/src/syscall/syscall.c \
 	generic/src/syscall/copy.c \
-	generic/src/mm/reserve.c \
 	generic/src/mm/buddy.c \
 	generic/src/mm/frame.c \
Index: kernel/arch/sparc64/include/cpu.h
===================================================================
--- kernel/arch/sparc64/include/cpu.h	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/arch/sparc64/include/cpu.h	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -59,4 +59,9 @@
 #include <arch/asm.h>
 
+#ifdef CONFIG_SMP
+#include <arch/mm/cache.h>
+#endif
+
+
 #if defined (SUN4U)
 #include <arch/sun4u/cpu.h>
Index: kernel/arch/sparc64/include/mm/cache.h
===================================================================
--- kernel/arch/sparc64/include/mm/cache.h	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
+++ kernel/arch/sparc64/include/mm/cache.h	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -0,0 +1,44 @@
+/*
+ * 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 sparc64mm	
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_sparc64_CACHE_H_
+#define KERN_sparc64_CACHE_H_
+
+#include <mm/page.h>
+#include <mm/frame.h>
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/sparc64/include/sun4u/cpu.h
===================================================================
--- kernel/arch/sparc64/include/sun4u/cpu.h	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/arch/sparc64/include/sun4u/cpu.h	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -60,4 +60,8 @@
 #include <trace.h>
 
+#ifdef CONFIG_SMP
+#include <arch/mm/cache.h>
+#endif
+
 typedef struct {
 	uint32_t mid;              /**< Processor ID as read from
Index: kernel/generic/include/mm/as.h
===================================================================
--- kernel/generic/include/mm/as.h	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/include/mm/as.h	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -238,11 +238,7 @@
 /** Address space area backend structure. */
 typedef struct mem_backend {
-	bool (* create)(as_area_t *);
-	bool (* resize)(as_area_t *, size_t);
-	void (* share)(as_area_t *);
-	void (* destroy)(as_area_t *);
-
 	int (* page_fault)(as_area_t *, uintptr_t, pf_access_t);
 	void (* frame_free)(as_area_t *, uintptr_t, uintptr_t);
+	void (* share)(as_area_t *);
 } mem_backend_t;
 
Index: kernel/generic/include/mm/frame.h
===================================================================
--- kernel/generic/include/mm/frame.h	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/include/mm/frame.h	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -62,18 +62,16 @@
 
 /** Convert the frame address to kernel VA. */
-#define FRAME_KA          0x1
+#define FRAME_KA          0x01
 /** Do not panic and do not sleep on failure. */
-#define FRAME_ATOMIC      0x2
+#define FRAME_ATOMIC      0x02
 /** Do not start reclaiming when no free memory. */
-#define FRAME_NO_RECLAIM  0x4
-/** Do not reserve / unreserve memory. */
-#define FRAME_NO_RESERVE  0x8
+#define FRAME_NO_RECLAIM  0x04
 
 typedef uint8_t zone_flags_t;
 
 /** Available zone (free for allocation) */
-#define ZONE_AVAILABLE  0x0
+#define ZONE_AVAILABLE  0x00
 /** Zone is reserved (not available for allocation) */
-#define ZONE_RESERVED   0x8
+#define ZONE_RESERVED   0x08
 /** Zone is used by firmware (not available for allocation) */
 #define ZONE_FIRMWARE   0x10
@@ -87,5 +85,5 @@
 	uint8_t buddy_order;  /**< Buddy system block order */
 	link_t buddy_link;    /**< Link to the next free block inside
-                                   one order */
+                               one order */
 	void *parent;         /**< If allocated by slab, this points there */
 } frame_t;
@@ -93,14 +91,14 @@
 typedef struct {
 	pfn_t base;                    /**< Frame_no of the first frame
-                                            in the frames array */
+                                        in the frames array */
 	size_t count;                  /**< Size of zone */
 	size_t free_count;             /**< Number of free frame_t
-                                            structures */
+                                        structures */
 	size_t busy_count;             /**< Number of busy frame_t
-                                            structures */
+                                        structures */
 	zone_flags_t flags;            /**< Type of the zone */
 	
 	frame_t *frames;               /**< Array of frame_t structures
-                                            in this zone */
+                                        in this zone */
 	buddy_system_t *buddy_system;  /**< Buddy system for the zone */
 } zone_t;
@@ -148,22 +146,21 @@
     ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
 #define IS_BUDDY_LEFT_BLOCK(zone, frame) \
-    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
+    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
 #define IS_BUDDY_RIGHT_BLOCK(zone, frame) \
-    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
+    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 1)
 #define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) \
-    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
+    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
 #define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) \
-    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
+    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 1)
+
+#define frame_alloc(order, flags) \
+    frame_alloc_generic(order, flags, NULL)
 
 extern void frame_init(void);
 extern void *frame_alloc_generic(uint8_t, frame_flags_t, size_t *);
-extern void *frame_alloc(uint8_t, frame_flags_t);
-extern void *frame_alloc_noreserve(uint8_t, frame_flags_t);
-extern void frame_free_generic(uintptr_t, frame_flags_t);
 extern void frame_free(uintptr_t);
-extern void frame_free_noreserve(uintptr_t);
 extern void frame_reference_add(pfn_t);
 
-extern size_t find_zone(pfn_t, size_t, size_t);
+extern size_t find_zone(pfn_t frame, size_t count, size_t hint);
 extern size_t zone_create(pfn_t, size_t, pfn_t, zone_flags_t);
 extern void *frame_get_parent(pfn_t, size_t);
Index: rnel/generic/include/mm/reserve.h
===================================================================
--- kernel/generic/include/mm/reserve.h	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2011 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 genericmm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_RESERVE_H_
-#define KERN_RESERVE_H_
-
-#include <typedefs.h>
-
-extern bool reserve_try_alloc(size_t);
-extern void reserve_force_alloc(size_t);
-extern void reserve_free(size_t);
-
-#endif
-
-/** @}
- */
Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/src/mm/as.c	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -79,4 +79,8 @@
 #include <syscall/copy.h>
 #include <arch/interrupt.h>
+
+#ifdef CONFIG_VIRT_IDX_DCACHE
+#include <arch/mm/cache.h>
+#endif /* CONFIG_VIRT_IDX_DCACHE */
 
 /**
Index: kernel/generic/src/mm/backend_anon.c
===================================================================
--- kernel/generic/src/mm/backend_anon.c	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/src/mm/backend_anon.c	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -39,5 +39,4 @@
 #include <mm/as.h>
 #include <mm/page.h>
-#include <mm/reserve.h>
 #include <genarch/mm/page_pt.h>
 #include <genarch/mm/page_ht.h>
@@ -52,101 +51,17 @@
 #include <arch.h>
 
-static bool anon_create(as_area_t *);
-static bool anon_resize(as_area_t *, size_t);
-static void anon_share(as_area_t *area);
-static void anon_destroy(as_area_t *);
+#ifdef CONFIG_VIRT_IDX_DCACHE
+#include <arch/mm/cache.h>
+#endif
 
 static int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access);
 static void anon_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame);
+static void anon_share(as_area_t *area);
 
 mem_backend_t anon_backend = {
-	.create = anon_create,
-	.resize = anon_resize,
-	.share = anon_share,
-	.destroy = anon_destroy,
-
 	.page_fault = anon_page_fault,
 	.frame_free = anon_frame_free,
+	.share = anon_share
 };
-
-bool anon_create(as_area_t *area)
-{
-	return reserve_try_alloc(area->pages);
-}
-
-bool anon_resize(as_area_t *area, size_t new_pages)
-{
-	/**
-	 * @todo
-	 * Reserve also space needed for the supporting strutures allocated
-	 * during page fault.
-	 */
-
-	if (new_pages > area->pages)
-		return reserve_try_alloc(new_pages - area->pages);
-	else if (new_pages < area->pages)
-		reserve_free(area->pages - new_pages);
-
-	return true;
-}
-
-/** Share the anonymous address space area.
- *
- * Sharing of anonymous area is done by duplicating its entire mapping
- * to the pagemap. Page faults will primarily search for frames there.
- *
- * The address space and address space area must be already locked.
- *
- * @param area Address space area to be shared.
- */
-void anon_share(as_area_t *area)
-{
-	link_t *cur;
-
-	ASSERT(mutex_locked(&area->as->lock));
-	ASSERT(mutex_locked(&area->lock));
-
-	/*
-	 * Copy used portions of the area to sh_info's page map.
-	 */
-	mutex_lock(&area->sh_info->lock);
-	for (cur = area->used_space.leaf_head.next;
-	    cur != &area->used_space.leaf_head; cur = cur->next) {
-		btree_node_t *node;
-		unsigned int i;
-		
-		node = list_get_instance(cur, btree_node_t, leaf_link);
-		for (i = 0; i < node->keys; i++) {
-			uintptr_t base = node->key[i];
-			size_t count = (size_t) node->value[i];
-			unsigned int j;
-			
-			for (j = 0; j < count; j++) {
-				pte_t *pte;
-			
-				page_table_lock(area->as, false);
-				pte = page_mapping_find(area->as,
-				    base + j * PAGE_SIZE);
-				ASSERT(pte && PTE_VALID(pte) &&
-				    PTE_PRESENT(pte));
-				btree_insert(&area->sh_info->pagemap,
-				    (base + j * PAGE_SIZE) - area->base,
-				    (void *) PTE_GET_FRAME(pte), NULL);
-				page_table_unlock(area->as, false);
-
-				pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(pte));
-				frame_reference_add(pfn);
-			}
-
-		}
-	}
-	mutex_unlock(&area->sh_info->lock);
-}
-
-void anon_destroy(as_area_t *area)
-{
-	reserve_free(area->pages);
-}
-
 
 /** Service a page fault in the anonymous memory address space area.
@@ -200,6 +115,5 @@
 			}
 			if (allocate) {
-				frame = (uintptr_t) frame_alloc_noreserve(
-				    ONE_FRAME, 0);
+				frame = (uintptr_t) frame_alloc(ONE_FRAME, 0);
 				memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
 				
@@ -231,5 +145,5 @@
 		 *   the different causes
 		 */
-		frame = (uintptr_t) frame_alloc_noreserve(ONE_FRAME, 0);
+		frame = (uintptr_t) frame_alloc(ONE_FRAME, 0);
 		memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
 	}
@@ -260,7 +174,60 @@
 	ASSERT(mutex_locked(&area->lock));
 
-	frame_free_noreserve(frame);
+	frame_free(frame);
 }
 
+/** Share the anonymous address space area.
+ *
+ * Sharing of anonymous area is done by duplicating its entire mapping
+ * to the pagemap. Page faults will primarily search for frames there.
+ *
+ * The address space and address space area must be already locked.
+ *
+ * @param area Address space area to be shared.
+ */
+void anon_share(as_area_t *area)
+{
+	link_t *cur;
+
+	ASSERT(mutex_locked(&area->as->lock));
+	ASSERT(mutex_locked(&area->lock));
+
+	/*
+	 * Copy used portions of the area to sh_info's page map.
+	 */
+	mutex_lock(&area->sh_info->lock);
+	for (cur = area->used_space.leaf_head.next;
+	    cur != &area->used_space.leaf_head; cur = cur->next) {
+		btree_node_t *node;
+		unsigned int i;
+		
+		node = list_get_instance(cur, btree_node_t, leaf_link);
+		for (i = 0; i < node->keys; i++) {
+			uintptr_t base = node->key[i];
+			size_t count = (size_t) node->value[i];
+			unsigned int j;
+			
+			for (j = 0; j < count; j++) {
+				pte_t *pte;
+			
+				page_table_lock(area->as, false);
+				pte = page_mapping_find(area->as,
+				    base + j * PAGE_SIZE);
+				ASSERT(pte && PTE_VALID(pte) &&
+				    PTE_PRESENT(pte));
+				btree_insert(&area->sh_info->pagemap,
+				    (base + j * PAGE_SIZE) - area->base,
+				    (void *) PTE_GET_FRAME(pte), NULL);
+				page_table_unlock(area->as, false);
+
+				pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(pte));
+				frame_reference_add(pfn);
+			}
+
+		}
+	}
+	mutex_unlock(&area->sh_info->lock);
+}
+
 /** @}
  */
Index: kernel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/src/mm/backend_elf.c	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -43,5 +43,4 @@
 #include <mm/slab.h>
 #include <mm/page.h>
-#include <mm/reserve.h>
 #include <genarch/mm/page_pt.h>
 #include <genarch/mm/page_ht.h>
@@ -52,40 +51,219 @@
 #include <arch/barrier.h>
 
-static bool elf_create(as_area_t *);
-static bool elf_resize(as_area_t *, size_t);
-static void elf_share(as_area_t *);
-static void elf_destroy(as_area_t *);
+#ifdef CONFIG_VIRT_IDX_DCACHE
+#include <arch/mm/cache.h>
+#endif
 
 static int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access);
 static void elf_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame);
+static void elf_share(as_area_t *area);
 
 mem_backend_t elf_backend = {
-	.create = elf_create,
-	.resize = elf_resize,
-	.share = elf_share,
-	.destroy = elf_destroy,
-
 	.page_fault = elf_page_fault,
 	.frame_free = elf_frame_free,
+	.share = elf_share
 };
 
-bool elf_create(as_area_t *area)
+/** Service a page fault in the ELF backend address space area.
+ *
+ * The address space area and page tables must be already locked.
+ *
+ * @param area		Pointer to the address space area.
+ * @param addr		Faulting virtual address.
+ * @param access	Access mode that caused the fault (i.e.
+ * 			read/write/exec).
+ *
+ * @return		AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK
+ * 			on success (i.e. serviced).
+ */
+int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
 {
-	/**
-	 * @todo:
-	 * Reserve only how much is necessary for anonymous pages plus the
-	 * supporting structures allocated during the page fault.
+	elf_header_t *elf = area->backend_data.elf;
+	elf_segment_header_t *entry = area->backend_data.segment;
+	btree_node_t *leaf;
+	uintptr_t base, frame, page, start_anon;
+	size_t i;
+	bool dirty = false;
+
+	ASSERT(page_table_locked(AS));
+	ASSERT(mutex_locked(&area->lock));
+
+	if (!as_area_check_access(area, access))
+		return AS_PF_FAULT;
+	
+	if (addr < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
+		return AS_PF_FAULT;
+	
+	if (addr >= entry->p_vaddr + entry->p_memsz)
+		return AS_PF_FAULT;
+	
+	i = (addr - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
+	base = (uintptr_t)
+	    (((void *) elf) + ALIGN_DOWN(entry->p_offset, PAGE_SIZE));
+
+	/* Virtual address of faulting page*/
+	page = ALIGN_DOWN(addr, PAGE_SIZE);
+
+	/* Virtual address of the end of initialized part of segment */
+	start_anon = entry->p_vaddr + entry->p_filesz;
+
+	if (area->sh_info) {
+		bool found = false;
+
+		/*
+		 * The address space area is shared.
+		 */
+		
+		mutex_lock(&area->sh_info->lock);
+		frame = (uintptr_t) btree_search(&area->sh_info->pagemap,
+		    page - area->base, &leaf);
+		if (!frame) {
+			unsigned int i;
+
+			/*
+			 * Workaround for valid NULL address.
+			 */
+
+			for (i = 0; i < leaf->keys; i++) {
+				if (leaf->key[i] == page - area->base) {
+					found = true;
+					break;
+				}
+			}
+		}
+		if (frame || found) {
+			frame_reference_add(ADDR2PFN(frame));
+			page_mapping_insert(AS, addr, frame,
+			    as_area_get_flags(area));
+			if (!used_space_insert(area, page, 1))
+				panic("Cannot insert used space.");
+			mutex_unlock(&area->sh_info->lock);
+			return AS_PF_OK;
+		}
+	}
+
+	/*
+	 * The area is either not shared or the pagemap does not contain the
+	 * mapping.
 	 */
-	return reserve_try_alloc(area->pages);
+	if (page >= entry->p_vaddr && page + PAGE_SIZE <= start_anon) {
+		/*
+		 * Initialized portion of the segment. The memory is backed
+		 * directly by the content of the ELF image. Pages are
+		 * only copied if the segment is writable so that there
+		 * can be more instantions of the same memory ELF image
+		 * used at a time. Note that this could be later done
+		 * as COW.
+		 */
+		if (entry->p_flags & PF_W) {
+			frame = (uintptr_t)frame_alloc(ONE_FRAME, 0);
+			memcpy((void *) PA2KA(frame),
+			    (void *) (base + i * FRAME_SIZE), FRAME_SIZE);
+			if (entry->p_flags & PF_X) {
+				smc_coherence_block((void *) PA2KA(frame),
+				    FRAME_SIZE);
+			}
+			dirty = true;
+		} else {
+			frame = KA2PA(base + i * FRAME_SIZE);
+		}	
+	} else if (page >= start_anon) {
+		/*
+		 * This is the uninitialized portion of the segment.
+		 * It is not physically present in the ELF image.
+		 * To resolve the situation, a frame must be allocated
+		 * and cleared.
+		 */
+		frame = (uintptr_t)frame_alloc(ONE_FRAME, 0);
+		memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
+		dirty = true;
+	} else {
+		size_t pad_lo, pad_hi;
+		/*
+		 * The mixed case.
+		 *
+		 * The middle part is backed by the ELF image and
+		 * the lower and upper parts are anonymous memory.
+		 * (The segment can be and often is shorter than 1 page).
+		 */
+		if (page < entry->p_vaddr)
+			pad_lo = entry->p_vaddr - page;
+		else
+			pad_lo = 0;
+
+		if (start_anon < page + PAGE_SIZE)
+			pad_hi = page + PAGE_SIZE - start_anon;
+		else
+			pad_hi = 0;
+
+		frame = (uintptr_t)frame_alloc(ONE_FRAME, 0);
+		memcpy((void *) (PA2KA(frame) + pad_lo),
+		    (void *) (base + i * FRAME_SIZE + pad_lo),
+		    FRAME_SIZE - pad_lo - pad_hi);
+		if (entry->p_flags & PF_X) {
+			smc_coherence_block((void *) (PA2KA(frame) + pad_lo), 
+			    FRAME_SIZE - pad_lo - pad_hi);
+		}
+		memsetb((void *) PA2KA(frame), pad_lo, 0);
+		memsetb((void *) (PA2KA(frame) + FRAME_SIZE - pad_hi), pad_hi,
+		    0);
+		dirty = true;
+	}
+
+	if (dirty && area->sh_info) {
+		frame_reference_add(ADDR2PFN(frame));
+		btree_insert(&area->sh_info->pagemap, page - area->base,
+		    (void *) frame, leaf);
+	}
+
+	if (area->sh_info)
+		mutex_unlock(&area->sh_info->lock);
+
+	page_mapping_insert(AS, addr, frame, as_area_get_flags(area));
+	if (!used_space_insert(area, page, 1))
+		panic("Cannot insert used space.");
+
+	return AS_PF_OK;
 }
 
-bool elf_resize(as_area_t *area, size_t new_pages)
+/** Free a frame that is backed by the ELF backend.
+ *
+ * The address space area and page tables must be already locked.
+ *
+ * @param area		Pointer to the address space area.
+ * @param page		Page that is mapped to frame. Must be aligned to
+ * 			PAGE_SIZE.
+ * @param frame		Frame to be released.
+ *
+ */
+void elf_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
 {
-	if (new_pages > area->pages)
-		return reserve_try_alloc(new_pages - area->pages);
-	else if (new_pages < area->pages)
-		reserve_free(area->pages - new_pages);
-	
-	return true;
+	elf_segment_header_t *entry = area->backend_data.segment;
+	uintptr_t start_anon;
+
+	ASSERT(page_table_locked(area->as));
+	ASSERT(mutex_locked(&area->lock));
+
+	ASSERT(page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE));
+	ASSERT(page < entry->p_vaddr + entry->p_memsz);
+
+	start_anon = entry->p_vaddr + entry->p_filesz;
+
+	if (page >= entry->p_vaddr && page + PAGE_SIZE <= start_anon) {
+		if (entry->p_flags & PF_W) {
+			/*
+			 * Free the frame with the copy of writable segment
+			 * data.
+			 */
+			frame_free(frame);
+		}
+	} else {
+		/*
+		 * The frame is either anonymous memory or the mixed case (i.e.
+		 * lower part is backed by the ELF image and the upper is
+		 * anonymous). In any case, a frame needs to be freed.
+		 */
+		frame_free(frame);
+	}
 }
 
@@ -178,216 +356,4 @@
 }
 
-void elf_destroy(as_area_t *area)
-{
-	/**
-	 * @todo:
-	 * Unreserve only how much was really reserved.
-	 */
-	reserve_free(area->pages);
-}
-
-/** Service a page fault in the ELF backend address space area.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area		Pointer to the address space area.
- * @param addr		Faulting virtual address.
- * @param access	Access mode that caused the fault (i.e.
- * 			read/write/exec).
- *
- * @return		AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK
- * 			on success (i.e. serviced).
- */
-int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
-{
-	elf_header_t *elf = area->backend_data.elf;
-	elf_segment_header_t *entry = area->backend_data.segment;
-	btree_node_t *leaf;
-	uintptr_t base, frame, page, start_anon;
-	size_t i;
-	bool dirty = false;
-
-	ASSERT(page_table_locked(AS));
-	ASSERT(mutex_locked(&area->lock));
-
-	if (!as_area_check_access(area, access))
-		return AS_PF_FAULT;
-	
-	if (addr < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
-		return AS_PF_FAULT;
-	
-	if (addr >= entry->p_vaddr + entry->p_memsz)
-		return AS_PF_FAULT;
-	
-	i = (addr - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
-	base = (uintptr_t)
-	    (((void *) elf) + ALIGN_DOWN(entry->p_offset, PAGE_SIZE));
-
-	/* Virtual address of faulting page*/
-	page = ALIGN_DOWN(addr, PAGE_SIZE);
-
-	/* Virtual address of the end of initialized part of segment */
-	start_anon = entry->p_vaddr + entry->p_filesz;
-
-	if (area->sh_info) {
-		bool found = false;
-
-		/*
-		 * The address space area is shared.
-		 */
-		
-		mutex_lock(&area->sh_info->lock);
-		frame = (uintptr_t) btree_search(&area->sh_info->pagemap,
-		    page - area->base, &leaf);
-		if (!frame) {
-			unsigned int i;
-
-			/*
-			 * Workaround for valid NULL address.
-			 */
-
-			for (i = 0; i < leaf->keys; i++) {
-				if (leaf->key[i] == page - area->base) {
-					found = true;
-					break;
-				}
-			}
-		}
-		if (frame || found) {
-			frame_reference_add(ADDR2PFN(frame));
-			page_mapping_insert(AS, addr, frame,
-			    as_area_get_flags(area));
-			if (!used_space_insert(area, page, 1))
-				panic("Cannot insert used space.");
-			mutex_unlock(&area->sh_info->lock);
-			return AS_PF_OK;
-		}
-	}
-
-	/*
-	 * The area is either not shared or the pagemap does not contain the
-	 * mapping.
-	 */
-	if (page >= entry->p_vaddr && page + PAGE_SIZE <= start_anon) {
-		/*
-		 * Initialized portion of the segment. The memory is backed
-		 * directly by the content of the ELF image. Pages are
-		 * only copied if the segment is writable so that there
-		 * can be more instantions of the same memory ELF image
-		 * used at a time. Note that this could be later done
-		 * as COW.
-		 */
-		if (entry->p_flags & PF_W) {
-			frame = (uintptr_t)frame_alloc_noreserve(ONE_FRAME, 0);
-			memcpy((void *) PA2KA(frame),
-			    (void *) (base + i * FRAME_SIZE), FRAME_SIZE);
-			if (entry->p_flags & PF_X) {
-				smc_coherence_block((void *) PA2KA(frame),
-				    FRAME_SIZE);
-			}
-			dirty = true;
-		} else {
-			frame = KA2PA(base + i * FRAME_SIZE);
-		}	
-	} else if (page >= start_anon) {
-		/*
-		 * This is the uninitialized portion of the segment.
-		 * It is not physically present in the ELF image.
-		 * To resolve the situation, a frame must be allocated
-		 * and cleared.
-		 */
-		frame = (uintptr_t) frame_alloc_noreserve(ONE_FRAME, 0);
-		memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
-		dirty = true;
-	} else {
-		size_t pad_lo, pad_hi;
-		/*
-		 * The mixed case.
-		 *
-		 * The middle part is backed by the ELF image and
-		 * the lower and upper parts are anonymous memory.
-		 * (The segment can be and often is shorter than 1 page).
-		 */
-		if (page < entry->p_vaddr)
-			pad_lo = entry->p_vaddr - page;
-		else
-			pad_lo = 0;
-
-		if (start_anon < page + PAGE_SIZE)
-			pad_hi = page + PAGE_SIZE - start_anon;
-		else
-			pad_hi = 0;
-
-		frame = (uintptr_t) frame_alloc_noreserve(ONE_FRAME, 0);
-		memcpy((void *) (PA2KA(frame) + pad_lo),
-		    (void *) (base + i * FRAME_SIZE + pad_lo),
-		    FRAME_SIZE - pad_lo - pad_hi);
-		if (entry->p_flags & PF_X) {
-			smc_coherence_block((void *) (PA2KA(frame) + pad_lo), 
-			    FRAME_SIZE - pad_lo - pad_hi);
-		}
-		memsetb((void *) PA2KA(frame), pad_lo, 0);
-		memsetb((void *) (PA2KA(frame) + FRAME_SIZE - pad_hi), pad_hi,
-		    0);
-		dirty = true;
-	}
-
-	if (dirty && area->sh_info) {
-		frame_reference_add(ADDR2PFN(frame));
-		btree_insert(&area->sh_info->pagemap, page - area->base,
-		    (void *) frame, leaf);
-	}
-
-	if (area->sh_info)
-		mutex_unlock(&area->sh_info->lock);
-
-	page_mapping_insert(AS, addr, frame, as_area_get_flags(area));
-	if (!used_space_insert(area, page, 1))
-		panic("Cannot insert used space.");
-
-	return AS_PF_OK;
-}
-
-/** Free a frame that is backed by the ELF backend.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area		Pointer to the address space area.
- * @param page		Page that is mapped to frame. Must be aligned to
- * 			PAGE_SIZE.
- * @param frame		Frame to be released.
- *
- */
-void elf_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
-{
-	elf_segment_header_t *entry = area->backend_data.segment;
-	uintptr_t start_anon;
-
-	ASSERT(page_table_locked(area->as));
-	ASSERT(mutex_locked(&area->lock));
-
-	ASSERT(page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE));
-	ASSERT(page < entry->p_vaddr + entry->p_memsz);
-
-	start_anon = entry->p_vaddr + entry->p_filesz;
-
-	if (page >= entry->p_vaddr && page + PAGE_SIZE <= start_anon) {
-		if (entry->p_flags & PF_W) {
-			/*
-			 * Free the frame with the copy of writable segment
-			 * data.
-			 */
-			frame_free_noreserve(frame);
-		}
-	} else {
-		/*
-		 * The frame is either anonymous memory or the mixed case (i.e.
-		 * lower part is backed by the ELF image and the upper is
-		 * anonymous). In any case, a frame needs to be freed.
-		 */
-		frame_free_noreserve(frame);
-	}
-}
-
 /** @}
  */
Index: kernel/generic/src/mm/backend_phys.c
===================================================================
--- kernel/generic/src/mm/backend_phys.c	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/src/mm/backend_phys.c	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -48,43 +48,12 @@
 #include <align.h>
 
-static bool phys_create(as_area_t *);
+static int phys_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access);
 static void phys_share(as_area_t *area);
-static void phys_destroy(as_area_t *);
-
-static int phys_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access);
 
 mem_backend_t phys_backend = {
-	.create = phys_create,
-	.resize = NULL,
-	.share = phys_share,
-	.destroy = phys_destroy,
-
 	.page_fault = phys_page_fault,
 	.frame_free = NULL,
+	.share = phys_share
 };
-
-bool phys_create(as_area_t *area)
-{
-	return true;
-}
-
-/** Share address space area backed by physical memory.
- *
- * Do actually nothing as sharing of address space areas
- * that are backed up by physical memory is very easy.
- * Note that the function must be defined so that
- * as_area_share() will succeed.
- */
-void phys_share(as_area_t *area)
-{
-	ASSERT(mutex_locked(&area->as->lock));
-	ASSERT(mutex_locked(&area->lock));
-}
-
-
-void phys_destroy(as_area_t *area)
-{
-	/* Nothing to do. */
-}
 
 /** Service a page fault in the address space area backed by physical memory.
@@ -119,4 +88,17 @@
 }
 
+/** Share address space area backed by physical memory.
+ *
+ * Do actually nothing as sharing of address space areas
+ * that are backed up by physical memory is very easy.
+ * Note that the function must be defined so that
+ * as_area_share() will succeed.
+ */
+void phys_share(as_area_t *area)
+{
+	ASSERT(mutex_locked(&area->as->lock));
+	ASSERT(mutex_locked(&area->lock));
+}
+
 /** @}
  */
Index: kernel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ kernel/generic/src/mm/frame.c	(revision b2fb47fd7ac8cdf723f6c2884d9c5e9d5fee0c41)
@@ -695,4 +695,6 @@
  * not to be 2^order size. Once the allocator is running it is no longer
  * possible, merged configuration data occupies more space :-/
+ *
+ * The function uses
  *
  */
@@ -1086,14 +1088,4 @@
 }
 
-void *frame_alloc(uint8_t order, frame_flags_t flags)
-{
-	return frame_alloc_generic(order, flags, NULL);
-}
-
-void *frame_alloc_noreserve(uint8_t order, frame_flags_t flags)
-{
-	return frame_alloc_generic(order, flags | FRAME_NO_RESERVE, NULL);
-}
-
 /** Free a frame.
  *
@@ -1103,8 +1095,7 @@
  *
  * @param frame Physical Address of of the frame to be freed.
- * @param flags Flags to control memory reservation.
- *
- */
-void frame_free_generic(uintptr_t frame, frame_flags_t flags)
+ *
+ */
+void frame_free(uintptr_t frame)
 {
 	irq_spinlock_lock(&zones.lock, true);
@@ -1134,14 +1125,4 @@
 	}
 	mutex_unlock(&mem_avail_mtx);
-}
-
-void frame_free(uintptr_t frame)
-{
-	frame_free_generic(frame, 0);
-}
-
-void frame_free_noreserve(uintptr_t frame)
-{
-	frame_free_generic(frame, FRAME_NO_RESERVE);
 }
 
Index: rnel/generic/src/mm/reserve.c
===================================================================
--- kernel/generic/src/mm/reserve.c	(revision 8b65570552691ad6fa2a012cf20ea6571577cd46)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2011 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 genericmm
- * @{
- */
-
-/**
- * @file
- * @brief Memory reservations.
- */
-
-#include <typedefs.h>
-#include <mm/reserve.h>
-#include <mm/frame.h>
-
-bool reserve_try_alloc(size_t size)
-{
-	return false;	
-}
-
-void reserve_force_alloc(size_t size)
-{
-}
-
-void reserve_free(size_t size)
-{
-}
-
-/** @}
- */
