Index: trunk/kernel/mm/vmm.c
===================================================================
--- trunk/kernel/mm/vmm.c	(revision 124)
+++ trunk/kernel/mm/vmm.c	(revision 178)
@@ -181,6 +181,5 @@
 
     hal_fence();
-
-}  // end vmm_init()
+}
 
 //////////////////////////////////////////
@@ -196,8 +195,8 @@
     rwlock_wr_lock( &src_vmm->vsegs_lock );
 
-    // initialise dst_vmm vsegs_lock
+    // initialize dst_vmm vsegs_lock
     rwlock_init( &dst_vmm->vsegs_lock );
 
-    // initialise the dst_vmm vsegs list and the radix tree
+    // initialize the dst_vmm vsegs list and the radix tree
     dst_vmm->vsegs_nr = 0;
     list_root_init( &dst_vmm->vsegs_root );
@@ -208,5 +207,5 @@
     if( error )
     {
-        printk("\n[ERROR] in %s : cannot initialise radix tree for process %x\n",
+        printk("\n[ERROR] in %s : cannot initialize radix tree for process %x\n",
                __FUNCTION__ , dst_process->pid );
         return ENOMEM;
@@ -226,5 +225,5 @@
         dst_vseg = vseg_alloc();
 
-        if( dst_vseg == NULL ) 
+        if( dst_vseg == NULL )
         {
             // release all allocated vsegs
@@ -267,5 +266,5 @@
     for( i = 0 ; i < 32 ; i++ ) list_root_init( &dst_vmm->mmap_mgr.zombi_list[i] );
 
-    // initialise instrumentation counters
+    // initialize instrumentation counters
 	dst_vmm->pgfault_nr    = 0;
 	dst_vmm->u_err_nr      = 0;
@@ -273,10 +272,10 @@
 
     // copy base addresses
-    dst_vmm->kent_vpn_base = src_vmm->kent_vpn_base; 
-    dst_vmm->args_vpn_base = src_vmm->args_vpn_base; 
-    dst_vmm->envs_vpn_base = src_vmm->envs_vpn_base; 
-    dst_vmm->heap_vpn_base = src_vmm->heap_vpn_base; 
-    dst_vmm->code_vpn_base = src_vmm->code_vpn_base; 
-    dst_vmm->data_vpn_base = src_vmm->data_vpn_base; 
+    dst_vmm->kent_vpn_base = src_vmm->kent_vpn_base;
+    dst_vmm->args_vpn_base = src_vmm->args_vpn_base;
+    dst_vmm->envs_vpn_base = src_vmm->envs_vpn_base;
+    dst_vmm->heap_vpn_base = src_vmm->heap_vpn_base;
+    dst_vmm->code_vpn_base = src_vmm->code_vpn_base;
+    dst_vmm->data_vpn_base = src_vmm->data_vpn_base;
 
     dst_vmm->entry_point   = src_vmm->entry_point;
@@ -302,6 +301,5 @@
 
     return 0;
-
-}  // end vmm_copy()
+}
 
 ///////////////////////////////////////
@@ -344,6 +342,5 @@
     // release memory allocated to the local page table
     hal_gpt_destroy( &vmm->gpt );
-
-} // end vmm_destroy()
+}
 
 /////////////////////////////////////////////////
@@ -364,5 +361,5 @@
 	}
     return NULL;
-}  // vmm_check_conflict()
+}
 
 ////////////////////////////////////////////////////////////////////////////////////////////
@@ -398,6 +395,5 @@
     *vpn_size = CONFIG_VMM_STACK_SIZE - 1;
     return 0;
-
-}  // end vmm_stack_alloc()
+}
 
 ////////////////////////////////////////////////////////////////////////////////////////////
@@ -464,6 +460,5 @@
     *vpn_size = size;
     return 0;
-
-}  // end vmm_mmap_alloc()
+}
 
 //////////////////////////////////////////////
@@ -560,6 +555,5 @@
 
 	return vseg;
-
-}  // end vmm_create_vseg()
+}
 
 /////////////////////////////////////
@@ -612,7 +606,5 @@
         vseg_free( vseg );
     }
-
-}  // end vmm_remove_vseg()
-
+}
 
 //////////////////////////////////////////////
@@ -668,5 +660,5 @@
 
 	return 0;
-} // end vmm_map_vseg()
+}
 
 /////////////////////////////////////////
@@ -688,6 +680,5 @@
         hal_gpt_reset_pte( gpt , vpn );
     }
-} // end vmm_unmap_vseg()
-
+}
 
 /////////////////////////////////////////////
@@ -745,5 +736,5 @@
 
 	return error;
-} // end vmm_resize_vseg()
+}
 
 ///////////////////////////////////////////
@@ -765,6 +756,5 @@
 
     return vseg;
-
-} // end vmm_get_vseg()
+}
 
 /////////////////////////////////////////
@@ -779,5 +769,5 @@
     error_t   error;
 
-    // this function must be called by a thread running in the reference cluster 
+    // this function must be called by a thread running in the reference cluster
     assert( (GET_CXY( process->ref_xp ) == local_cxy ) , __FUNCTION__ ,
              " not called in the reference cluster\n" );
@@ -860,5 +850,5 @@
     *ret_attr = attr;
     return 0;
-}  // end vmm_get_pte()
+}
 
 ///////////////////////////////////////////////////
@@ -906,5 +896,5 @@
 
     return 0;
-}  // end vmm_handle_page_fault()
+}
 
 ///////////////////////////////////////////
@@ -946,10 +936,5 @@
 
     return error;
-
-}  // end vmm_v2p_translate()
-
-
-
-
+}
 
 /*
@@ -989,5 +974,5 @@
 	current.ppn     = ppn;
 	current.attr    = vseg->vm_pgprot;
-	current.cluster = NULL;	// this function is called after invalidate one 
+	current.cluster = NULL;	// this function is called after invalidate one
 
 	error= pmm_set_page(&vseg->vmm->pmm, vaddr , &current);
@@ -997,5 +982,5 @@
 }
 
-// Hypothesis: the vseg is shared-anon, mapper list is rdlocked, page is locked 
+// Hypothesis: the vseg is shared-anon, mapper list is rdlocked, page is locked
 error_t vmm_migrate_shared_page_seq( vseg_t *vseg, struct page_s *page, struct page_s **new)
 {
@@ -1016,5 +1001,5 @@
 	error      = ECANCELED;
 
-	// Invalidate All 
+	// Invalidate All
 	do
 	{
@@ -1055,5 +1040,5 @@
 	new_pg->index  = page->index;
 
-	// TODO: do the complet job regading dirty page 
+	// TODO: do the complet job regading dirty page
 	if(PAGE_IS(page, PG_DIRTY))
 		PAGE_SET(new_pg, PG_DIRTY);
@@ -1087,5 +1072,5 @@
 //TODO: revisit all manipulation of the page->refcount
 ///////////////////////////////////////////////////////////////
-static inline error_t vmm_do_migrate( vseg_t     * vseg, 
+static inline error_t vmm_do_migrate( vseg_t     * vseg,
                                       pmm_page_info_t * pinfo,
                                       uint32_t          vaddr )
@@ -1098,5 +1083,5 @@
 	error_t           err;
 	ppn_t             ppn;
- 
+
 	assert( pinfo->ppn != 0 );
 
@@ -1105,5 +1090,5 @@
 	newpage = NULL;
 	cluster = current_cluster;
-  
+
 	current.attr = 0;
 	current.ppn  = 0;
@@ -1111,12 +1096,12 @@
 	error= pmm_lock_page(&vseg->vmm->pmm, vaddr, &current);
 
-	if(error|| (current.isAtomic == false) || 
+	if(error|| (current.isAtomic == false) ||
               (current.ppn != ppn) || !(current.attr & PMM_MIGRATE))
 	{
 #if CONFIG_SHOW_SPURIOUS_PGFAULT
-		printk(INFO, "%s: pid %d, tid %d, cpu %d, nothing to do for vaddr %x\n", 
-		       __FUNCTION__, 
-		       this->process->pid, 
-		       this->info.order, 
+		printk(INFO, "%s: pid %d, tid %d, cpu %d, nothing to do for vaddr %x\n",
+		       __FUNCTION__,
+		       this->process->pid,
+		       this->info.order,
 		       cpu_get_id(),
 		       vaddr);
@@ -1127,5 +1112,5 @@
 		return 0;
 	}
-  
+
 	if(!ppn_is_local(ppn))
 	{
@@ -1161,5 +1146,5 @@
 	if(err)
 	{
-		// TODO: we should differ the kmem_free call 
+		// TODO: we should differ the kmem_free call
 		//page_unlock(page);
 		(void)pmm_unlock_page(&vseg->vmm->pmm, vaddr, &current);
@@ -1167,5 +1152,5 @@
 		kmem_free(&req);
 		return err;
-	} 
+	}
 
 
@@ -1174,5 +1159,5 @@
 		ppn_refcount_down(ppn);
 		current_thread->info.remote_pages_cntr ++;
-#if CONFIG_SHOW_REMOTE_PGALLOC  
+#if CONFIG_SHOW_REMOTE_PGALLOC
 		printk(INFO, "%s: pid %d, tid %x, cpu %d, cid %d: got new remote page from cluster %d (vaddr %x)\n",
 		       __FUNCTION__,
@@ -1225,5 +1210,5 @@
 		 vaddr);
 
-  
+
 	error= pmm_lock_page(&vseg->vmm->pmm, vaddr, &old);
 
@@ -1232,8 +1217,8 @@
 	{
 #if CONFIG_SHOW_SPURIOUS_PGFAULT
-		printk(INFO, "%s: pid %d, tid %d, cpu %d, nothing to do for vaddr %x\n", 
-		       __FUNCTION__, 
-		       this->process->pid, 
-		       this->info.order, 
+		printk(INFO, "%s: pid %d, tid %d, cpu %d, nothing to do for vaddr %x\n",
+		       __FUNCTION__,
+		       this->process->pid,
+		       this->info.order,
 		       cpu_get_id(),
 		       vaddr);
@@ -1246,5 +1231,5 @@
 	}
 
-	//if the ppn is local and the others (processus with wich we share the page) 
+	//if the ppn is local and the others (processus with wich we share the page)
 	//has done cow, then use the old.ppn directly
 	if(ppn_is_local(old.ppn))
@@ -1259,10 +1244,10 @@
 				newpage = page;//don't copy the page. use it directly.
 				isCountDown = false;
-				vmm_dmsg(2, "%s: pid %d, tid %d, cpu %d, reuse same page for vaddr %x, pg_addr %x\n", 
-					 __FUNCTION__, 
-					 this->process->pid, 
-					 this->info.order, 
-					 cpu_get_id(), 
-					 vaddr, 
+				vmm_dmsg(2, "%s: pid %d, tid %d, cpu %d, reuse same page for vaddr %x, pg_addr %x\n",
+					 __FUNCTION__,
+					 this->process->pid,
+					 this->info.order,
+					 cpu_get_id(),
+					 vaddr,
 					 ppm_page2addr(page));
 			}
@@ -1275,5 +1260,5 @@
 	//also defcount down the ppn
 	if(newpage == NULL)
-	{    
+	{
 		req.type  = KMEM_PAGE;
 		req.size  = 0;
@@ -1291,11 +1276,11 @@
 		assert(isCountDown);
 		
-		vmm_dmsg(2, 
-			 "%s: pid %d, tid %d, cpu %d, newpage for vaddr %x, pg_addr %x\n", 
-			 __FUNCTION__, 
-			 this->process->pid, 
-			 this->info.order, 
-			 cpu_get_id(), 
-			 vaddr, 
+		vmm_dmsg(2,
+			 "%s: pid %d, tid %d, cpu %d, newpage for vaddr %x, pg_addr %x\n",
+			 __FUNCTION__,
+			 this->process->pid,
+			 this->info.order,
+			 cpu_get_id(),
+			 vaddr,
 			 ppm_page2addr(newpage));
 
@@ -1323,11 +1308,11 @@
 	if(isCountDown) ppn_refcount_down(old.ppn);
 	
-	vmm_dmsg(2, "%s, pid %d, tid %d, cpu %d, COW ended [vaddr %x]\n", 
-		 __FUNCTION__, 
+	vmm_dmsg(2, "%s, pid %d, tid %d, cpu %d, COW ended [vaddr %x]\n",
+		 __FUNCTION__,
 		 this->process->pid,
 		 this->info.order,
 		 cpu_get_id(),
 		 vaddr);
-  
+
 	return 0;
 }
@@ -1358,8 +1343,8 @@
 	{
 #if CONFIG_SHOW_SPURIOUS_PGFAULT
-		printk(INFO, "%s: pid %d, tid %d, cpu %d, nothing to do for vaddr %x\n", 
-		       __FUNCTION__, 
-		       this->process->pid, 
-		       this->info.order, 
+		printk(INFO, "%s: pid %d, tid %d, cpu %d, nothing to do for vaddr %x\n",
+		       __FUNCTION__,
+		       this->process->pid,
+		       this->info.order,
 		       cpu_get_id(),
 		       vaddr);
@@ -1373,6 +1358,6 @@
 
 	//also hold a refcount!
-	ppn = mapper_get_ppn(&vseg->vm_mapper, 
-			       index, 
+	ppn = mapper_get_ppn(&vseg->vm_mapper,
+			       index,
 			       MAPPER_SYNC_OP);
 
@@ -1411,5 +1396,5 @@
 	old.attr  = 0;
 	this      = current_thread;
-  
+
 	error= pmm_lock_page(&vseg->vmm->pmm, vaddr, &old);
 
@@ -1505,14 +1490,14 @@
 #if 0
 #if CONFIG_SHOW_VMM_ERROR_MSG
-		printk(ERROR, 
+		printk(ERROR,
 		       "ERROR: %s: pid %d, cpu %d, Unexpected page attributes configuration for vaddr %x, found: ppn %x, attr %x\n",
 		       __FUNCTION__,
 		       current_process->pid,
-		       cpu_get_id(), 
-		       vaddr, 
+		       cpu_get_id(),
+		       vaddr,
 		       info.ppn,
 		       info.attr);
 #endif
-    
+
 		return EPERM;
 #endif
@@ -1524,6 +1509,4 @@
 	return vmm_do_aod(vseg, vaddr);
 }
-
 */
 
-
