Index: trunk/hal/tsar_mips32/core/hal_gpt.c
===================================================================
--- trunk/hal/tsar_mips32/core/hal_gpt.c	(revision 124)
+++ trunk/hal/tsar_mips32/core/hal_gpt.c	(revision 315)
@@ -69,6 +69,6 @@
 #define TSAR_MMU_IX2_FROM_VPN( vpn )       (vpn & 0x1FF)
 
-#define TSAR_MMU_PTBA_FROM_PTE1( pte1 )    (pte1 & 0xFFFFFFF)
-#define TSAR_MMU_PPN_FROM_PTE1( pte1 )     ((pte1 & 0x7FFFF)<<9) 
+#define TSAR_MMU_PTBA_FROM_PTE1( pte1 )    (pte1 & 0x0FFFFFFF)
+#define TSAR_MMU_PPN_FROM_PTE1( pte1 )     ((pte1 & 0x0007FFFF)<<9) 
 #define TSAR_MMU_ATTR_FROM_PTE1( pte1 )    (pte1 & 0xFFC00000)
 
@@ -99,4 +99,5 @@
 {
 	page_t   * page;
+    xptr_t     page_xp;
 
     // check page size
@@ -121,7 +122,9 @@
 
     // initialize generic page table descriptor
-	gpt->ptr  = ppm_page2vaddr( page );
-	gpt->ppn  = ppm_page2ppn( page );
-	gpt->page = page;
+    page_xp   = XPTR( local_cxy , page );
+
+	gpt->ptr  = GET_PTR( ppm_page2base( page_xp ) );
+	gpt->ppn  = ppm_page2ppn( page_xp );
+	gpt->page = GET_PTR( page_xp );
 
     // initialize PTE entries attributes masks
@@ -191,7 +194,8 @@
             else                           // SMALL page
             {
-                // get pointer on PT2
+                // get local pointer on PT2
                 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
-                pt2 = ppm_ppn2vaddr( pt2_ppn );
+                xptr_t base_xp = ppm_ppn2base( pt2_ppn );
+                pt2 = (uint32_t *)GET_PTR( base_xp );
 
                 // scan the PT2 to release all entries VALID and USER if reference cluster
@@ -212,5 +216,5 @@
                 // release the PT2
                 req.type = KMEM_PAGE;
-                req.ptr  = ppm_vaddr2page( pt2 );
+                req.ptr  = GET_PTR( ppm_base2page( XPTR(local_cxy , pt2 ) ) );
                 kmem_free( &req );
             }
@@ -220,5 +224,5 @@
     // release the PT1
     req.type = KMEM_PAGE;
-    req.ptr  = ppm_vaddr2page( pt1 );
+    req.ptr  = GET_PTR( ppm_base2page( XPTR(local_cxy , pt1 ) ) );
     kmem_free( &req );
 
@@ -255,5 +259,6 @@
             {
                 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
-                pt2 = ppm_ppn2vaddr( pt2_ppn );
+                xptr_t base_xp = ppm_ppn2base ( pt2_ppn );
+                pt2 = (uint32_t *)GET_PTR( base_xp );
 
                 // scan the PT2
@@ -288,6 +293,8 @@
 
 	uint32_t            small;       // requested PTE is for a small page
-	bool_t              atomic;      //
+	bool_t              atomic;
+
 	page_t            * page;        // pointer on new physical page descriptor
+    xptr_t              page_xp;     // extended pointer on new page descriptor
 
     uint32_t            ix1;         // index in PT1
@@ -338,6 +345,8 @@
             return ENOMEM;
         }
-        pt2_ppn = ppm_page2ppn( page );
-        pt2     = ppm_page2vaddr( page );
+
+        page_xp = XPTR( local_cxy , page );        
+        pt2_ppn = ppm_page2ppn( page_xp );
+        pt2     = (uint32_t *)GET_PTR( ppm_page2base( page_xp ) );
 
         // try to atomicaly set a PTD1 in the PT1 entry 
@@ -361,5 +370,5 @@
 
             // compute pointer on PT2 base
-			pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn );
+			pt2 = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
 		}
 	}
@@ -378,5 +387,5 @@
 
         // compute pointer on PT2 base
-	    pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn );
+	    pt2 = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
 	}
 
@@ -424,5 +433,5 @@
         // compute PT2 base address
         pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
-        pt2     = (uint32_t*)ppm_ppn2vaddr( pt2_ppn );
+        pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
 
 	    *ppn  = pt2[2*ix2+1] & ((1<<TSAR_MMU_PPN_WIDTH)-1);
@@ -478,5 +487,5 @@
         // compute PT2 base address
         pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
-        pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn );
+        pt2 = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
         
         // get PPN
@@ -514,4 +523,5 @@
 	bool_t              atomic;
     page_t            * page;
+    xptr_t              page_xp;
 
     uint32_t  ix1 = TSAR_MMU_IX1_FROM_VPN( vpn );    // index in PT1
@@ -547,6 +557,7 @@
         }
 
-        pt2_ppn = ppm_page2ppn( page );
-        pt2     = ppm_page2vaddr( page );
+        page_xp = XPTR( local_cxy , page );
+        pt2_ppn = ppm_page2ppn( page_xp );
+        pt2     = (uint32_t *)GET_PTR( ppm_page2base( page_xp ) );
 
         // try to set the PT1 entry
@@ -568,5 +579,5 @@
             // get the PT2 base address
 			pt2_ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 );
- 			pt2     = (uint32_t*)ppm_ppn2vaddr( pt2_ppn );
+ 			pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
 		}
 	}
@@ -585,5 +596,5 @@
 
         // compute pointer on PT2 base
-	    pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn );
+	    pt2 = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     }
     
@@ -645,5 +656,5 @@
     // get pointer on PT2 base
     pt2_ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 );
-    pt2     = ppm_ppn2vaddr( pt2_ppn );
+    pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
  
     // get pointer on PTE2
@@ -686,4 +697,5 @@
 
     page_t     * page;
+    xptr_t       page_xp;
 
     ppn_t        src_pt2_ppn;
@@ -721,14 +733,18 @@
                 }
 
+                // get extended pointer on page descriptor
+                page_xp = XPTR( local_cxy , page );
+
                 // get pointer on new PT2 in DST_GPT
-                dst_pt2 = (uint32_t *)ppm_page2vaddr( page );
+                xptr_t base_xp = ppm_page2base( page_xp );
+                dst_pt2 = (uint32_t *)GET_PTR( base_xp );
 
                 // set a new PTD1 in DST_GPT
-                dst_pt2_ppn  = (ppn_t)ppm_page2ppn( page );
+                dst_pt2_ppn  = (ppn_t)ppm_page2ppn( page_xp );
                 dst_pt1[ix1] = TSAR_MMU_PRESENT | TSAR_MMU_PTD1 | dst_pt2_ppn;
 
                 // get pointer on PT2 in SRC_GPT
                 src_pt2_ppn = (ppn_t)TSAR_MMU_PTBA_FROM_PTE1( pte1 );
-                src_pt2     = (uint32_t *)ppm_ppn2vaddr( src_pt2_ppn );
+                src_pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( src_pt2_ppn ) );
 
                 // scan the SRC_PT2
@@ -756,5 +772,5 @@
 
                             // register PG_COW in page descriptor
-                            page = ppm_ppn2page( pte2_ppn );
+                            page = (page_t *)GET_PTR( ppm_ppn2page( pte2_ppn ) );
                             hal_atomic_or( &page->flags , PG_COW );
 							hal_atomic_add( &page->fork_nr , 1 );
