diff options
author | Keir Fraser <keir@xensource.com> | 2007-02-24 14:31:42 +0000 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-02-24 14:31:42 +0000 |
commit | e3ce7ff90fbce79dbb3d5a2c82c467699dd6e57e (patch) | |
tree | 562a4377e1aae9fc4337ef026b9a4ee557335f4d /tools/libxc/xc_core_x86.c | |
parent | 4062095bcbc7a0bf38a65ee90e8ffd2506d83950 (diff) | |
download | xen-e3ce7ff90fbce79dbb3d5a2c82c467699dd6e57e.tar.gz xen-e3ce7ff90fbce79dbb3d5a2c82c467699dd6e57e.tar.bz2 xen-e3ce7ff90fbce79dbb3d5a2c82c467699dd6e57e.zip |
Xen coredump format: ELF formatified with note section.
added PFN-GMFN table for non-auto translated physmap
added PFN table for auto translated physmap.
HVM domain support.
IA64 support
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Use the guest's own p2m table instead of xc_get_pfn_list(), which
cannot handle PFNs with no MFN.
Dump a zeroed page for PFNs with no MFN.
Clearly deprecate xc_get_pfn_list().
Do not include a P2M table with HVM domains.
Refuse to dump HVM until we can map its pages with PFNs.
Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/libxc/xc_core_x86.c')
-rw-r--r-- | tools/libxc/xc_core_x86.c | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c new file mode 100644 index 0000000000..6ea775aef6 --- /dev/null +++ b/tools/libxc/xc_core_x86.c @@ -0,0 +1,136 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp> + * VA Linux Systems Japan K.K. + * + */ + +#include "xg_private.h" +#include "xc_core.h" + +int +xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info) +{ + if ( info->hvm ) + return 1; + return 0; +} + +int +xc_core_arch_memory_map_get(int xc_handle, xc_dominfo_t *info, + shared_info_t *live_shinfo, + xc_core_memory_map_t **mapp, + unsigned int *nr_entries) +{ + unsigned long max_pfn = live_shinfo->arch.max_pfn; + xc_core_memory_map_t *map = NULL; + + map = malloc(sizeof(*map)); + if ( !map ) + { + PERROR("Could not allocate memory"); + goto out; + } + + map->addr = 0; + map->size = max_pfn << PAGE_SHIFT; + + *mapp = map; + *nr_entries = 1; + return 0; + +out: + if ( map ) + free(map); + return -1; +} + +int +xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info, + shared_info_t *live_shinfo, xen_pfn_t **live_p2m, + unsigned long *pfnp) +{ + /* Double and single indirect references to the live P2M table */ + xen_pfn_t *live_p2m_frame_list_list = NULL; + xen_pfn_t *live_p2m_frame_list = NULL; + uint32_t dom = info->domid; + unsigned long max_pfn = live_shinfo->arch.max_pfn; + int ret = -1; + int err; + + if ( max_pfn < info->nr_pages ) + { + ERROR("max_pfn < nr_pages -1 (%lx < %lx", max_pfn, info->nr_pages - 1); + goto out; + } + + live_p2m_frame_list_list = + xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ, + live_shinfo->arch.pfn_to_mfn_frame_list_list); + + if ( !live_p2m_frame_list_list ) + { + PERROR("Couldn't map p2m_frame_list_list (errno %d)", errno); + goto out; + } + + live_p2m_frame_list = + xc_map_foreign_batch(xc_handle, dom, PROT_READ, + live_p2m_frame_list_list, + P2M_FLL_ENTRIES); + + if ( !live_p2m_frame_list ) + { + PERROR("Couldn't map p2m_frame_list"); + goto out; + } + + *live_p2m = xc_map_foreign_batch(xc_handle, dom, PROT_READ, + live_p2m_frame_list, + P2M_FL_ENTRIES); + + if ( !*live_p2m ) + { + PERROR("Couldn't map p2m table"); + goto out; + } + + *pfnp = max_pfn; + + ret = 0; + +out: + err = errno; + + if ( live_p2m_frame_list_list ) + munmap(live_p2m_frame_list_list, PAGE_SIZE); + + if ( live_p2m_frame_list ) + munmap(live_p2m_frame_list, P2M_FLL_ENTRIES * PAGE_SIZE); + + errno = err; + return ret; +} + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ |