ia64/xen-unstable

changeset 19690:6d6ec6f966cf

libxc: Export xc_core_arch_map_p2m_writable()

This patch firstly change the xc_core_arch_map_p2m() to map the p2m to
be writable, then it export this function.
One notice for this patch is, caller should make sure change the p2m
in flight will not cause trouble.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 01 14:13:53 2009 +0100 (2009-06-01)
parents 4b2172c60a8c
children f44438bc79ac
files tools/libxc/xc_core.h tools/libxc/xc_core_x86.c
line diff
     1.1 --- a/tools/libxc/xc_core.h	Mon Jun 01 14:13:20 2009 +0100
     1.2 +++ b/tools/libxc/xc_core.h	Mon Jun 01 14:13:53 2009 +0100
     1.3 @@ -143,6 +143,11 @@ int xc_core_arch_map_p2m(int xc_handle, 
     1.4                           xc_dominfo_t *info, shared_info_any_t *live_shinfo,
     1.5                           xen_pfn_t **live_p2m, unsigned long *pfnp);
     1.6  
     1.7 +int xc_core_arch_map_p2m_writable(int xc_handle, unsigned int guest_width,
     1.8 +                                  xc_dominfo_t *info,
     1.9 +                                  shared_info_any_t *live_shinfo,
    1.10 +                                  xen_pfn_t **live_p2m, unsigned long *pfnp);
    1.11 +
    1.12  
    1.13  #if defined (__i386__) || defined (__x86_64__)
    1.14  # include "xc_core_x86.h"
     2.1 --- a/tools/libxc/xc_core_x86.c	Mon Jun 01 14:13:20 2009 +0100
     2.2 +++ b/tools/libxc/xc_core_x86.c	Mon Jun 01 14:13:53 2009 +0100
     2.3 @@ -75,10 +75,10 @@ xc_core_arch_memory_map_get(int xc_handl
     2.4      return 0;
     2.5  }
     2.6  
     2.7 -int
     2.8 -xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
     2.9 -                     shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
    2.10 -                     unsigned long *pfnp)
    2.11 +static int
    2.12 +xc_core_arch_map_p2m_rw(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
    2.13 +                        shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
    2.14 +                        unsigned long *pfnp, int rw)
    2.15  {
    2.16      /* Double and single indirect references to the live P2M table */
    2.17      xen_pfn_t *live_p2m_frame_list_list = NULL;
    2.18 @@ -156,7 +156,8 @@ xc_core_arch_map_p2m(int xc_handle, unsi
    2.19          for ( i = P2M_FL_ENTRIES - 1; i >= 0; i-- )
    2.20              p2m_frame_list[i] = ((uint32_t *)p2m_frame_list)[i];
    2.21  
    2.22 -    *live_p2m = xc_map_foreign_pages(xc_handle, dom, PROT_READ,
    2.23 +    *live_p2m = xc_map_foreign_pages(xc_handle, dom,
    2.24 +                                    rw ? (PROT_READ | PROT_WRITE) : PROT_READ,
    2.25                                      p2m_frame_list,
    2.26                                      P2M_FL_ENTRIES);
    2.27  
    2.28 @@ -189,6 +190,23 @@ out:
    2.29      return ret;
    2.30  }
    2.31  
    2.32 +int
    2.33 +xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
    2.34 +                        shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
    2.35 +                        unsigned long *pfnp)
    2.36 +{
    2.37 +    return xc_core_arch_map_p2m_rw(xc_handle, guest_width, info,
    2.38 +                                   live_shinfo, live_p2m, pfnp, 0);
    2.39 +}
    2.40 +
    2.41 +int
    2.42 +xc_core_arch_map_p2m_writable(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
    2.43 +                              shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
    2.44 +                              unsigned long *pfnp)
    2.45 +{
    2.46 +    return xc_core_arch_map_p2m_rw(xc_handle, guest_width, info,
    2.47 +                                   live_shinfo, live_p2m, pfnp, 1);
    2.48 +}
    2.49  /*
    2.50   * Local variables:
    2.51   * mode: C