Index: trunk/kernel/mm/vmm.h
===================================================================
--- trunk/kernel/mm/vmm.h	(revision 437)
+++ trunk/kernel/mm/vmm.h	(revision 440)
@@ -293,17 +293,4 @@
 
 /*********************************************************************************************
- * This function allocates physical memory from the local cluster to map all PTEs
- * of a "kernel" vseg (type KCODE , KDATA, or KDEV) in the page table of process_zero.
- * WARNING : It should not be used for "user" vsegs, that must be mapped using the
- * "on-demand-paging" policy.
- *********************************************************************************************
- * @ vseg     : pointer on the vseg to be mapped.
- * @ attr     : GPT attributes to be set for all vseg pages.
- * @ returns 0 if success / returns ENOMEM if no memory
- ********************************************************************************************/
-error_t vmm_map_kernel_vseg( vseg_t           * vseg,
-                             uint32_t           attr );
-
-/*********************************************************************************************
  * This function removes a given region (defined by a base address and a size) from
  * the VMM of a given process descriptor. This can modify the number of vsegs:
@@ -335,6 +322,6 @@
  * @ process   : [in] pointer on process descriptor
  * @ vaddr     : [in] virtual address
- * @ vseg      : [out] pointer on found vseg
- * @ returns 0 if success / returns -1 if user error.
+ * @ vseg      : [out] local pointer on local vseg
+ * @ returns 0 if success / returns -1 if user error (out of segment).
  *********************************************************************************************/
 error_t vmm_get_vseg( struct process_s  * process,
@@ -343,45 +330,35 @@
 
 /*********************************************************************************************
- * This function is called by the generic exception handler when a page-fault event
- * has been detected for a given process in a given cluster.
- * - If the local cluster is the reference, it call directly the vmm_get_pte() function.
- * - If the local cluster is not the reference cluster, it send a RPC_VMM_GET_PTE
- *   to the reference cluster to get the missing PTE attributes and PPN,
- *   and update the local page table. 
- *********************************************************************************************
- * @ process   : pointer on process descriptor.
- * @ vpn       : VPN of the missing PTE.
- * @ returns 0 if success / returns ENOMEM if no memory.
+ * This function is called by the generic exception handler in case of page-fault,
+ * or copy-on-write event locally detected for a given <vpn> in a given <process>
+ * as defined by the <is_cow> argument.
+ * 1) For a Page-Fault:
+ * - If the local cluster is the reference, or for the STACK and CODE segment types,
+ *   it call directly the vmm_get_pte() function to access the local VMM.
+ * - Otherwise, it send a RPC_VMM_GET_PTE to the reference cluster to get the missing 
+ *   PTE attributes and PPN.
+ * This function check that the missing VPN belongs to a registered vseg, allocates
+ * a new physical page if required, and updates the local page table. 
+ * 2) For a Copy-On-Write:
+ * - If no pending fork, it reset the COW flag and set the WRITE flag in the reference
+ *   GPT entry, and in all the GPT copies.
+ * - If there is a pending fork, it allocates a new physical page from the cluster defined 
+ *   by the vseg type, copies the old physical page content to the new physical page,
+ *   and decrements the pending_fork counter in old physical page descriptor.
+ *********************************************************************************************
+ * @ process   : pointer on local process descriptor copy.
+ * @ vpn       : VPN of the missing or faulting PTE.
+ * @ is_cow    : Copy-On-Write event if true / Page-fault if false.
+ * @ returns 0 if success / returns ENOMEM if no memory or illegal VPN.
  ********************************************************************************************/
 error_t vmm_handle_page_fault( struct process_s * process,
-                               vpn_t              vpn );
-
-/*********************************************************************************************
- * This function is called by the generic exception handler when a copy-on-write event
- * has been detected for a given process in a given cluster.
- * It takes the lock protecting the physical page, and test the pending forks counter.
- * If no pending fork:
- * - it reset the COW flag and set the WRITE flag in the reference GPT entry, and in all
- *   the GPT copies
-
- * If there is a pending forkon the
- * - It get the involved vseg pointer. 
- * - It allocates a new physical page from the cluster defined by the vseg type.
- * - It copies the old physical page content to the new physical page.
- * - It decrements the pending_fork counter in old physical page descriptor.
-
- *********************************************************************************************
- * @ process   : pointer on process descriptor.
- * @ vpn       : VPN of the missing PTE.
- * @ returns 0 if success / returns ENOMEM if no memory.
- ********************************************************************************************/
-error_t vmm_handle_cow( struct process_s * process,
-                        vpn_t              vpn );
-
-/*********************************************************************************************
- * This function handle both the "page-fault" and "copy-on_write" events for a given <vpn> 
- * in a given <process>.  The <cow> argument defines the type of event to be handled. 
- * This function must be called by a thread running in reference cluster, and the vseg
- * containing the searched VPN must be registered in the reference VMM.
+                               vpn_t              vpn,
+                               bool_t             is_cow );
+
+/*********************************************************************************************
+ * This function is called by the vmm_handle_page_fault() to handle both the "page-fault",
+ * and the "copy-on_write" events for a given <vpn> in a given <process>, as defined
+ * by the <is_cow> argument. 
+ * The vseg containing the searched VPN must be registered in the reference VMM.
  * - for an page-fault, it allocates the missing physical page from the target cluster
  *   defined by the vseg type, initializes it, and updates the reference GPT, but not
@@ -390,11 +367,11 @@
  *   initialise it from the old physical page, and updates the reference GPT and all
  *   the GPT copies, for coherence. 
- * In both cases, it calls the RPC_PMEM_GET_PAGES to get the new physical page when
- * the target cluster is not the reference cluster.
+ * It calls the RPC_PMEM_GET_PAGES to get the new physical page when the target cluster
+ * is not the local cluster, 
  * It returns in the <attr> and <ppn> arguments the accessed or modified PTE.
  *********************************************************************************************
  * @ process   : [in] pointer on process descriptor.
  * @ vpn       : [in] VPN defining the missing PTE.
- * @ cow       : [in] "copy_on_write" if true / "page_fault" if false.
+ * @ is_cow    : [in] "copy_on_write" if true / "page_fault" if false.
  * @ attr      : [out] PTE attributes.
  * @ ppn       : [out] PTE ppn.
@@ -403,5 +380,5 @@
 error_t vmm_get_pte( struct process_s * process,
                      vpn_t              vpn,
-                     bool_t             cow,
+                     bool_t             is_cow,
                      uint32_t         * attr,
                      ppn_t            * ppn );
@@ -428,22 +405,4 @@
                          ppn_t  * ppn );
 
-/*********************************************************************************************
- * This function makes the virtual to physical address translation, using the calling
- * process page table. It uses identity mapping if required by the <ident> argument.
- * This address translation is required to configure the peripherals having a DMA
- * capability, or to implement the software L2/L3 cache cohérence, using the MMC device 
- * synchronisation primitives.
- * WARNING : the <ident> value must be defined by the CONFIG_KERNEL_IDENTITY_MAP parameter.
- *********************************************************************************************
- * @ ident     : [in] uses identity mapping if true.
- * @ ptr       : [in] virtual address.
- * @ paddr     : [out] pointer on buffer for physical address.
- * @ returns 0 if success / returns ENOMEM if error.
- ********************************************************************************************/
-error_t vmm_v2p_translate( bool_t    ident,
-                           void    * ptr,
-                           paddr_t * paddr );
-
-
 
 #endif /* _VMM_H_ */
