Index: kernel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision b3f8fb771f871e7f2bb35ce9339717639e8f86d6)
+++ kernel/generic/src/mm/backend_elf.c	(revision 4638401d72971e059187a767fda13c9cf1a57ac1)
@@ -72,5 +72,6 @@
  * @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).
+ * @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)
@@ -85,5 +86,6 @@
 		return AS_PF_FAULT;
 
-	ASSERT((addr >= entry->p_vaddr) && (addr < entry->p_vaddr + entry->p_memsz));
+	ASSERT((addr >= entry->p_vaddr) &&
+	    (addr < entry->p_vaddr + entry->p_memsz));
 	i = (addr - entry->p_vaddr) >> PAGE_WIDTH;
 	base = (uintptr_t) (((void *) elf) + entry->p_offset);
@@ -108,5 +110,6 @@
 
 			for (i = 0; i < leaf->keys; i++) {
-				if (leaf->key[i] == ALIGN_DOWN(addr, PAGE_SIZE)) {
+				if (leaf->key[i] ==
+				    ALIGN_DOWN(addr, PAGE_SIZE)) {
 					found = true;
 					break;
@@ -116,6 +119,8 @@
 		if (frame || found) {
 			frame_reference_add(ADDR2PFN(frame));
-			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, addr, frame,
+			    as_area_get_flags(area));
+			if (!used_space_insert(area,
+			    ALIGN_DOWN(addr, PAGE_SIZE), 1))
 				panic("Could not insert used space.\n");
 			mutex_unlock(&area->sh_info->lock);
@@ -125,8 +130,10 @@
 	
 	/*
-	 * The area is either not shared or the pagemap does not contain the mapping.
+	 * The area is either not shared or the pagemap does not contain the
+	 * mapping.
 	 */
 	
-	if (ALIGN_DOWN(addr, PAGE_SIZE) + PAGE_SIZE < entry->p_vaddr + entry->p_filesz) {
+	if (ALIGN_DOWN(addr, PAGE_SIZE) + PAGE_SIZE <
+	    entry->p_vaddr + entry->p_filesz) {
 		/*
 		 * Initialized portion of the segment. The memory is backed
@@ -139,10 +146,12 @@
 		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);
+			memcpy((void *) PA2KA(frame),
+			    (void *) (base + i * FRAME_SIZE), FRAME_SIZE);
 			
 			if (area->sh_info) {
 				frame_reference_add(ADDR2PFN(frame));
-				btree_insert(&area->sh_info->pagemap, ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
-					(void *) frame, leaf);
+				btree_insert(&area->sh_info->pagemap,
+				    ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
+				    (void *) frame, leaf);
 			}
 
@@ -150,5 +159,6 @@
 			frame = KA2PA(base + i*FRAME_SIZE);
 		}	
-	} else if (ALIGN_DOWN(addr, PAGE_SIZE) >= ALIGN_UP(entry->p_vaddr + entry->p_filesz, PAGE_SIZE)) {
+	} else if (ALIGN_DOWN(addr, PAGE_SIZE) >=
+	    ALIGN_UP(entry->p_vaddr + entry->p_filesz, PAGE_SIZE)) {
 		/*
 		 * This is the uninitialized portion of the segment.
@@ -162,6 +172,7 @@
 		if (area->sh_info) {
 			frame_reference_add(ADDR2PFN(frame));
-			btree_insert(&area->sh_info->pagemap, ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
-				(void *) frame, leaf);
+			btree_insert(&area->sh_info->pagemap,
+			    ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
+			    (void *) frame, leaf);
 		}
 
@@ -176,10 +187,12 @@
 		frame = (uintptr_t)frame_alloc(ONE_FRAME, 0);
 		memsetb(PA2KA(frame) + size, FRAME_SIZE - size, 0);
-		memcpy((void *) PA2KA(frame), (void *) (base + i*FRAME_SIZE), size);
+		memcpy((void *) PA2KA(frame), (void *) (base + i * FRAME_SIZE),
+		    size);
 
 		if (area->sh_info) {
 			frame_reference_add(ADDR2PFN(frame));
-			btree_insert(&area->sh_info->pagemap, ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
-				(void *) frame, leaf);
+			btree_insert(&area->sh_info->pagemap,
+			    ALIGN_DOWN(addr, PAGE_SIZE) - area->base,
+			    (void *) frame, leaf);
 		}
 
@@ -212,13 +225,16 @@
 	index_t i;
 	
-	ASSERT((page >= entry->p_vaddr) && (page < entry->p_vaddr + entry->p_memsz));
+	ASSERT((page >= entry->p_vaddr) &&
+	    (page < entry->p_vaddr + entry->p_memsz));
 	i = (page - entry->p_vaddr) >> PAGE_WIDTH;
 	base = (uintptr_t) (((void *) elf) + entry->p_offset);
 	ASSERT(ALIGN_UP(base, FRAME_SIZE) == base);
 	
-	if (page + PAGE_SIZE < ALIGN_UP(entry->p_vaddr + entry->p_filesz, PAGE_SIZE)) {
+	if (page + PAGE_SIZE <
+	    ALIGN_UP(entry->p_vaddr + entry->p_filesz, PAGE_SIZE)) {
 		if (entry->p_flags & PF_W) {
 			/*
-			 * Free the frame with the copy of writable segment data.
+			 * Free the frame with the copy of writable segment
+			 * data.
 			 */
 			frame_free(frame);
@@ -229,7 +245,7 @@
 	} 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.
+		 * 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); 
@@ -261,8 +277,10 @@
 	 */
 	if (area->flags & AS_AREA_WRITE) {
-		node = list_get_instance(area->used_space.leaf_head.next, btree_node_t, leaf_link);
+		node = list_get_instance(area->used_space.leaf_head.next,
+		    btree_node_t, leaf_link);
 	} else {
 		(void) btree_search(&area->sh_info->pagemap, start_anon, &leaf);
-		node = btree_leaf_node_left_neighbour(&area->sh_info->pagemap, leaf);
+		node = btree_leaf_node_left_neighbour(&area->sh_info->pagemap,
+		    leaf);
 		if (!node)
 			node = leaf;
@@ -273,5 +291,6 @@
 	 */
 	mutex_lock(&area->sh_info->lock);
-	for (cur = &node->leaf_link; cur != &area->used_space.leaf_head; cur = cur->next) {
+	for (cur = &node->leaf_link; cur != &area->used_space.leaf_head;
+	    cur = cur->next) {
 		int i;
 		
@@ -295,17 +314,24 @@
 			
 				/*
-				 * Skip read-only pages that are backed by the ELF image.
+				 * Skip read-only pages that are backed by the
+				 * ELF image.
 				 */
 				if (!(area->flags & AS_AREA_WRITE))
-					if (base + (j + 1)*PAGE_SIZE <= start_anon)
+					if (base + (j + 1) * PAGE_SIZE <=
+					    start_anon)
 						continue;
 				
 				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,
+				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);
-				frame_reference_add(ADDR2PFN(PTE_GET_FRAME(pte)));
+
+				pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(pte));
+				frame_reference_add(pfn);
 			}
 				
@@ -317,2 +343,3 @@
 /** @}
  */
+
