Index: trunk/hal/tsar_mips32/core/hal_gpt.c
===================================================================
--- trunk/hal/tsar_mips32/core/hal_gpt.c	(revision 679)
+++ trunk/hal/tsar_mips32/core/hal_gpt.c	(revision 686)
@@ -2,5 +2,5 @@
  * hal_gpt.c - implementation of the Generic Page Table API for TSAR-MIPS32
  *
- * Author   Alain Greiner (2016,2017,2018,2019)
+ * Author   Alain Greiner (2016,2017,2018,2019,2020)
  *
  * Copyright (c) UPMC Sorbonne Universites
@@ -37,4 +37,21 @@
 
 ////////////////////////////////////////////////////////////////////////////////////////
+// The Page Table for the TSAR-MIPS32 MMU is defined as a two levels radix tree.
+//
+// It defines two page sizes : 4 Kbytes pages, and 2 Mbytes pages.
+// The virtual address space size is 4 Gbytes (32 bits virtual addresses). 
+// The physical address space is limited to 1 Tbytes (40 bits physical addresses).
+// - For a 4 Kbytes page, the VPN uses 20 bits, and the PPN requires 28 bits.
+// - For a 2 Mbytes page, the PPN uses 11 bits, and the PPN requires 19 bits.
+//
+// The first level array (PT1) contains 2048 entries, each entry contains 4 bytes,
+// and this array is aligned on a 8K bytes boundary.
+//
+// The second level array (PT2) contains 512 entries, each entry contains 8 bytes,
+// and this array is ligned on a 4K bytes boundary. 
+////////////////////////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////
 // This define the masks for the TSAR MMU PTE attributes (from TSAR MMU specification)
 ////////////////////////////////////////////////////////////////////////////////////////
@@ -152,12 +169,9 @@
 
 // check page size
-assert( __FUNCTION__, (CONFIG_PPM_PAGE_SIZE == 4096) , "the TSAR page size must be 4 Kbytes\n" );
-
-    // allocates 2 physical pages for PT1
-	kmem_req_t req;
-	req.type  = KMEM_PPM;
-	req.order = 1;                     // 2 small pages 
-	req.flags = AF_KERNEL | AF_ZERO;
-	base = kmem_alloc( &req );
+assert( __FUNCTION__, (CONFIG_PPM_PAGE_SIZE == 4096) , 
+"the TSAR page size must be 4 Kbytes\n" );
+
+    // allocates 8 Kbytes for PT1
+	base = kmem_alloc( 13 , AF_ZERO );
 
 	if( base == NULL ) 
@@ -197,5 +211,4 @@
     uint32_t   * pt2;
     uint32_t     attr;
-	kmem_req_t   req;
 
     thread_t * this = CURRENT_THREAD;
@@ -241,16 +254,12 @@
                 }
 
-                // release the page allocated for the PT2
-                req.type = KMEM_PPM;
-                req.ptr  = pt2;
-                kmem_free( &req );
+                // release the 4K bytes allocated for the PT2
+                kmem_free( pt2 , 12 );
             }
         }
 	}
 
-    // release the PT1
-    req.type = KMEM_PPM;
-    req.ptr  = pt1;
-    kmem_free( &req );
+    // release the 8K bytes allocated for PT1
+    kmem_free( pt1 , 13 );
 
 #if DEBUG_HAL_GPT_DESTROY
@@ -272,7 +281,4 @@
     xptr_t              pte1_xp;         // extended pointer on PT1[x1] entry
 	uint32_t            pte1;            // value of PT1[x1] entry
-
-    kmem_req_t          req;             // kmem request fro PT2 allocation
-
     uint32_t          * pt2;             // local pointer on PT2 base
 	ppn_t               pt2_ppn;         // PPN of page containing PT2
@@ -334,8 +340,6 @@
             hal_disable_irq( &sr_save );
 
-            req.type  = KMEM_PPM;
-            req.order = 0;  
-            req.flags = AF_ZERO | AF_KERNEL;
-            pt2       = kmem_remote_alloc( gpt_cxy , &req );
+            // allocate a 4K bytes PT2
+            pt2       = kmem_remote_alloc( gpt_cxy , 12 , AF_ZERO );
 
             if( pt2 == NULL )
@@ -863,6 +867,4 @@
     uint32_t   * dst_pt2;   // local pointer on DST PT2
 
-	kmem_req_t   req;       // for PT2 allocation
-
     uint32_t     src_pte1;
     uint32_t     dst_pte1;
@@ -917,9 +919,6 @@
         if( (dst_pte1 & TSAR_PTE_MAPPED) == 0 ) 
         { 
-            // allocate one physical page for a new PT2
-	        req.type  = KMEM_PPM;
-	        req.order = 0;                     // 1 small page 
-	        req.flags = AF_KERNEL | AF_ZERO;
-	        dst_pt2   = kmem_alloc( &req );
+            // allocate one 4K bytes physical page for a new PT2
+	        dst_pt2   = kmem_alloc( 12 , AF_ZERO );
 
             if( dst_pt2 == NULL )
