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

[Xen-changelog] Get rid of anonymous unions in public header files.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b9b120c7631a9693ca015ec35c9a5fbaedd9a6f8
# Parent  cc1572db6a3d57c36f40b9530c2d2f02786429ba
Get rid of anonymous unions in public header files.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r cc1572db6a3d -r b9b120c7631a extras/mini-os/mm.c
--- a/extras/mini-os/mm.c       Wed Sep 14 12:49:13 2005
+++ b/extras/mini-os/mm.c       Wed Sep 14 13:13:10 2005
@@ -432,7 +432,7 @@
         
         /* Pin the page to provide correct protection */
         pin_request.cmd = MMUEXT_PIN_L1_TABLE;
-        pin_request.mfn = pfn_to_mfn(pt_frame);
+        pin_request.arg1.mfn = pfn_to_mfn(pt_frame);
         if(HYPERVISOR_mmuext_op(&pin_request, 1, NULL, DOMID_SELF) < 0)
         {
             printk("ERROR: pinning failed\n");
diff -r cc1572db6a3d -r b9b120c7631a 
linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c        Wed Sep 14 
12:49:13 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c        Wed Sep 14 
13:13:10 2005
@@ -115,7 +115,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_NEW_BASEPTR;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -123,7 +123,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_NEW_USER_BASEPTR;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -138,7 +138,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_INVLPG_LOCAL;
-       op.linear_addr = ptr & PAGE_MASK;
+       op.arg1.linear_addr = ptr & PAGE_MASK;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -157,7 +157,7 @@
        if ( cpus_empty(*mask) )
                return;
        op.cmd = MMUEXT_TLB_FLUSH_MULTI;
-       op.vcpumask = mask->bits;
+       op.arg2.vcpumask = mask->bits;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -165,7 +165,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_INVLPG_ALL;
-       op.linear_addr = ptr & PAGE_MASK;
+       op.arg1.linear_addr = ptr & PAGE_MASK;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -175,8 +175,8 @@
        if ( cpus_empty(*mask) )
                return;
        op.cmd = MMUEXT_INVLPG_MULTI;
-       op.vcpumask = mask->bits;
-       op.linear_addr = ptr & PAGE_MASK;
+       op.arg1.linear_addr = ptr & PAGE_MASK;
+       op.arg2.vcpumask    = mask->bits;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -193,7 +193,7 @@
 #else
        op.cmd = MMUEXT_PIN_L2_TABLE;
 #endif
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -201,7 +201,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_UNPIN_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -209,7 +209,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_PIN_L1_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -217,7 +217,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_UNPIN_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -226,7 +226,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_PIN_L3_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -234,7 +234,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_UNPIN_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -242,7 +242,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_PIN_L2_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
@@ -250,7 +250,7 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_UNPIN_TABLE;
-       op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+       op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 #endif /* CONFIG_X86_64 */
@@ -260,8 +260,8 @@
 {
        struct mmuext_op op;
        op.cmd = MMUEXT_SET_LDT;
-       op.linear_addr = ptr;
-       op.nr_ents = len;
+       op.arg1.linear_addr = ptr;
+       op.arg2.nr_ents     = len;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
diff -r cc1572db6a3d -r b9b120c7631a 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Wed Sep 14 
12:49:13 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Wed Sep 14 
13:13:10 2005
@@ -294,7 +294,7 @@
         mcl++;
 
         mmuext->cmd = MMUEXT_REASSIGN_PAGE;
-        mmuext->mfn = old_mfn;
+        mmuext->arg1.mfn = old_mfn;
         mmuext++;
 #endif
         mmu->ptr = ((unsigned long long)new_mfn << PAGE_SHIFT) | 
MMU_MACHPHYS_UPDATE;
@@ -355,7 +355,7 @@
 #ifdef CONFIG_XEN_NETDEV_GRANT
         old_mfn = 0; /* XXX Fix this so we can free_mfn() on error! */
 #else
-        old_mfn = mmuext[0].mfn;
+        old_mfn = mmuext[0].arg1.mfn;
 #endif
         atomic_set(&(skb_shinfo(skb)->dataref), 1);
         skb_shinfo(skb)->nr_frags = 0;
diff -r cc1572db6a3d -r b9b120c7631a 
linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h       Wed Sep 
14 12:49:13 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h       Wed Sep 
14 13:13:10 2005
@@ -67,7 +67,7 @@
                /* Re-load page tables: load_cr3(next->pgd) */
                per_cpu(cur_pgd, cpu) = next->pgd;
                op->cmd = MMUEXT_NEW_BASEPTR;
-               op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
+               op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
                op++;
 
                /*
@@ -76,8 +76,8 @@
                if (unlikely(prev->context.ldt != next->context.ldt)) {
                        /* load_LDT_nolock(&next->context, cpu) */
                        op->cmd = MMUEXT_SET_LDT;
-                       op->linear_addr = (unsigned long)next->context.ldt;
-                       op->nr_ents     = next->context.size;
+                       op->arg1.linear_addr = (unsigned long)next->context.ldt;
+                       op->arg2.nr_ents     = next->context.size;
                        op++;
                }
 
diff -r cc1572db6a3d -r b9b120c7631a 
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h     Wed Sep 
14 12:49:13 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h     Wed Sep 
14 13:13:10 2005
@@ -83,19 +83,19 @@
                /* load_cr3(next->pgd) */
                per_cpu(cur_pgd, smp_processor_id()) = next->pgd;
                op->cmd = MMUEXT_NEW_BASEPTR;
-               op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
+               op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
                op++;
 
                /* xen_new_user_pt(__pa(__user_pgd(next->pgd))) */
                op->cmd = MMUEXT_NEW_USER_BASEPTR;
-               op->mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT);
+               op->arg1.mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> 
PAGE_SHIFT);
                op++;
                
                if (unlikely(next->context.ldt != prev->context.ldt)) {
                        /* load_LDT_nolock(&next->context, cpu) */
                        op->cmd = MMUEXT_SET_LDT;
-                       op->linear_addr = (unsigned long)next->context.ldt;
-                       op->nr_ents     = next->context.size;
+                       op->arg1.linear_addr = (unsigned long)next->context.ldt;
+                       op->arg2.nr_ents     = next->context.size;
                        op++;
                }
 
diff -r cc1572db6a3d -r b9b120c7631a tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Wed Sep 14 12:49:13 2005
+++ b/tools/libxc/xc_linux_restore.c    Wed Sep 14 13:13:10 2005
@@ -421,7 +421,7 @@
             pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE;
         else /* pfn_type[i] == (L2TAB|LPINTAB) */
             pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE;
-        pin[nr_pins].mfn = pfn_to_mfn_table[i];
+        pin[nr_pins].arg1.mfn = pfn_to_mfn_table[i];
         if ( ++nr_pins == MAX_PIN_BATCH )
         {
             if ( xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
diff -r cc1572db6a3d -r b9b120c7631a tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c  Wed Sep 14 12:49:13 2005
+++ b/tools/libxc/xg_private.c  Wed Sep 14 13:13:10 2005
@@ -65,7 +65,7 @@
     struct mmuext_op op;
 
     op.cmd = type;
-    op.mfn = mfn;
+    op.arg1.mfn = mfn;
 
     if ( xc_mmuext_op(xc_handle, &op, 1, dom) < 0 )
         return 1;
diff -r cc1572db6a3d -r b9b120c7631a xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Sep 14 12:49:13 2005
+++ b/xen/arch/x86/mm.c Wed Sep 14 13:13:10 2005
@@ -1659,7 +1659,7 @@
 {
     struct mmuext_op op;
     int rc = 0, i = 0, okay, cpu = smp_processor_id();
-    unsigned long type, done = 0;
+    unsigned long mfn, type, done = 0;
     struct pfn_info *page;
     struct vcpu *v = current;
     struct domain *d = v->domain, *e;
@@ -1706,7 +1706,8 @@
         }
 
         okay = 1;
-        page = &frame_table[op.mfn];
+        mfn  = op.arg1.mfn;
+        page = &frame_table[mfn];
 
         switch ( op.cmd )
         {
@@ -1717,17 +1718,17 @@
             if ( shadow_mode_refcounts(FOREIGNDOM) )
                 type = PGT_writable_page;
 
-            okay = get_page_and_type_from_pagenr(op.mfn, type, FOREIGNDOM);
+            okay = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM);
             if ( unlikely(!okay) )
             {
-                MEM_LOG("Error while pinning mfn %lx", op.mfn);
+                MEM_LOG("Error while pinning mfn %lx", mfn);
                 break;
             }
             
             if ( unlikely(test_and_set_bit(_PGT_pinned,
                                            &page->u.inuse.type_info)) )
             {
-                MEM_LOG("Mfn %lx already pinned", op.mfn);
+                MEM_LOG("Mfn %lx already pinned", mfn);
                 put_page_and_type(page);
                 okay = 0;
                 break;
@@ -1750,10 +1751,10 @@
             goto pin_page;
 
         case MMUEXT_UNPIN_TABLE:
-            if ( unlikely(!(okay = get_page_from_pagenr(op.mfn, FOREIGNDOM))) )
+            if ( unlikely(!(okay = get_page_from_pagenr(mfn, FOREIGNDOM))) )
             {
                 MEM_LOG("Mfn %lx bad domain (dom=%p)",
-                        op.mfn, page_get_owner(page));
+                        mfn, page_get_owner(page));
             }
             else if ( likely(test_and_clear_bit(_PGT_pinned, 
                                                 &page->u.inuse.type_info)) )
@@ -1765,28 +1766,28 @@
             {
                 okay = 0;
                 put_page(page);
-                MEM_LOG("Mfn %lx not pinned", op.mfn);
+                MEM_LOG("Mfn %lx not pinned", mfn);
             }
             break;
 
         case MMUEXT_NEW_BASEPTR:
-            okay = new_guest_cr3(op.mfn);
+            okay = new_guest_cr3(mfn);
             percpu_info[cpu].deferred_ops &= ~DOP_FLUSH_TLB;
             break;
         
 #ifdef __x86_64__
         case MMUEXT_NEW_USER_BASEPTR:
             okay = get_page_and_type_from_pagenr(
-                op.mfn, PGT_root_page_table, d);
+                mfn, PGT_root_page_table, d);
             if ( unlikely(!okay) )
             {
-                MEM_LOG("Error while installing new mfn %lx", op.mfn);
+                MEM_LOG("Error while installing new mfn %lx", mfn);
             }
             else
             {
                 unsigned long old_mfn =
                     pagetable_get_pfn(v->arch.guest_table_user);
-                v->arch.guest_table_user = mk_pagetable(op.mfn << PAGE_SHIFT);
+                v->arch.guest_table_user = mk_pagetable(mfn << PAGE_SHIFT);
                 if ( old_mfn != 0 )
                     put_page_and_type(&frame_table[old_mfn]);
             }
@@ -1799,8 +1800,8 @@
     
         case MMUEXT_INVLPG_LOCAL:
             if ( shadow_mode_enabled(d) )
-                shadow_invlpg(v, op.linear_addr);
-            local_flush_tlb_one(op.linear_addr);
+                shadow_invlpg(v, op.arg1.linear_addr);
+            local_flush_tlb_one(op.arg1.linear_addr);
             break;
 
         case MMUEXT_TLB_FLUSH_MULTI:
@@ -1808,7 +1809,7 @@
         {
             unsigned long vmask;
             cpumask_t     pmask;
-            if ( unlikely(get_user(vmask, (unsigned long *)op.vcpumask)) )
+            if ( unlikely(get_user(vmask, (unsigned long *)op.arg2.vcpumask)) )
             {
                 okay = 0;
                 break;
@@ -1818,7 +1819,7 @@
             if ( op.cmd == MMUEXT_TLB_FLUSH_MULTI )
                 flush_tlb_mask(pmask);
             else
-                flush_tlb_one_mask(pmask, op.linear_addr);
+                flush_tlb_one_mask(pmask, op.arg1.linear_addr);
             break;
         }
 
@@ -1827,7 +1828,7 @@
             break;
     
         case MMUEXT_INVLPG_ALL:
-            flush_tlb_one_mask(d->cpumask, op.linear_addr);
+            flush_tlb_one_mask(d->cpumask, op.arg1.linear_addr);
             break;
 
         case MMUEXT_FLUSH_CACHE:
@@ -1852,8 +1853,8 @@
                 break;
             }
 
-            unsigned long ptr  = op.linear_addr;
-            unsigned long ents = op.nr_ents;
+            unsigned long ptr  = op.arg1.linear_addr;
+            unsigned long ents = op.arg2.nr_ents;
             if ( ((ptr & (PAGE_SIZE-1)) != 0) || 
                  (ents > 8192) ||
                  !array_access_ok(ptr, ents, LDT_ENTRY_SIZE) )
@@ -1886,7 +1887,7 @@
             e = percpu_info[cpu].foreign;
             if ( unlikely(e == NULL) )
             {
-                MEM_LOG("No FOREIGNDOM to reassign mfn %lx to", op.mfn);
+                MEM_LOG("No FOREIGNDOM to reassign mfn %lx to", mfn);
                 okay = 0;
                 break;
             }
@@ -1919,7 +1920,7 @@
             {
                 MEM_LOG("Transferee has no reservation headroom (%d,%d), or "
                         "page is in Xen heap (%lx), or dom is dying (%ld).",
-                        e->tot_pages, e->max_pages, op.mfn, e->domain_flags);
+                        e->tot_pages, e->max_pages, mfn, e->domain_flags);
                 okay = 0;
                 goto reassign_fail;
             }
diff -r cc1572db6a3d -r b9b120c7631a xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h  Wed Sep 14 12:49:13 2005
+++ b/xen/include/public/arch-x86_64.h  Wed Sep 14 13:13:10 2005
@@ -124,36 +124,46 @@
     unsigned long address; /* code offset                                   */
 } trap_info_t;
 
+#ifdef __GNUC__
+/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
+#define __DECL_REG(name) union { u64 r ## name, e ## name; }
+#else
+/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
+#define __DECL_REG(name) u64 r ## name
+#endif
+
 typedef struct cpu_user_regs {
     u64 r15;
     u64 r14;
     u64 r13;
     u64 r12;
-    union { u64 rbp, ebp; };
-    union { u64 rbx, ebx; };
+    __DECL_REG(bp);
+    __DECL_REG(bx);
     u64 r11;
     u64 r10;
     u64 r9;
     u64 r8;
-    union { u64 rax, eax; };
-    union { u64 rcx, ecx; };
-    union { u64 rdx, edx; };
-    union { u64 rsi, esi; };
-    union { u64 rdi, edi; };
+    __DECL_REG(ax);
+    __DECL_REG(cx);
+    __DECL_REG(dx);
+    __DECL_REG(si);
+    __DECL_REG(di);
     u32 error_code;    /* private */
     u32 entry_vector;  /* private */
-    union { u64 rip, eip; };
+    __DECL_REG(ip);
     u16 cs, _pad0[1];
     u8  saved_upcall_mask;
     u8  _pad1[3];
-    union { u64 rflags, eflags; };
-    union { u64 rsp, esp; };
+    __DECL_REG(flags);
+    __DECL_REG(sp);
     u16 ss, _pad2[3];
     u16 es, _pad3[3];
     u16 ds, _pad4[3];
     u16 fs, _pad5[3]; /* Non-zero => takes precedence over fs_base.      */
     u16 gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_user. */
 } cpu_user_regs_t;
+
+#undef __DECL_REG
 
 typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
 
diff -r cc1572db6a3d -r b9b120c7631a xen/include/public/xen.h
--- a/xen/include/public/xen.h  Wed Sep 14 12:49:13 2005
+++ b/xen/include/public/xen.h  Wed Sep 14 13:13:10 2005
@@ -174,13 +174,13 @@
         unsigned long mfn;
         /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
         unsigned long linear_addr;
-    };
+    } arg1;
     union {
         /* SET_LDT */
         unsigned int nr_ents;
         /* TLB_FLUSH_MULTI, INVLPG_MULTI */
         void *vcpumask;
-    };
+    } arg2;
 };
 #endif
 

_______________________________________________
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®.