[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hap: Fix for coding style.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1184660561 -3600
# Node ID 23dab4b0545531e0ea0476b486c89a42455bcbe1
# Parent  d99903a98ad018c9aed180480577f56ce015fd30
hap: Fix for coding style.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm/hap/hap.c     |  122 ++++++++++++++++---------------
 xen/arch/x86/mm/hap/support.c |  164 +++++++++++++++++++++---------------------
 xen/include/asm-x86/hap.h     |    3 
 3 files changed, 151 insertions(+), 138 deletions(-)

diff -r d99903a98ad0 -r 23dab4b05455 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c Mon Jul 16 14:28:54 2007 +0100
+++ b/xen/arch/x86/mm/hap/hap.c Tue Jul 17 09:22:41 2007 +0100
@@ -133,21 +133,21 @@ struct page_info * hap_alloc_p2m_page(st
     */
     if ( d->arch.paging.hap.p2m_pages == 0 ) 
     {
-       pg = alloc_domheap_pages(NULL, 0, MEMF_bits(32));
-       d->arch.paging.hap.p2m_pages += 1;
+        pg = alloc_domheap_pages(NULL, 0, MEMF_bits(32));
+        d->arch.paging.hap.p2m_pages += 1;
     }
     else
 #endif
     {
-       pg = mfn_to_page(hap_alloc(d));
-       
-       d->arch.paging.hap.p2m_pages += 1;
-       d->arch.paging.hap.total_pages -= 1;
-    }  
-
-    if ( pg == NULL ) {
-       hap_unlock(d);
-       return NULL;
+        pg = mfn_to_page(hap_alloc(d));
+        d->arch.paging.hap.p2m_pages += 1;
+        d->arch.paging.hap.total_pages -= 1;
+    }
+
+    if ( pg == NULL )
+    {
+        hap_unlock(d);
+        return NULL;
     }   
 
     hap_unlock(d);
@@ -166,17 +166,16 @@ void hap_free_p2m_page(struct domain *d,
 {
     ASSERT(page_get_owner(pg) == d);
     /* Should have just the one ref we gave it in alloc_p2m_page() */
-    if ( (pg->count_info & PGC_count_mask) != 1 ) {
+    if ( (pg->count_info & PGC_count_mask) != 1 )
         HAP_ERROR("Odd p2m page count c=%#x t=%"PRtype_info"\n",
                   pg->count_info, pg->u.inuse.type_info);
-    }
     pg->count_info = 0;
     /* Free should not decrement domain's total allocation, since 
      * these pages were allocated without an owner. */
     page_set_owner(pg, NULL); 
     free_domheap_pages(pg, 0);
     d->arch.paging.hap.p2m_pages--;
-    ASSERT( d->arch.paging.hap.p2m_pages >= 0 );
+    ASSERT(d->arch.paging.hap.p2m_pages >= 0);
 }
 
 /* Return the size of the pool, rounded up to the nearest MB */
@@ -185,7 +184,6 @@ hap_get_allocation(struct domain *d)
 {
     unsigned int pg = d->arch.paging.hap.total_pages;
 
-    HERE_I_AM;
     return ((pg >> (20 - PAGE_SHIFT))
             + ((pg & ((1 << (20 - PAGE_SHIFT)) - 1)) ? 1 : 0));
 }
@@ -199,11 +197,14 @@ hap_set_allocation(struct domain *d, uns
 
     ASSERT(hap_locked_by_me(d));
 
-    while ( d->arch.paging.hap.total_pages != pages ) {
-        if ( d->arch.paging.hap.total_pages < pages ) {
+    while ( d->arch.paging.hap.total_pages != pages )
+    {
+        if ( d->arch.paging.hap.total_pages < pages )
+        {
             /* Need to allocate more memory from domheap */
             sp = alloc_domheap_pages(NULL, 0, 0);
-            if ( sp == NULL ) {
+            if ( sp == NULL )
+            {
                 HAP_PRINTK("failed to allocate hap pages.\n");
                 return -ENOMEM;
             }
@@ -211,7 +212,8 @@ hap_set_allocation(struct domain *d, uns
             d->arch.paging.hap.total_pages += 1;
             list_add_tail(&sp->list, &d->arch.paging.hap.freelists);
         }
-        else if ( d->arch.paging.hap.total_pages > pages ) {
+        else if ( d->arch.paging.hap.total_pages > pages )
+        {
             /* Need to return memory to domheap */
             ASSERT(!list_empty(&d->arch.paging.hap.freelists));
             sp = list_entry(d->arch.paging.hap.freelists.next,
@@ -224,7 +226,8 @@ hap_set_allocation(struct domain *d, uns
         }
         
         /* Check to see if we need to yield and try again */
-        if ( preempted && hypercall_preempt_check() ) {
+        if ( preempted && hypercall_preempt_check() )
+        {
             *preempted = 1;
             return 0;
         }
@@ -285,8 +288,8 @@ void hap_install_xen_entries_in_l2h(stru
     for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
         sl2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] =
             l2e_from_pfn(
-                         
mfn_x(page_to_mfn(virt_to_page(d->arch.mm_perdomain_pt) + i)),
-                         __PAGE_HYPERVISOR);
+                mfn_x(page_to_mfn(virt_to_page(d->arch.mm_perdomain_pt) + i)),
+                __PAGE_HYPERVISOR);
     
     for ( i = 0; i < HAP_L3_PAGETABLE_ENTRIES; i++ )
         sl2e[l2_table_offset(LINEAR_PT_VIRT_START) + i] =
@@ -434,22 +437,23 @@ int hap_enable(struct domain *d, u32 mod
     unsigned int old_pages;
     int rv = 0;
 
-    HERE_I_AM;
-
     domain_pause(d);
     /* error check */
-    if ( (d == current->domain) ) {
+    if ( (d == current->domain) )
+    {
         rv = -EINVAL;
         goto out;
     }
 
     old_pages = d->arch.paging.hap.total_pages;
-    if ( old_pages == 0 ) {
+    if ( old_pages == 0 )
+    {
         unsigned int r;
         hap_lock(d);
         r = hap_set_allocation(d, 256, NULL);
         hap_unlock(d);
-        if ( r != 0 ) {
+        if ( r != 0 )
+        {
             hap_set_allocation(d, 0, NULL);
             rv = -ENOMEM;
             goto out;
@@ -457,7 +461,8 @@ int hap_enable(struct domain *d, u32 mod
     }
 
     /* allocate P2m table */
-    if ( mode & PG_translate ) {
+    if ( mode & PG_translate )
+    {
         rv = p2m_alloc_table(d, hap_alloc_p2m_page, hap_free_p2m_page);
         if ( rv != 0 )
             goto out;
@@ -472,20 +477,17 @@ int hap_enable(struct domain *d, u32 mod
 
 void hap_final_teardown(struct domain *d)
 {
-    HERE_I_AM;
-
     if ( d->arch.paging.hap.total_pages != 0 )
         hap_teardown(d);
 
     p2m_teardown(d);
-    ASSERT( d->arch.paging.hap.p2m_pages == 0 );
+    ASSERT(d->arch.paging.hap.p2m_pages == 0);
 }
 
 void hap_teardown(struct domain *d)
 {
     struct vcpu *v;
     mfn_t mfn;
-    HERE_I_AM;
 
     ASSERT(d->is_dying);
     ASSERT(d != current->domain);
@@ -493,10 +495,13 @@ void hap_teardown(struct domain *d)
     if ( !hap_locked_by_me(d) )
         hap_lock(d); /* Keep various asserts happy */
 
-    if ( paging_mode_enabled(d) ) {
+    if ( paging_mode_enabled(d) )
+    {
         /* release the monitor table held by each vcpu */
-        for_each_vcpu(d, v) {
-            if ( v->arch.paging.mode && paging_mode_external(d) ) {
+        for_each_vcpu ( d, v )
+        {
+            if ( v->arch.paging.mode && paging_mode_external(d) )
+            {
                 mfn = pagetable_get_mfn(v->arch.monitor_table);
                 if ( mfn_valid(mfn) && (mfn_x(mfn) != 0) )
                     hap_destroy_monitor_table(v, mfn);
@@ -505,7 +510,8 @@ void hap_teardown(struct domain *d)
         }
     }
 
-    if ( d->arch.paging.hap.total_pages != 0 ) {
+    if ( d->arch.paging.hap.total_pages != 0 )
+    {
         HAP_PRINTK("teardown of domain %u starts."
                       "  pages total = %u, free = %u, p2m=%u\n",
                       d->domain_id,
@@ -531,9 +537,8 @@ int hap_domctl(struct domain *d, xen_dom
 {
     int rc, preempted = 0;
 
-    HERE_I_AM;
-
-    switch ( sc->op ) {
+    switch ( sc->op )
+    {
     case XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION:
         hap_lock(d);
         rc = hap_set_allocation(d, sc->mb << (20 - PAGE_SHIFT), &preempted);
@@ -599,8 +604,6 @@ void hap_update_paging_modes(struct vcpu
 {
     struct domain *d;
 
-    HERE_I_AM;
-
     d = v->domain;
     hap_lock(d);
 
@@ -608,7 +611,8 @@ void hap_update_paging_modes(struct vcpu
      * guest's paging mode. So, make sure the shadow registers (CR0, CR4, EFER)
      * reflect guest's status correctly.
      */
-    if ( hvm_paging_enabled(v) ) {
+    if ( hvm_paging_enabled(v) )
+    {
         if ( hvm_long_mode_enabled(v) )
             v->arch.paging.mode = &hap_paging_long_mode;
         else if ( hvm_pae_enabled(v) )
@@ -616,13 +620,15 @@ void hap_update_paging_modes(struct vcpu
         else
             v->arch.paging.mode = &hap_paging_protected_mode;
     }
-    else {
+    else
+    {
         v->arch.paging.mode = &hap_paging_real_mode;
     }
 
     v->arch.paging.translate_enabled = !!hvm_paging_enabled(v);
 
-    if ( pagetable_is_null(v->arch.monitor_table) ) {
+    if ( pagetable_is_null(v->arch.monitor_table) )
+    {
         mfn_t mmfn = hap_make_monitor_table(v);
         v->arch.monitor_table = pagetable_from_mfn(mmfn);
         make_cr3(v, mfn_x(mmfn));
@@ -647,23 +653,25 @@ static void p2m_install_entry_in_monitor
     index = ((unsigned long)l3e & ~PAGE_MASK) / sizeof(l3_pgentry_t);
     ASSERT(index < MACHPHYS_MBYTES>>1);
     
-    for_each_vcpu(d, v) {
-       if ( pagetable_get_pfn(v->arch.monitor_table) == 0 ) 
-           continue;
-
-       ASSERT(paging_mode_external(v->domain));
+    for_each_vcpu ( d, v )
+    {
+        if ( pagetable_get_pfn(v->arch.monitor_table) == 0 ) 
+            continue;
+
+        ASSERT(paging_mode_external(v->domain));
 
         if ( v == current ) /* OK to use linear map of monitor_table */
-           ml2e = __linear_l2_table + l2_linear_offset(RO_MPT_VIRT_START);
+            ml2e = __linear_l2_table + l2_linear_offset(RO_MPT_VIRT_START);
         else {
-           l3_pgentry_t *ml3e;
-            ml3e = 
hap_map_domain_page(pagetable_get_mfn(v->arch.monitor_table));
-           ASSERT(l3e_get_flags(ml3e[3]) & _PAGE_PRESENT);
+            l3_pgentry_t *ml3e;
+            ml3e = hap_map_domain_page(
+                pagetable_get_mfn(v->arch.monitor_table));
+            ASSERT(l3e_get_flags(ml3e[3]) & _PAGE_PRESENT);
             ml2e = hap_map_domain_page(_mfn(l3e_get_pfn(ml3e[3])));
             ml2e += l2_table_offset(RO_MPT_VIRT_START);
-           hap_unmap_domain_page(ml3e);
+            hap_unmap_domain_page(ml3e);
         }
-       ml2e[index] = l2e_from_pfn(l3e_get_pfn(*l3e), __PAGE_HYPERVISOR);
+        ml2e[index] = l2e_from_pfn(l3e_get_pfn(*l3e), __PAGE_HYPERVISOR);
         if ( v != current )
             hap_unmap_domain_page(ml2e);
     }
@@ -680,9 +688,9 @@ hap_write_p2m_entry(struct vcpu *v, unsi
 #if CONFIG_PAGING_LEVELS == 3
     /* install P2M in monitor table for PAE Xen */
     if ( level == 3 ) 
-       /* We have written to the p2m l3: need to sync the per-vcpu
+        /* We have written to the p2m l3: need to sync the per-vcpu
          * copies of it in the monitor tables */
-       p2m_install_entry_in_monitors(v->domain, (l3_pgentry_t *)p);
+        p2m_install_entry_in_monitors(v->domain, (l3_pgentry_t *)p);
 #endif
     
     hap_unlock(v->domain);
diff -r d99903a98ad0 -r 23dab4b05455 xen/arch/x86/mm/hap/support.c
--- a/xen/arch/x86/mm/hap/support.c     Mon Jul 16 14:28:54 2007 +0100
+++ b/xen/arch/x86/mm/hap/support.c     Tue Jul 17 09:22:41 2007 +0100
@@ -43,7 +43,6 @@
  */
 unsigned long hap_gva_to_gfn_real_mode(struct vcpu *v, unsigned long gva)
 {
-    HERE_I_AM;
     return ((paddr_t)gva >> PAGE_SHIFT);
 }
 
@@ -61,12 +60,12 @@ unsigned long hap_gva_to_gfn_protected_m
     l2_pgentry_32_t *l2e; /* guest page entry size is 32-bit */
     l1_pgentry_32_t *l1e;
 
-    HERE_I_AM;
-
     gpfn = (gcr3 >> PAGE_SHIFT);
-    for ( lev = mode; lev >= 1; lev-- ) {
-        mfn = get_mfn_from_gpfn( gpfn );
-        if ( mfn == INVALID_MFN ) {
+    for ( lev = mode; lev >= 1; lev-- )
+    {
+        mfn = get_mfn_from_gpfn(gpfn);
+        if ( mfn == INVALID_MFN )
+        {
             HAP_PRINTK("bad pfn=0x%lx from gva=0x%lx at lev%d\n", gpfn, gva, 
                        lev);
             success = 0;
@@ -74,18 +73,22 @@ unsigned long hap_gva_to_gfn_protected_m
         }
         index = (gva >> PT_SHIFT[mode][lev]) & (PT_ENTRIES[mode][lev]-1);
 
-        if ( lev == 2 ) {
-            l2e = map_domain_page( mfn );
+        if ( lev == 2 )
+        {
+            l2e = map_domain_page(mfn);
             HAP_PRINTK("l2 page table entry is %ulx at index = %d\n", 
                        l2e[index].l2, index);
-            if ( !(l2e_get_flags_32(l2e[index]) & _PAGE_PRESENT) ) {
+            if ( !(l2e_get_flags_32(l2e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 2 entry not present at index = %d\n", index);
                 success = 0;
             }
 
-            if ( l2e_get_flags_32(l2e[index]) & _PAGE_PSE ) { /* handle PSE */
+            if ( l2e_get_flags_32(l2e[index]) & _PAGE_PSE )
+            {
                 HAP_PRINTK("guest page table is PSE\n");
-                if ( l2e_get_intpte(l2e[index]) & 0x001FE000UL ) { /*[13:20] */
+                if ( l2e_get_intpte(l2e[index]) & 0x001FE000UL ) /*[13:20] */
+                {
                     printk("guest physical memory size is too large!\n");
                     domain_crash(v->domain);
                 }
@@ -94,23 +97,24 @@ unsigned long hap_gva_to_gfn_protected_m
                 unmap_domain_page(l2e);
                 break; /* last level page table, return from here */
             }
-            else {
-                gpfn = l2e_get_pfn( l2e[index] );
-            }
+
+            gpfn = l2e_get_pfn(l2e[index]);
             unmap_domain_page(l2e);
         }
 
-        if ( lev == 1 ) {
-            l1e = map_domain_page( mfn );
+        if ( lev == 1 )
+        {
+            l1e = map_domain_page(mfn);
             HAP_PRINTK("l1 page table entry is %ulx at index = %d\n", 
                        l1e[index].l1, index);
-            if ( !(l1e_get_flags_32(l1e[index]) & _PAGE_PRESENT) ) {
+            if ( !(l1e_get_flags_32(l1e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 1 entry not present at index = %d\n", index);
                 success = 0;
             }
-            gpfn = l1e_get_pfn( l1e[index] );
+            gpfn = l1e_get_pfn(l1e[index]);
             gpa = (l1e_get_intpte(l1e[index]) & PHYSICAL_PAGE_4K_MASK) + 
-                (gva & ~PHYSICAL_PAGE_4K_MASK);            
+                (gva & ~PHYSICAL_PAGE_4K_MASK);    
             unmap_domain_page(l1e);
         }
 
@@ -120,10 +124,7 @@ unsigned long hap_gva_to_gfn_protected_m
 
     HAP_PRINTK("success = %d, gva = %lx, gpa = %lx\n", success, gva, gpa);
 
-    if ( !success ) /* error happened */
-        return INVALID_GFN;
-    else
-        return ((paddr_t)gpa >> PAGE_SHIFT);
+    return (!success ? INVALID_GFN : ((paddr_t)gpa >> PAGE_SHIFT));
 }
 
 
@@ -144,12 +145,12 @@ unsigned long hap_gva_to_gfn_pae_mode(st
     l2_pgentry_t *l2e;
     l3_pgentry_t *l3e;
     
-    HERE_I_AM;
-
     gpfn = (gcr3 >> PAGE_SHIFT);
-    for ( lev = mode; lev >= 1; lev-- ) {
-        mfn = get_mfn_from_gpfn( gpfn );
-        if ( mfn == INVALID_MFN ) {
+    for ( lev = mode; lev >= 1; lev-- )
+    {
+        mfn = get_mfn_from_gpfn(gpfn);
+        if ( mfn == INVALID_MFN )
+        {
             HAP_PRINTK("bad pfn=0x%lx from gva=0x%lx at lev%d\n", gpfn, gva, 
                        lev);
             success = 0;
@@ -157,44 +158,50 @@ unsigned long hap_gva_to_gfn_pae_mode(st
         }
         index = (gva >> PT_SHIFT[mode][lev]) & (PT_ENTRIES[mode][lev]-1);
 
-        if ( lev == 3 ) {
-            l3e = map_domain_page( mfn );
-            index += ( ((gcr3 >> 5 ) & 127 ) * 4 );
-            if ( !(l3e_get_flags(l3e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 3 )
+        {
+            l3e = map_domain_page(mfn);
+            index += ((gcr3 >> 5) & 127) * 4;
+            if ( !(l3e_get_flags(l3e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 3 entry not present at index = %d\n", index);
                 success = 0;
             }
-            gpfn = l3e_get_pfn( l3e[index] );
+            gpfn = l3e_get_pfn(l3e[index]);
             unmap_domain_page(l3e);
         }
 
-        if ( lev == 2 ) {
-            l2e = map_domain_page( mfn );
-            if ( !(l2e_get_flags(l2e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 2 )
+        {
+            l2e = map_domain_page(mfn);
+            if ( !(l2e_get_flags(l2e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 2 entry not present at index = %d\n", index);
                 success = 0;
             }
 
-            if ( l2e_get_flags(l2e[index]) & _PAGE_PSE ) { /* handle PSE */
+            if ( l2e_get_flags(l2e[index]) & _PAGE_PSE )
+            {
                 HAP_PRINTK("guest page table is PSE\n");
                 gpa = (l2e_get_intpte(l2e[index]) & PHYSICAL_PAGE_2M_MASK) + 
                     (gva & ~PHYSICAL_PAGE_2M_MASK);
                 unmap_domain_page(l2e);
                 break; /* last level page table, jump out from here */
             }
-            else { 
-                gpfn = l2e_get_pfn(l2e[index]);
-            }
+
+            gpfn = l2e_get_pfn(l2e[index]);
             unmap_domain_page(l2e);
         }
 
-        if ( lev == 1 ) {
-            l1e = map_domain_page( mfn );
-            if ( !(l1e_get_flags(l1e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 1 )
+        {
+            l1e = map_domain_page(mfn);
+            if ( !(l1e_get_flags(l1e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 1 entry not present at index = %d\n", index);
                 success = 0;
             }
-            gpfn = l1e_get_pfn( l1e[index] );
+            gpfn = l1e_get_pfn(l1e[index]);
             gpa = (l1e_get_intpte(l1e[index]) & PHYSICAL_PAGE_4K_MASK) + 
                 (gva & ~PHYSICAL_PAGE_4K_MASK);
             unmap_domain_page(l1e);
@@ -207,18 +214,13 @@ unsigned long hap_gva_to_gfn_pae_mode(st
     gpa &= ~PAGE_NX_BIT; /* clear NX bit of guest physical address */
     HAP_PRINTK("success = %d, gva = %lx, gpa = %lx\n", success, gva, gpa);
 
-    if ( !success )
-        return INVALID_GFN;
-    else
-        return ((paddr_t)gpa >> PAGE_SHIFT);
+    return (!success ? INVALID_GFN : ((paddr_t)gpa >> PAGE_SHIFT));
 #else
-    HERE_I_AM;
     printk("guest paging level (3) is greater than host paging level!\n");
     domain_crash(v->domain);
     return INVALID_GFN;
 #endif
 }
-
 
 
 /* Translate guest virtual address to guest physical address. Specifically
@@ -238,12 +240,12 @@ unsigned long hap_gva_to_gfn_long_mode(s
     l2_pgentry_t *l2e;
     l1_pgentry_t *l1e;
 
-    HERE_I_AM;
-
     gpfn = (gcr3 >> PAGE_SHIFT);
-    for ( lev = mode; lev >= 1; lev-- ) {
-        mfn = get_mfn_from_gpfn( gpfn );
-        if ( mfn == INVALID_MFN ) {
+    for ( lev = mode; lev >= 1; lev-- )
+    {
+        mfn = get_mfn_from_gpfn(gpfn);
+        if ( mfn == INVALID_MFN )
+        {
             HAP_PRINTK("bad pfn=0x%lx from gva=0x%lx at lev%d\n", gpfn, gva, 
                        lev);
             success = 0;
@@ -251,53 +253,61 @@ unsigned long hap_gva_to_gfn_long_mode(s
         }
         index = (gva >> PT_SHIFT[mode][lev]) & (PT_ENTRIES[mode][lev]-1);
 
-        if ( lev == 4 ) {
-            l4e = map_domain_page( mfn );
-            if ( !(l4e_get_flags(l4e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 4 )
+        {
+            l4e = map_domain_page(mfn);
+            if ( !(l4e_get_flags(l4e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 4 entry not present at index = %d\n", index);
                 success = 0;
             }
-            gpfn = l4e_get_pfn( l4e[index] );
+            gpfn = l4e_get_pfn(l4e[index]);
             unmap_domain_page(l4e);
         }
 
-        if ( lev == 3 ) {
-            l3e = map_domain_page( mfn );
-            if ( !(l3e_get_flags(l3e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 3 )
+        {
+            l3e = map_domain_page(mfn);
+            if ( !(l3e_get_flags(l3e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 3 entry not present at index = %d\n", index);
                 success = 0;
             }
-            gpfn = l3e_get_pfn( l3e[index] );
+            gpfn = l3e_get_pfn(l3e[index]);
             unmap_domain_page(l3e);
         }
 
-        if ( lev == 2 ) {
-            l2e = map_domain_page( mfn );
-            if ( !(l2e_get_flags(l2e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 2 )
+        {
+            l2e = map_domain_page(mfn);
+            if ( !(l2e_get_flags(l2e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 2 entry not present at index = %d\n", index);
                 success = 0;
             }
 
-            if ( l2e_get_flags(l2e[index]) & _PAGE_PSE ) { /* handle PSE */
+            if ( l2e_get_flags(l2e[index]) & _PAGE_PSE )
+            {
                 HAP_PRINTK("guest page table is PSE\n");
                 gpa = (l2e_get_intpte(l2e[index]) & PHYSICAL_ADDR_2M_MASK_LM) 
                     + (gva & ~PHYSICAL_PAGE_2M_MASK);
                 unmap_domain_page(l2e);
                 break; /* last level page table, jump out from here */
             }
-            else { 
-                gpfn = l2e_get_pfn(l2e[index]);
-            }
+
+            gpfn = l2e_get_pfn(l2e[index]);
             unmap_domain_page(l2e);
         }
 
-        if ( lev == 1 ) {
-            l1e = map_domain_page( mfn );
-            if ( !(l1e_get_flags(l1e[index]) & _PAGE_PRESENT) ) {
+        if ( lev == 1 )
+        {
+            l1e = map_domain_page(mfn);
+            if ( !(l1e_get_flags(l1e[index]) & _PAGE_PRESENT) )
+            {
                 HAP_PRINTK("Level 1 entry not present at index = %d\n", index);
                 success = 0;
             }
-            gpfn = l1e_get_pfn( l1e[index] );
+            gpfn = l1e_get_pfn(l1e[index]);
             gpa = (l1e_get_intpte(l1e[index]) & PHYSICAL_ADDR_4K_MASK_LM) + 
                 (gva & ~PHYSICAL_PAGE_4K_MASK);
             unmap_domain_page(l1e);
@@ -310,12 +320,8 @@ unsigned long hap_gva_to_gfn_long_mode(s
     gpa &= ~PAGE_NX_BIT; /* clear NX bit of guest physical address */
     HAP_PRINTK("success = %d, gva = %lx, gpa = %lx\n", success, gva, gpa);
 
-    if ( !success )
-        return INVALID_GFN;
-    else
-        return ((paddr_t)gpa >> PAGE_SHIFT);
+    return (!success ? INVALID_GFN : ((paddr_t)gpa >> PAGE_SHIFT));
 #else
-    HERE_I_AM;
     printk("guest paging level (4) is greater than host paging level!\n");
     domain_crash(v->domain);
     return INVALID_GFN;
diff -r d99903a98ad0 -r 23dab4b05455 xen/include/asm-x86/hap.h
--- a/xen/include/asm-x86/hap.h Mon Jul 16 14:28:54 2007 +0100
+++ b/xen/include/asm-x86/hap.h Tue Jul 17 09:22:41 2007 +0100
@@ -26,8 +26,6 @@
 #ifndef _XEN_HAP_H
 #define _XEN_HAP_H
 
-#define HERE_I_AM                                                     \
-    debugtrace_printk("HERE I AM: %s %s %d\n", __func__, __FILE__, __LINE__)
 #define HAP_PRINTK(_f, _a...)                                         \
     debugtrace_printk("hap: %s(): " _f, __func__, ##_a)
 #define HAP_ERROR(_f, _a...)                                          \
@@ -98,6 +96,7 @@ extern struct paging_mode hap_paging_pro
 extern struct paging_mode hap_paging_protected_mode;
 extern struct paging_mode hap_paging_pae_mode;
 extern struct paging_mode hap_paging_long_mode;
+
 #endif /* XEN_HAP_H */
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.