direct-io.hg

changeset 15306:6450f6287898

[IA64] memmap: dump-core: enable ia64 memory map code

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Mon May 21 14:09:27 2007 -0600 (2007-05-21)
parents fc49dbce4868
children d30576123892
files tools/libxc/xc_core_ia64.c
line diff
     1.1 --- a/tools/libxc/xc_core_ia64.c	Mon May 21 14:08:19 2007 -0600
     1.2 +++ b/tools/libxc/xc_core_ia64.c	Mon May 21 14:09:27 2007 -0600
     1.3 @@ -163,20 +163,23 @@ xc_core_arch_memory_map_get(int xc_handl
     1.4                              xc_core_memory_map_t **mapp,
     1.5                              unsigned int *nr_entries)
     1.6  {
     1.7 -#ifdef notyet
     1.8      int ret = -1;
     1.9      xen_ia64_memmap_info_t *memmap_info;
    1.10 +    unsigned long map_size;
    1.11      xc_core_memory_map_t *map;
    1.12      char *start;
    1.13      char *end;
    1.14      char *p;
    1.15      efi_memory_desc_t *md;
    1.16  
    1.17 -    if  ( live_shinfo == NULL || live_shinfo->arch.memmap_info_pfn == 0 )
    1.18 +    if  ( live_shinfo == NULL ||
    1.19 +          live_shinfo->arch.memmap_info_num_pages == 0 ||
    1.20 +          live_shinfo->arch.memmap_info_pfn == 0 )
    1.21          goto old;
    1.22  
    1.23 +    map_size = PAGE_SIZE * live_shinfo->arch.memmap_info_num_pages;
    1.24      memmap_info = xc_map_foreign_range(xc_handle, info->domid,
    1.25 -                                       PAGE_SIZE, PROT_READ,
    1.26 +                                       map_size, PROT_READ,
    1.27                                         live_shinfo->arch.memmap_info_pfn);
    1.28      if ( memmap_info == NULL )
    1.29      {
    1.30 @@ -185,7 +188,7 @@ xc_core_arch_memory_map_get(int xc_handl
    1.31      }
    1.32      if ( memmap_info->efi_memdesc_size != sizeof(*md) ||
    1.33           (memmap_info->efi_memmap_size / memmap_info->efi_memdesc_size) == 0 ||
    1.34 -         memmap_info->efi_memmap_size > PAGE_SIZE - sizeof(memmap_info) ||
    1.35 +         memmap_info->efi_memmap_size > map_size - sizeof(memmap_info) ||
    1.36           memmap_info->efi_memdesc_version != EFI_MEMORY_DESCRIPTOR_VERSION )
    1.37      {
    1.38          PERROR("unknown memmap header. defaulting to compat mode.");
    1.39 @@ -219,12 +222,11 @@ xc_core_arch_memory_map_get(int xc_handl
    1.40      }
    1.41      ret = 0;
    1.42  out:
    1.43 -    munmap(memmap_info, PAGE_SIZE);
    1.44 +    munmap(memmap_info, map_size);
    1.45      qsort(map, *nr_entries, sizeof(map[0]), &xc_memory_map_cmp);
    1.46      return ret;
    1.47      
    1.48  old:
    1.49 -#endif
    1.50      return memory_map_get_old(xc_handle, info, live_shinfo, mapp, nr_entries);
    1.51  }
    1.52