Index: kernel/generic/src/mm/backend_anon.c
===================================================================
--- kernel/generic/src/mm/backend_anon.c	(revision d630139332f649889fde186aaa1729516725c881)
+++ kernel/generic/src/mm/backend_anon.c	(revision d5bd8d70ae04526718fa7fc44f9461c962ec9964)
@@ -73,5 +73,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 anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
@@ -87,5 +88,6 @@
 		/*
 		 * The area is shared, chances are that the mapping can be found
-		 * in the pagemap of the address space area share info structure.
+		 * in the pagemap of the address space area share info
+		 * structure.
 		 * In the case that the pagemap does not contain the respective
 		 * mapping, a new frame is allocated and the mapping is created.
@@ -103,5 +105,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)) {
 					allocate = false;
 					break;
@@ -113,7 +116,10 @@
 				
 				/*
-				 * Insert the address of the newly allocated frame to the pagemap.
+				 * Insert the address of the newly allocated
+				 * frame to the pagemap.
 				 */
-				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);
 			}
 		}
@@ -142,6 +148,6 @@
 	/*
 	 * Map 'page' to 'frame'.
-	 * Note that TLB shootdown is not attempted as only new information is being
-	 * inserted into page tables.
+	 * 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));
@@ -185,5 +191,6 @@
 	 */
 	mutex_lock(&area->sh_info->lock);
-	for (cur = area->used_space.leaf_head.next; cur != &area->used_space.leaf_head; cur = cur->next) {
+	for (cur = area->used_space.leaf_head.next;
+	    cur != &area->used_space.leaf_head; cur = cur->next) {
 		btree_node_t *node;
 		int i;
@@ -199,10 +206,15 @@
 			
 				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);
+				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);
 			}
 				
@@ -214,2 +226,3 @@
 /** @}
  */
+
Index: kernel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision d630139332f649889fde186aaa1729516725c881)
+++ kernel/generic/src/mm/backend_elf.c	(revision d5bd8d70ae04526718fa7fc44f9461c962ec9964)
@@ -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 @@
 /** @}
  */
+
Index: kernel/generic/src/mm/backend_phys.c
===================================================================
--- kernel/generic/src/mm/backend_phys.c	(revision d630139332f649889fde186aaa1729516725c881)
+++ kernel/generic/src/mm/backend_phys.c	(revision d5bd8d70ae04526718fa7fc44f9461c962ec9964)
@@ -33,5 +33,6 @@
 /**
  * @file
- * @brief	Backend for address space areas backed by continuous physical memory.
+ * @brief	Backend for address space areas backed by continuous physical
+ * 		memory.
  */
 
@@ -63,5 +64,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 phys_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
@@ -73,5 +75,6 @@
 
 	ASSERT(addr - area->base < area->backend_data.frames * FRAME_SIZE);
-	page_mapping_insert(AS, addr, base + (addr - area->base), as_area_get_flags(area));
+	page_mapping_insert(AS, addr, base + (addr - area->base),
+	    as_area_get_flags(area));
         if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1))
                 panic("Could not insert used space.\n");
