Index: trunk/kernel/mm/page.h
===================================================================
--- trunk/kernel/mm/page.h	(revision 22)
+++ trunk/kernel/mm/page.h	(revision 23)
@@ -49,4 +49,5 @@
 #define PG_DIRTY	    0x0040     // page has been written
 #define PG_LOCKED       0x0080     // page is locked
+#define PG_COW          0x0100     // page is copy-on-write
 
 #define PG_ALL          0xFFFF     // All flags
@@ -54,27 +55,17 @@
 /*************************************************************************************
  * This structure defines a physical page descriptor.
- * Size is 60 bytes for a 32 bits core...
+ * Size is 64 bytes for a 32 bits core...
  ************************************************************************************/
 
 typedef struct page_s
 {
-    uint16_t          flags;          /*! flags defined above                  (2)  */
-    uint16_t          order;          /*! log2( number of 4Kbytes pages)       (2)  */
-
+    uint32_t          flags;          /*! flags defined above                  (4)  */
+    uint32_t          order;          /*! log2( number of 4Kbytes pages)       (4)  */
     struct mapper_s * mapper;         /*! local pointer on associated mapper   (4)  */
     uint32_t          index;          /*! page index in mapper                 (4)  */
-
-	union                             /*!                                      (4)  */
-	{
-		uint32_t      private;        /*! TODO ??? [AG]                             */
-		void        * data;           /*! TODO ??? [AG]                             */
-		slist_entry_t root;           /*! TODO ??? [AG]                             */
-	};
-
 	list_entry_t      list;           /*! for both dirty pages and free pages  (8)  */
-
     xlist_entry_t     wait_root;      /*! root of list of waiting threads      (16) */
-
 	uint32_t          refcount;       /*! reference counter                    (4)  */
+	uint32_t          fork_nr;        /*! number of forked processes           (4)  */
 	spinlock_t        lock;           /*! only used to set the PG_LOCKED flag  (16) */
 }
@@ -83,4 +74,5 @@
 /*************************************************************************************
  * This function initializes one page descriptor.
+ *************************************************************************************
  * @ page    : pointer to page descriptor
  ************************************************************************************/
@@ -88,21 +80,24 @@
 
 /*************************************************************************************
- * This function sets one or several flags in page descriptor flags.
+ * This function atomically set one or several flags in page descriptor flags.
+ *************************************************************************************
  * @ page    : pointer to page descriptor.
  * @ value   : all non zero bits in value will be set.
  ************************************************************************************/
 inline void page_set_flag( page_t   * page,
-                           uint16_t   value );
+                           uint32_t   value );
 
 /*************************************************************************************
- * This function clears one or several flags in page descriptor flags.
+ * This function atomically reset one or several flags in page descriptor flags.
+ *************************************************************************************
  * @ page    : pointer to page descriptor.
  * @ value   : all non zero bits in value will be cleared.
  ************************************************************************************/
 inline void page_clear_flag( page_t   * page,
-                             uint16_t   value );
+                             uint32_t   value );
 
 /*************************************************************************************
  * This function tests the value of one or several flags in page descriptor flags.
+ *************************************************************************************
  * @ page    : pointer to page descriptor.
  * @ value   : all non zero bits will be tested.
@@ -110,5 +105,5 @@
  ************************************************************************************/
 inline bool_t page_is_flag( page_t   * page,
-                            uint16_t   value );
+                            uint32_t   value );
 
 /*************************************************************************************
@@ -121,4 +116,5 @@
  * This function sets the PG_DIRTY flag in the page descriptor,
  * and registers the page in the dirty list in PPM.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  * @ returns true if page was not dirty / returns false if page was dirty
@@ -129,4 +125,5 @@
  * This function resets the PG_DIRTY flag in the page descriptor,
  * and removes the page from the dirty list in PPM.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  * @ returns true if page was dirty / returns false if page was not dirty
@@ -136,4 +133,5 @@
 /*************************************************************************************
  * This function makes a local copy of the content of a src page to a dst page.
+ *************************************************************************************
  * @ dst      : pointer on destination page descriptor.
  * @ src      : pointer on source page descriptor.
@@ -144,4 +142,5 @@
 /*************************************************************************************
  * This function resets to 0 all bytes in a given page.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  ************************************************************************************/
@@ -152,4 +151,5 @@
  * It deschedule if the page has already been locked by another thread,
  * and returns only when the flag has been successfully set.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  ************************************************************************************/
@@ -160,4 +160,5 @@
  * other waiting thread. If there is waiting thread(s), it activates the first
  * waiting thread without modifying the PG_LOCKED flag.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  ************************************************************************************/
@@ -166,4 +167,5 @@
 /*************************************************************************************
  * This blocking function atomically increments the page refcount.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  ************************************************************************************/
@@ -172,4 +174,5 @@
 /*************************************************************************************
  * This blocking function atomically decrements the page refcount.
+ *************************************************************************************
  * @ page     : pointer on page descriptor.
  ************************************************************************************/
@@ -178,4 +181,6 @@
 /*************************************************************************************
  * This function display the values contained in a page descriptor.
+ *************************************************************************************
+ * @ page     : pointer on page descriptor.
  ************************************************************************************/
 void page_print( page_t * page );
