Index: kernel/generic/src/mm/backend_anon.c
===================================================================
--- kernel/generic/src/mm/backend_anon.c	(revision f7f47a7307e59ce040f9464f26ef7795ee60b234)
+++ kernel/generic/src/mm/backend_anon.c	(revision c1428606b3a3d0626fd6650d6099ec2896442998)
@@ -44,4 +44,5 @@
 #include <mm/frame.h>
 #include <mm/slab.h>
+#include <mm/km.h>
 #include <synch/mutex.h>
 #include <adt/list.h>
@@ -155,4 +156,6 @@
 int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
 {
+	uintptr_t upage = ALIGN_DOWN(addr, PAGE_SIZE);
+	uintptr_t kpage;
 	uintptr_t frame;
 
@@ -175,5 +178,5 @@
 		mutex_lock(&area->sh_info->lock);
 		frame = (uintptr_t) btree_search(&area->sh_info->pagemap,
-		    ALIGN_DOWN(addr, PAGE_SIZE) - area->base, &leaf);
+		    upage - area->base, &leaf);
 		if (!frame) {
 			bool allocate = true;
@@ -185,6 +188,5 @@
 			 */
 			for (i = 0; i < leaf->keys; i++) {
-				if (leaf->key[i] ==
-				    ALIGN_DOWN(addr, PAGE_SIZE) - area->base) {
+				if (leaf->key[i] == upage - area->base) {
 					allocate = false;
 					break;
@@ -192,7 +194,8 @@
 			}
 			if (allocate) {
-				frame = (uintptr_t) frame_alloc_noreserve(
-				    ONE_FRAME, 0);
-				memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
+				kpage = km_temporary_page_get(&frame,
+				    FRAME_NO_RESERVE);
+				memsetb((void *) kpage, PAGE_SIZE, 0);
+				km_temporary_page_put(kpage);
 				
 				/*
@@ -201,6 +204,5 @@
 				 */
 				btree_insert(&area->sh_info->pagemap,
-				    ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
-				    (void *) frame, leaf);
+				    upage - area->base, (void *) frame, leaf);
 			}
 		}
@@ -223,15 +225,16 @@
 		 *   the different causes
 		 */
-		frame = (uintptr_t) frame_alloc_noreserve(ONE_FRAME, 0);
-		memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
+		kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE);
+		memsetb((void *) kpage, PAGE_SIZE, 0);
+		km_temporary_page_put(kpage);
 	}
 	
 	/*
-	 * Map 'page' to 'frame'.
+	 * Map 'upage' to 'frame'.
 	 * Note that TLB shootdown is not attempted as only new information is
 	 * being inserted into page tables.
 	 */
-	page_mapping_insert(AS, addr, frame, as_area_get_flags(area));
-	if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1))
+	page_mapping_insert(AS, upage, frame, as_area_get_flags(area));
+	if (!used_space_insert(area, upage, 1))
 		panic("Cannot insert used space.");
 		
