direct-io.hg

changeset 5612:7c198f2e6dd2

bitkeeper revision 1.1777 (42c3a88aPiHvcATujFTezqA1w1FMCg)

[PATCH] 64 bit xend cleanups.

64 bit xend cleanups.

Signed-off-by: Xin Li <xin.bi.li@intel.com>
Signed-off-by: Xiofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author arun.sharma@intel.com[kaf24]
date Thu Jun 30 08:08:42 2005 +0000 (2005-06-30)
parents 3c759ba83f7c
children 332eb7887996
files tools/libxc/linux_boot_params.h tools/libxc/xc_private.h tools/libxc/xc_vmx_build.c
line diff
     1.1 --- a/tools/libxc/linux_boot_params.h	Thu Jun 30 08:08:23 2005 +0000
     1.2 +++ b/tools/libxc/linux_boot_params.h	Thu Jun 30 08:08:42 2005 +0000
     1.3 @@ -8,9 +8,9 @@
     1.4  struct mem_map {
     1.5      int nr_map;
     1.6      struct entry {
     1.7 -        unsigned long long addr;	/* start of memory segment */
     1.8 -        unsigned long long size;	/* size of memory segment */
     1.9 -        unsigned long type;		/* type of memory segment */
    1.10 +        u64 addr;	/* start of memory segment */
    1.11 +        u64 size;	/* size of memory segment */
    1.12 +        u32 type;		/* type of memory segment */
    1.13  #define E820_RAM        1
    1.14  #define E820_RESERVED   2
    1.15  #define E820_ACPI       3 /* usable as RAM once ACPI tables have been read */
    1.16 @@ -18,7 +18,7 @@ struct mem_map {
    1.17  #define E820_IO         16
    1.18  #define E820_SHARED     17
    1.19  
    1.20 -        unsigned long caching_attr;    /* used by hypervisor */
    1.21 +        u32 caching_attr;    /* used by hypervisor */
    1.22  #define MEMMAP_UC	0
    1.23  #define MEMMAP_WC	1
    1.24  #define MEMMAP_WT	4
    1.25 @@ -29,15 +29,15 @@ struct mem_map {
    1.26  };
    1.27  
    1.28  struct e820entry {
    1.29 -	unsigned long long addr;	/* start of memory segment */
    1.30 -	unsigned long long size;	/* size of memory segment */
    1.31 -	unsigned long type;		/* type of memory segment */
    1.32 -};
    1.33 +	u64 addr;	/* start of memory segment */
    1.34 +	u64 size;	/* size of memory segment */
    1.35 +	u32 type;	/* type of memory segment */
    1.36 +}__attribute__((packed));
    1.37  
    1.38  struct e820map {
    1.39 -    int nr_map;
    1.40 +    u32 nr_map;
    1.41      struct e820entry map[E820MAX];
    1.42 -};
    1.43 +}__attribute__((packed));
    1.44  
    1.45  struct drive_info_struct { __u8 dummy[32]; }; 
    1.46  
    1.47 @@ -64,8 +64,8 @@ struct screen_info {
    1.48      unsigned short lfb_width;		/* 0x12 */
    1.49      unsigned short lfb_height;		/* 0x14 */
    1.50      unsigned short lfb_depth;		/* 0x16 */
    1.51 -    unsigned long  lfb_base;		/* 0x18 */
    1.52 -    unsigned long  lfb_size;		/* 0x1c */
    1.53 +    unsigned int   lfb_base;		/* 0x18 */
    1.54 +    unsigned int   lfb_size;		/* 0x1c */
    1.55      unsigned short dontuse2, dontuse3;	/* 0x20 -- CL_MAGIC and CL_OFFSET here */
    1.56      unsigned short lfb_linelength;	/* 0x24 */
    1.57      unsigned char  red_size;		/* 0x26 */
     2.1 --- a/tools/libxc/xc_private.h	Thu Jun 30 08:08:23 2005 +0000
     2.2 +++ b/tools/libxc/xc_private.h	Thu Jun 30 08:08:42 2005 +0000
     2.3 @@ -53,6 +53,8 @@
     2.4  #define PAGE_SIZE               (1UL << PAGE_SHIFT)
     2.5  #define PAGE_MASK               (~(PAGE_SIZE-1))
     2.6  
     2.7 +typedef u32 l1_pgentry_32_t;
     2.8 +typedef u32 l2_pgentry_32_t;
     2.9  typedef unsigned long l1_pgentry_t;
    2.10  typedef unsigned long l2_pgentry_t;
    2.11  #if defined(__x86_64__)
     3.1 --- a/tools/libxc/xc_vmx_build.c	Thu Jun 30 08:08:23 2005 +0000
     3.2 +++ b/tools/libxc/xc_vmx_build.c	Thu Jun 30 08:08:42 2005 +0000
     3.3 @@ -92,18 +92,20 @@ static void build_e820map(struct mem_map
     3.4  }
     3.5  
     3.6  static int zap_mmio_range(int xc_handle, u32 dom,
     3.7 -                            l2_pgentry_t *vl2tab,
     3.8 +                            l2_pgentry_32_t *vl2tab,
     3.9                              unsigned long mmio_range_start,
    3.10                              unsigned long mmio_range_size)
    3.11  {
    3.12      unsigned long mmio_addr;
    3.13      unsigned long mmio_range_end = mmio_range_start + mmio_range_size;
    3.14      unsigned long vl2e;
    3.15 -    l1_pgentry_t *vl1tab;
    3.16 +    l1_pgentry_32_t *vl1tab;
    3.17  
    3.18      mmio_addr = mmio_range_start & PAGE_MASK;
    3.19      for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) {
    3.20          vl2e = vl2tab[l2_table_offset(mmio_addr)];
    3.21 +        if (vl2e == 0)
    3.22 +            continue;
    3.23          vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    3.24                                  PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT);
    3.25  	if (vl1tab == 0) {
    3.26 @@ -121,7 +123,7 @@ static int zap_mmio_ranges(int xc_handle
    3.27                              struct mem_map *mem_mapp)
    3.28  {
    3.29      int i;
    3.30 -    l2_pgentry_t *vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    3.31 +    l2_pgentry_32_t *vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    3.32                                                  PROT_READ|PROT_WRITE,
    3.33                                                  l2tab >> PAGE_SHIFT);
    3.34      if (vl2tab == 0)
    3.35 @@ -149,8 +151,8 @@ static int setup_guest(int xc_handle,
    3.36                           unsigned long flags,
    3.37                           struct mem_map * mem_mapp)
    3.38  {
    3.39 -    l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
    3.40 -    l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
    3.41 +    l1_pgentry_32_t *vl1tab=NULL, *vl1e=NULL;
    3.42 +    l2_pgentry_32_t *vl2tab=NULL, *vl2e=NULL;
    3.43      unsigned long *page_array = NULL;
    3.44      unsigned long l2tab;
    3.45      unsigned long l1tab;
    3.46 @@ -426,8 +428,10 @@ static int setup_guest(int xc_handle,
    3.47       * Pin down l2tab addr as page dir page - causes hypervisor to provide
    3.48       * correct protection for the page
    3.49       */ 
    3.50 +#ifdef __i386__
    3.51      if ( pin_table(xc_handle, MMUEXT_PIN_L2_TABLE, l2tab>>PAGE_SHIFT, dom) )
    3.52          goto error_out;
    3.53 +#endif
    3.54  
    3.55      /* Send the page update requests down to the hypervisor. */
    3.56      if ( finish_mmu_updates(xc_handle, mmu) )
    3.57 @@ -646,7 +650,7 @@ int xc_vmx_build(int xc_handle,
    3.58      return -1;
    3.59  }
    3.60  
    3.61 -static inline int is_loadable_phdr(Elf_Phdr *phdr)
    3.62 +static inline int is_loadable_phdr(Elf32_Phdr *phdr)
    3.63  {
    3.64      return ((phdr->p_type == PT_LOAD) &&
    3.65              ((phdr->p_flags & (PF_W|PF_X)) != 0));
    3.66 @@ -656,9 +660,9 @@ static int parseelfimage(char *elfbase,
    3.67                           unsigned long elfsize,
    3.68                           struct domain_setup_info *dsi)
    3.69  {
    3.70 -    Elf_Ehdr *ehdr = (Elf_Ehdr *)elfbase;
    3.71 -    Elf_Phdr *phdr;
    3.72 -    Elf_Shdr *shdr;
    3.73 +    Elf32_Ehdr *ehdr = (Elf32_Ehdr *)elfbase;
    3.74 +    Elf32_Phdr *phdr;
    3.75 +    Elf32_Shdr *shdr;
    3.76      unsigned long kernstart = ~0UL, kernend=0UL;
    3.77      char *shstrtab;
    3.78      int h;
    3.79 @@ -687,13 +691,13 @@ static int parseelfimage(char *elfbase,
    3.80          ERROR("ELF image has no section-header strings table (shstrtab).");
    3.81          return -EINVAL;
    3.82      }
    3.83 -    shdr = (Elf_Shdr *)(elfbase + ehdr->e_shoff + 
    3.84 +    shdr = (Elf32_Shdr *)(elfbase + ehdr->e_shoff + 
    3.85                          (ehdr->e_shstrndx*ehdr->e_shentsize));
    3.86      shstrtab = elfbase + shdr->sh_offset;
    3.87      
    3.88      for ( h = 0; h < ehdr->e_phnum; h++ ) 
    3.89      {
    3.90 -        phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
    3.91 +        phdr = (Elf32_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
    3.92          if ( !is_loadable_phdr(phdr) )
    3.93              continue;
    3.94          if ( phdr->p_paddr < kernstart )
    3.95 @@ -726,8 +730,8 @@ loadelfimage(
    3.96      char *elfbase, int xch, u32 dom, unsigned long *parray,
    3.97      struct domain_setup_info *dsi)
    3.98  {
    3.99 -    Elf_Ehdr *ehdr = (Elf_Ehdr *)elfbase;
   3.100 -    Elf_Phdr *phdr;
   3.101 +    Elf32_Ehdr *ehdr = (Elf32_Ehdr *)elfbase;
   3.102 +    Elf32_Phdr *phdr;
   3.103      int h;
   3.104  
   3.105      char         *va;
   3.106 @@ -735,7 +739,7 @@ loadelfimage(
   3.107  
   3.108      for ( h = 0; h < ehdr->e_phnum; h++ ) 
   3.109      {
   3.110 -        phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
   3.111 +        phdr = (Elf32_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
   3.112          if ( !is_loadable_phdr(phdr) )
   3.113              continue;
   3.114