Index: trunk/kernel/mm/vseg.c
===================================================================
--- trunk/kernel/mm/vseg.c	(revision 406)
+++ trunk/kernel/mm/vseg.c	(revision 407)
@@ -52,12 +52,8 @@
   	if     ( vseg_type == VSEG_TYPE_CODE   ) return "CODE";
   	else if( vseg_type == VSEG_TYPE_DATA   ) return "DATA";
-  	else if( vseg_type == VSEG_TYPE_HEAP   ) return "HEAP";
-  	else if( vseg_type == VSEG_TYPE_STACK  ) return "STACK";
+  	else if( vseg_type == VSEG_TYPE_STACK  ) return "STAK";
   	else if( vseg_type == VSEG_TYPE_ANON   ) return "ANON";
   	else if( vseg_type == VSEG_TYPE_FILE   ) return "FILE";
-  	else if( vseg_type == VSEG_TYPE_REMOTE ) return "REMOTE";
-  	else if( vseg_type == VSEG_TYPE_KCODE  ) return "KCODE";
-  	else if( vseg_type == VSEG_TYPE_KDATA  ) return "KDATA";
-  	else if( vseg_type == VSEG_TYPE_KDEV   ) return "KDEV";
+  	else if( vseg_type == VSEG_TYPE_REMOTE ) return "REMO";
     else                                     return "undefined";
 }
@@ -87,18 +83,23 @@
 ///////////////////////////////////
 void vseg_init( vseg_t      * vseg,
+                vseg_type_t   type,
 	            intptr_t      base,
-                intptr_t      size,
+                uint32_t      size,
                 vpn_t         vpn_base,
                 vpn_t         vpn_size,
-		        uint32_t      type,
+		        uint32_t      file_offset,
+                uint32_t      file_size,
+                xptr_t        mapper_xp,
                 cxy_t         cxy )
 {
-    vseg->type      = type;
-	vseg->min       = base;
-	vseg->max       = base + size;
-    vseg->vpn_base  = vpn_base;
-	vseg->vpn_size  = vpn_size;
-	vseg->mapper_xp = XPTR_NULL;
-    vseg->cxy       = cxy;
+    vseg->type        = type;
+	vseg->min         = base;
+	vseg->max         = base + size;
+    vseg->vpn_base    = vpn_base;
+	vseg->vpn_size    = vpn_size;
+    vseg->file_offset = file_offset;
+    vseg->file_size   = file_size;
+	vseg->mapper_xp   = mapper_xp;
+    vseg->cxy         = cxy;
 
     // set vseg flags depending on type
@@ -124,11 +125,4 @@
                       VSEG_DISTRIB ;
     }
-    else if( type == VSEG_TYPE_HEAP )
-    {
-        vseg->flags = VSEG_USER    |
-                      VSEG_WRITE   |
-                      VSEG_CACHE   |
-                      VSEG_DISTRIB ;
-    }
     else if( type == VSEG_TYPE_REMOTE )
     {
@@ -141,6 +135,5 @@
         vseg->flags = VSEG_USER    |
                       VSEG_WRITE   |
-                      VSEG_CACHE   |
-                      VSEG_DISTRIB ;
+                      VSEG_CACHE; 
     }
     else if( type == VSEG_TYPE_FILE )
@@ -161,4 +154,8 @@
                       VSEG_CACHE   |
                       VSEG_PRIVATE ;
+    }
+    else if( type == VSEG_TYPE_KDEV )
+    {
+        vseg->flags = VSEG_WRITE   ;
     }
     else
@@ -171,18 +168,20 @@
 //////////////////////////////////////////
 void vseg_init_from_ref( vseg_t    * vseg,
-                         xptr_t      ref )
+                         xptr_t      ref_xp )
 {
     // get remote vseg cluster and pointer
-    cxy_t    cxy = (cxy_t   )GET_CXY( ref );
-    vseg_t * ptr = (vseg_t *)GET_PTR( ref );
+    cxy_t    cxy = (cxy_t   )GET_CXY( ref_xp );
+    vseg_t * ptr = (vseg_t *)GET_PTR( ref_xp );
 
     // initialize vseg with remote_read access
-    vseg->type       =           hal_remote_lw ( XPTR( cxy , &ptr->type      ) );
-    vseg->min        = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->min       ) );
-    vseg->max        = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->max       ) );
-    vseg->vpn_base   =           hal_remote_lw ( XPTR( cxy , &ptr->vpn_base  ) );
-    vseg->vpn_size   =           hal_remote_lw ( XPTR( cxy , &ptr->vpn_size  ) );
-    vseg->flags      =           hal_remote_lw ( XPTR( cxy , &ptr->flags     ) );
-	vseg->mapper_xp  = (xptr_t)  hal_remote_lwd( XPTR( cxy , &ptr->mapper_xp ) );
+    vseg->type        =           hal_remote_lw ( XPTR( cxy , &ptr->type        ) );
+    vseg->min         = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->min         ) );
+    vseg->max         = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->max         ) );
+    vseg->vpn_base    =           hal_remote_lw ( XPTR( cxy , &ptr->vpn_base    ) );
+    vseg->vpn_size    =           hal_remote_lw ( XPTR( cxy , &ptr->vpn_size    ) );
+    vseg->flags       =           hal_remote_lw ( XPTR( cxy , &ptr->flags       ) );
+    vseg->file_offset =           hal_remote_lw ( XPTR( cxy , &ptr->file_offset ) );
+    vseg->file_size   =           hal_remote_lw ( XPTR( cxy , &ptr->file_size   ) );
+	vseg->mapper_xp   = (xptr_t)  hal_remote_lwd( XPTR( cxy , &ptr->mapper_xp   ) );
 }
 
