Index: soft/giet_vm/sys/vm_handler.c
===================================================================
--- soft/giet_vm/sys/vm_handler.c	(revision 207)
+++ soft/giet_vm/sys/vm_handler.c	(revision 228)
@@ -20,27 +20,26 @@
 
 /////////////////////////////////////////////////////////////////////////////
-// 	Global variable : IOMMU page table
+//     Global variable : IOMMU page table
 /////////////////////////////////////////////////////////////////////////////
 
-__attribute__((section (".iommu"))) page_table_t	_iommu_ptab;
+__attribute__((section (".iommu"))) page_table_t _iommu_ptab;
 
 //////////////////////////////////////////////////////////////////////////////
 // _iommu_add_pte2()
 //////////////////////////////////////////////////////////////////////////////
-void _iommu_add_pte2( unsigned int	ix1,
-                      unsigned int	ix2,
-                      unsigned int	ppn,
-                      unsigned int	flags )
-{
-    unsigned int	ptba;
-    unsigned int*	pt_ppn;
-    unsigned int*	pt_flags;
+void _iommu_add_pte2(
+        unsigned int ix1,
+        unsigned int ix2,
+        unsigned int ppn,
+        unsigned int flags) {
+    unsigned int ptba;
+    unsigned int * pt_ppn;
+    unsigned int * pt_flags;
 
     // get pointer on iommu page table
-    page_table_t* pt = &_iommu_ptab;
+    page_table_t * pt = &_iommu_ptab;
 
     // get ptba and update PT2
-    if ( (pt->pt1[ix1] & PTE_V) == 0 )
-    {
+    if ((pt->pt1[ix1] & PTE_V) == 0) {
         _puts("\n[GIET ERROR] in iommu_add_pte2 function\n");
         _puts("the IOMMU PT1 entry is not mapped / ix1 = ");
@@ -49,29 +48,26 @@
         _exit();
     }
-    else
-    {
-        ptba      = pt->pt1[ix1] << 12;
-        pt_flags  = (unsigned int*)(ptba + 8*ix2);
-        pt_ppn    = (unsigned int*)(ptba + 8*ix2 + 4);
+    else {
+        ptba = pt->pt1[ix1] << 12;
+        pt_flags = (unsigned int *) (ptba + 8 * ix2);
+        pt_ppn = (unsigned int *) (ptba + 8 * ix2 + 4);
         *pt_flags = flags;
-        *pt_ppn   = ppn;
+        *pt_ppn = ppn;
     }
 } // end _iommu_add_pte2()
+
 
 //////////////////////////////////////////////////////////////////////////////
 // _iommu_inval_pte2()
 //////////////////////////////////////////////////////////////////////////////
-void _iommu_inval_pte2( unsigned int	ix1,
-                        unsigned int	ix2 )
-{
-    unsigned int	ptba;
-    unsigned int*	pt_flags;
+void _iommu_inval_pte2(unsigned int ix1, unsigned int ix2) {
+    unsigned int ptba;
+    unsigned int * pt_flags;
 
     // get pointer on iommu page table
-    page_table_t* pt = &_iommu_ptab;
+    page_table_t * pt = &_iommu_ptab;
 
     // get ptba and inval PTE2
-    if ( (pt->pt1[ix1] & PTE_V) == 0 )
-    {
+    if ((pt->pt1[ix1] & PTE_V) == 0) {
         _puts("\n[GIET ERROR] in iommu_inval_pte2 function\n");
         _puts("the IOMMU PT1 entry is not mapped / ix1 = ");
@@ -80,11 +76,11 @@
         _exit();
     }
-    else
-    {
-        ptba      = pt->pt1[ix1] << 12;
-        pt_flags  = (unsigned int*)(ptba + 8*ix2);
+    else {
+        ptba = pt->pt1[ix1] << 12;
+        pt_flags = (unsigned int *) (ptba + 8 * ix2);
         *pt_flags = 0;
     }   
 } // end _iommu_inval_pte2()
+
 
 //////////////////////////////////////////////////////////////////////////////
@@ -92,75 +88,72 @@
 // Returns 0 if success, 1 if PTE1 or PTE2 unmapped
 //////////////////////////////////////////////////////////////////////////////
-unsigned int _v2p_translate( page_table_t*	pt,
-                             unsigned int	vpn,
-                             unsigned int*	ppn,		
-                             unsigned int*	flags )	 
-{
-    unsigned int    ptba;
+unsigned int _v2p_translate(
+        page_table_t * pt,
+        unsigned int vpn,
+        unsigned int * ppn,        
+        unsigned int * flags) {
+    unsigned int ptba;
+    register unsigned int * pte2;
+    register unsigned int flags_value;
+    register unsigned int ppn_value;
 
-    register unsigned int*   pte2;
-    register unsigned int    flags_value;
-    register unsigned int    ppn_value;
-
-    unsigned int    ix1 = vpn >> 9;
-    unsigned int    ix2 = vpn & 0x1FF;
-/*
-_puts("\n\n********************** entering v2p_translate");
-_puts("\n - pt    = ");
-_putx( (unsigned int)pt );
-_puts("\n - vpn   = ");
-_putx( vpn << 12 );
-_puts("\n - ptba  = ");
-_putx( pt->pt1[ix1] << 12 ) ;
-_puts("\n - &pte2 = ");
-_putx( (pt->pt1[ix1] << 12) + 8*ix2 );
-_puts("\n - flags = ");
-_putx( *(unsigned int*)((pt->pt1[ix1] << 12) + 8*ix2) );
-_puts("\n");
-*/
+    unsigned int ix1 = vpn >> 9;
+    unsigned int ix2 = vpn & 0x1FF;
+    /*
+       _puts("\n\n********************** entering v2p_translate");
+       _puts("\n - pt    = ");
+       _putx( (unsigned int)pt );
+       _puts("\n - vpn   = ");
+       _putx( vpn << 12 );
+       _puts("\n - ptba  = ");
+       _putx( pt->pt1[ix1] << 12 ) ;
+       _puts("\n - &pte2 = ");
+       _putx( (pt->pt1[ix1] << 12) + 8*ix2 );
+       _puts("\n - flags = ");
+       _putx( *(unsigned int*)((pt->pt1[ix1] << 12) + 8*ix2) );
+       _puts("\n");
+       */
     // check PTE1 mapping
-    if ( (pt->pt1[ix1] & PTE_V) == 0 )
-    {
+    if ((pt->pt1[ix1] & PTE_V) == 0) {
         return 1;
     }
-    else
-    {
+    else {
         // get physical addresses of pte2 
         ptba = pt->pt1[ix1] << 12;
-        pte2 = (unsigned int*)(ptba + 8*ix2);
+        pte2 = (unsigned int *) (ptba + 8 * ix2);
 
         // gets ppn_value and flags_value, after temporary DTLB desactivation
-        asm volatile ( "li      $27,    0xFFFFFFFE  \n"     /* Mask for IE bits     */
-                       "mfc0    $26,    $12         \n"     /* save SR              */ 
-                       "and     $27,    $26,    $27 \n"
-                       "mtc0    $27,    $12         \n"     /* disable Interrupts   */
+        asm volatile (
+                "li      $27,    0xFFFFFFFE  \n"     /* Mask for IE bits     */
+                "mfc0    $26,    $12         \n"     /* save SR              */ 
+                "and     $27,    $26,    $27 \n"
+                "mtc0    $27,    $12         \n"     /* disable Interrupts   */
 
-                       "li      $27,    0xB         \n"     
-                       "mtc2    $27,    $1          \n"     /* DTLB unactivated     */ 
+                "li      $27,    0xB         \n"     
+                "mtc2    $27,    $1          \n"     /* DTLB unactivated     */ 
 
-                       "move    $27,    %2          \n"     /* $27 <= pte2          */
-                       "lw      %0,     0($27)      \n"     /* read flags           */ 
-                       "lw      %1,     4($27)      \n"     /* read ppn             */
+                "move    $27,    %2          \n"     /* $27 <= pte2          */
+                "lw      %0,     0($27)      \n"     /* read flags           */ 
+                "lw      %1,     4($27)      \n"     /* read ppn             */
 
-                       "li      $27,    0xF         \n" 
-                       "mtc2    $27,    $1          \n"     /* DTLB activated       */
+                "li      $27,    0xF         \n" 
+                "mtc2    $27,    $1          \n"     /* DTLB activated       */
 
-                       "mtc0    $26,    $12         \n"     /* restore SR           */
-                        :"=r"(flags_value), "=r"(ppn_value)
-                        :"r"(pte2)
-                        :"$26","$27","$8" );
+                "mtc0    $26,    $12         \n"     /* restore SR           */
+                : "=r" (flags_value), "=r" (ppn_value)
+                : "r" (pte2)
+                : "$26","$27","$8");
 
         // check PTE2 mapping
-        if ( (flags_value & PTE_V) == 0 )
-        {
+        if ((flags_value & PTE_V) == 0) {
             return 1;
         }
 
         // set return values 
-        *ppn      = ppn_value;
-        *flags    = flags_value;
+        *ppn = ppn_value;
+        *flags = flags_value;
     }
     return 0;
-}	// end _v2p_translate()
+} // end _v2p_translate()
 
 // Local Variables:
@@ -170,5 +163,5 @@
 // indent-tabs-mode: nil
 // End:
+// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
 
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
 
