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

[Xen-changelog] [PATCH] 64 bit xend cleanups.



ChangeSet 1.1777, 2005/06/30 09:08:42+01:00, arun.sharma@xxxxxxxxx

        [PATCH] 64 bit xend cleanups.
        
        64 bit xend cleanups.
        
        Signed-off-by: Xin Li <xin.bi.li@xxxxxxxxx>
        Signed-off-by: Xiofeng Ling <xiaofeng.ling@xxxxxxxxx>
        Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>



 linux_boot_params.h |   24 ++++++++++++------------
 xc_private.h        |    2 ++
 xc_vmx_build.c      |   32 ++++++++++++++++++--------------
 3 files changed, 32 insertions(+), 26 deletions(-)


diff -Nru a/tools/libxc/linux_boot_params.h b/tools/libxc/linux_boot_params.h
--- a/tools/libxc/linux_boot_params.h   2005-06-30 05:03:34 -04:00
+++ b/tools/libxc/linux_boot_params.h   2005-06-30 05:03:34 -04:00
@@ -8,9 +8,9 @@
 struct mem_map {
     int nr_map;
     struct entry {
-        unsigned long long addr;       /* start of memory segment */
-        unsigned long long size;       /* size of memory segment */
-        unsigned long type;            /* type of memory segment */
+        u64 addr;      /* start of memory segment */
+        u64 size;      /* size of memory segment */
+        u32 type;              /* type of memory segment */
 #define E820_RAM        1
 #define E820_RESERVED   2
 #define E820_ACPI       3 /* usable as RAM once ACPI tables have been read */
@@ -18,7 +18,7 @@
 #define E820_IO         16
 #define E820_SHARED     17
 
-        unsigned long caching_attr;    /* used by hypervisor */
+        u32 caching_attr;    /* used by hypervisor */
 #define MEMMAP_UC      0
 #define MEMMAP_WC      1
 #define MEMMAP_WT      4
@@ -29,15 +29,15 @@
 };
 
 struct e820entry {
-       unsigned long long addr;        /* start of memory segment */
-       unsigned long long size;        /* size of memory segment */
-       unsigned long type;             /* type of memory segment */
-};
+       u64 addr;       /* start of memory segment */
+       u64 size;       /* size of memory segment */
+       u32 type;       /* type of memory segment */
+}__attribute__((packed));
 
 struct e820map {
-    int nr_map;
+    u32 nr_map;
     struct e820entry map[E820MAX];
-};
+}__attribute__((packed));
 
 struct drive_info_struct { __u8 dummy[32]; }; 
 
@@ -64,8 +64,8 @@
     unsigned short lfb_width;          /* 0x12 */
     unsigned short lfb_height;         /* 0x14 */
     unsigned short lfb_depth;          /* 0x16 */
-    unsigned long  lfb_base;           /* 0x18 */
-    unsigned long  lfb_size;           /* 0x1c */
+    unsigned int   lfb_base;           /* 0x18 */
+    unsigned int   lfb_size;           /* 0x1c */
     unsigned short dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here 
*/
     unsigned short lfb_linelength;     /* 0x24 */
     unsigned char  red_size;           /* 0x26 */
diff -Nru a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  2005-06-30 05:03:34 -04:00
+++ b/tools/libxc/xc_private.h  2005-06-30 05:03:34 -04:00
@@ -53,6 +53,8 @@
 #define PAGE_SIZE               (1UL << PAGE_SHIFT)
 #define PAGE_MASK               (~(PAGE_SIZE-1))
 
+typedef u32 l1_pgentry_32_t;
+typedef u32 l2_pgentry_32_t;
 typedef unsigned long l1_pgentry_t;
 typedef unsigned long l2_pgentry_t;
 #if defined(__x86_64__)
diff -Nru a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        2005-06-30 05:03:34 -04:00
+++ b/tools/libxc/xc_vmx_build.c        2005-06-30 05:03:34 -04:00
@@ -92,18 +92,20 @@
 }
 
 static int zap_mmio_range(int xc_handle, u32 dom,
-                            l2_pgentry_t *vl2tab,
+                            l2_pgentry_32_t *vl2tab,
                             unsigned long mmio_range_start,
                             unsigned long mmio_range_size)
 {
     unsigned long mmio_addr;
     unsigned long mmio_range_end = mmio_range_start + mmio_range_size;
     unsigned long vl2e;
-    l1_pgentry_t *vl1tab;
+    l1_pgentry_32_t *vl1tab;
 
     mmio_addr = mmio_range_start & PAGE_MASK;
     for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) {
         vl2e = vl2tab[l2_table_offset(mmio_addr)];
+        if (vl2e == 0)
+            continue;
         vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                 PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT);
        if (vl1tab == 0) {
@@ -121,7 +123,7 @@
                             struct mem_map *mem_mapp)
 {
     int i;
-    l2_pgentry_t *vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+    l2_pgentry_32_t *vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                                 PROT_READ|PROT_WRITE,
                                                 l2tab >> PAGE_SHIFT);
     if (vl2tab == 0)
@@ -149,8 +151,8 @@
                          unsigned long flags,
                          struct mem_map * mem_mapp)
 {
-    l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
-    l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
+    l1_pgentry_32_t *vl1tab=NULL, *vl1e=NULL;
+    l2_pgentry_32_t *vl2tab=NULL, *vl2e=NULL;
     unsigned long *page_array = NULL;
     unsigned long l2tab;
     unsigned long l1tab;
@@ -426,8 +428,10 @@
      * Pin down l2tab addr as page dir page - causes hypervisor to provide
      * correct protection for the page
      */ 
+#ifdef __i386__
     if ( pin_table(xc_handle, MMUEXT_PIN_L2_TABLE, l2tab>>PAGE_SHIFT, dom) )
         goto error_out;
+#endif
 
     /* Send the page update requests down to the hypervisor. */
     if ( finish_mmu_updates(xc_handle, mmu) )
@@ -646,7 +650,7 @@
     return -1;
 }
 
-static inline int is_loadable_phdr(Elf_Phdr *phdr)
+static inline int is_loadable_phdr(Elf32_Phdr *phdr)
 {
     return ((phdr->p_type == PT_LOAD) &&
             ((phdr->p_flags & (PF_W|PF_X)) != 0));
@@ -656,9 +660,9 @@
                          unsigned long elfsize,
                          struct domain_setup_info *dsi)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)elfbase;
-    Elf_Phdr *phdr;
-    Elf_Shdr *shdr;
+    Elf32_Ehdr *ehdr = (Elf32_Ehdr *)elfbase;
+    Elf32_Phdr *phdr;
+    Elf32_Shdr *shdr;
     unsigned long kernstart = ~0UL, kernend=0UL;
     char *shstrtab;
     int h;
@@ -687,13 +691,13 @@
         ERROR("ELF image has no section-header strings table (shstrtab).");
         return -EINVAL;
     }
-    shdr = (Elf_Shdr *)(elfbase + ehdr->e_shoff + 
+    shdr = (Elf32_Shdr *)(elfbase + ehdr->e_shoff + 
                         (ehdr->e_shstrndx*ehdr->e_shentsize));
     shstrtab = elfbase + shdr->sh_offset;
     
     for ( h = 0; h < ehdr->e_phnum; h++ ) 
     {
-        phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
+        phdr = (Elf32_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
         if ( !is_loadable_phdr(phdr) )
             continue;
         if ( phdr->p_paddr < kernstart )
@@ -726,8 +730,8 @@
     char *elfbase, int xch, u32 dom, unsigned long *parray,
     struct domain_setup_info *dsi)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)elfbase;
-    Elf_Phdr *phdr;
+    Elf32_Ehdr *ehdr = (Elf32_Ehdr *)elfbase;
+    Elf32_Phdr *phdr;
     int h;
 
     char         *va;
@@ -735,7 +739,7 @@
 
     for ( h = 0; h < ehdr->e_phnum; h++ ) 
     {
-        phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
+        phdr = (Elf32_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
         if ( !is_loadable_phdr(phdr) )
             continue;
         

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