aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-18 10:14:16 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-18 10:14:16 +0100
commitfb442e217186a5bc3ed7ec84f0b683b708609eac (patch)
treeb8f199e985285357b03ca679c4eb352c7000bb19 /tools
parenta5c98899b234c23f43dae0f7dd58649a666d070e (diff)
downloadxen-fb442e217186a5bc3ed7ec84f0b683b708609eac.tar.gz
xen-fb442e217186a5bc3ed7ec84f0b683b708609eac.tar.bz2
xen-fb442e217186a5bc3ed7ec84f0b683b708609eac.zip
x86_64: allow more vCPU-s per guest
Since the shared info layout is fixed, guests are required to use VCPUOP_register_vcpu_info prior to booting any vCPU beyond the traditional limit of 32. MAX_VIRT_CPUS, being an implemetation detail of the hypervisor, is no longer being exposed in the public headers. The tools changes are clearly incomplete (and done only so things would build again), and the current state of the tools (using scalar variables all over the place to represent vCPU bitmaps) very likely doesn't permit booting DomU-s with more than the traditional number of vCPU-s. Testing of the extended functionality was done with Dom0 (96 vCPU-s, as well as 128 vCPU-s out of which the kernel elected - by way of a simple kernel side patch - to use only some, resulting in a sparse bitmap). ia64 changes only to make things build, and build-tested only (and the tools part only as far as the build would go without encountering unrelated problems in the blktap code). Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/debugger/xenitp/xenitp.c18
-rw-r--r--tools/include/xen-foreign/structs.py2
-rw-r--r--tools/libxc/ia64/xc_ia64_linux_restore.c2
-rw-r--r--tools/libxc/ia64/xc_ia64_linux_save.c4
-rw-r--r--tools/libxc/xc_core.c11
-rw-r--r--tools/libxc/xc_core_ia64.c21
-rw-r--r--tools/libxc/xc_core_ia64.h2
-rw-r--r--tools/libxc/xc_dom_ia64.c2
-rw-r--r--tools/libxc/xc_dom_x86.c4
-rw-r--r--tools/libxc/xc_domain_restore.c2
-rw-r--r--tools/libxc/xc_private.h5
-rw-r--r--tools/libxc/xc_ptrace.c27
-rw-r--r--tools/libxc/xc_ptrace.h5
-rw-r--r--tools/libxc/xc_ptrace_core.c105
14 files changed, 143 insertions, 67 deletions
diff --git a/tools/debugger/xenitp/xenitp.c b/tools/debugger/xenitp/xenitp.c
index 95d3820f94..847d7bd7a6 100644
--- a/tools/debugger/xenitp/xenitp.c
+++ b/tools/debugger/xenitp/xenitp.c
@@ -955,7 +955,7 @@ char *parse_arg (char **buf)
return res;
}
-vcpu_guest_context_any_t vcpu_ctx_any[MAX_VIRT_CPUS];
+vcpu_guest_context_any_t *vcpu_ctx_any;
int vcpu_setcontext (int vcpu)
{
@@ -1584,11 +1584,23 @@ void xenitp (int vcpu)
{
int ret;
struct sigaction sa;
-
- cur_ctx = &vcpu_ctx_any[vcpu].c;
+ xc_dominfo_t dominfo;
xc_handle = xc_interface_open (); /* for accessing control interface */
+ ret = xc_domain_getinfo (xc_handle, domid, 1, &dominfo);
+ if (ret < 0) {
+ perror ("xc_domain_getinfo");
+ exit (-1);
+ }
+
+ vcpu_ctx_any = calloc (sizeof(vcpu_ctx_any), dominfo.max_vcpu_id + 1);
+ if (!vcpu_ctx_any) {
+ perror ("vcpu context array alloc");
+ exit (-1);
+ }
+ cur_ctx = &vcpu_ctx_any[vcpu].c;
+
if (xc_domain_setdebugging (xc_handle, domid, 1) != 0)
perror ("setdebugging");
diff --git a/tools/include/xen-foreign/structs.py b/tools/include/xen-foreign/structs.py
index 7d51ca8b79..a1bc055a19 100644
--- a/tools/include/xen-foreign/structs.py
+++ b/tools/include/xen-foreign/structs.py
@@ -53,6 +53,6 @@ defines = [ "__i386__",
# all archs
"xen_pfn_to_cr3",
- "MAX_VIRT_CPUS",
+ "XEN_LEGACY_MAX_VCPUS",
"MAX_GUEST_CMDLINE" ];
diff --git a/tools/libxc/ia64/xc_ia64_linux_restore.c b/tools/libxc/ia64/xc_ia64_linux_restore.c
index 1e2d9a038f..ed62ab7d92 100644
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c
@@ -174,7 +174,7 @@ xc_ia64_recv_shared_info(int xc_handle, int io_fd, uint32_t dom,
/* clear any pending events and the selector */
memset(&(shared_info->evtchn_pending[0]), 0,
sizeof (shared_info->evtchn_pending));
- for (i = 0; i < MAX_VIRT_CPUS; i++)
+ for (i = 0; i < XEN_LEGACY_MAX_VCPUS; i++)
shared_info->vcpu_info[i].evtchn_pending_sel = 0;
if (start_info_pfn != NULL)
diff --git a/tools/libxc/ia64/xc_ia64_linux_save.c b/tools/libxc/ia64/xc_ia64_linux_save.c
index 3f19613b96..6c855eb4a6 100644
--- a/tools/libxc/ia64/xc_ia64_linux_save.c
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c
@@ -238,7 +238,7 @@ xc_ia64_pv_send_context(int xc_handle, int io_fd, uint32_t dom,
/* vcpu map */
uint64_t *vcpumap = NULL;
- if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, MAX_VIRT_CPUS,
+ if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, XEN_LEGACY_MAX_VCPUS,
&vcpumap))
goto out;
@@ -308,7 +308,7 @@ xc_ia64_hvm_send_context(int xc_handle, int io_fd, uint32_t dom,
return -1;
/* vcpu map */
- if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, MAX_VIRT_CPUS,
+ if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, XEN_LEGACY_MAX_VCPUS,
&vcpumap))
goto out;
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
index ef1e8dd7a1..8121a08bf0 100644
--- a/tools/libxc/xc_core.c
+++ b/tools/libxc/xc_core.c
@@ -430,7 +430,7 @@ xc_domain_dumpcore_via_callback(int xc_handle,
int nr_vcpus = 0;
char *dump_mem, *dump_mem_start = NULL;
- vcpu_guest_context_any_t ctxt[MAX_VIRT_CPUS];
+ vcpu_guest_context_any_t *ctxt = NULL;
struct xc_core_arch_context arch_ctxt;
char dummy[PAGE_SIZE];
int dummy_len;
@@ -495,6 +495,13 @@ xc_domain_dumpcore_via_callback(int xc_handle,
goto out;
}
+ ctxt = calloc(sizeof(*ctxt), info.max_vcpu_id + 1);
+ if ( !ctxt )
+ {
+ PERROR("Could not allocate vcpu context array", domid);
+ goto out;
+ }
+
for ( i = 0; i <= info.max_vcpu_id; i++ )
{
if ( xc_vcpu_getcontext(xc_handle, domid, i, &ctxt[nr_vcpus]) == 0 )
@@ -900,6 +907,8 @@ out:
xc_core_shdr_free(sheaders);
if ( strtab != NULL )
xc_core_strtab_free(strtab);
+ if ( ctxt != NULL )
+ free(ctxt);
if ( dump_mem_start != NULL )
free(dump_mem_start);
if ( live_shinfo != NULL )
diff --git a/tools/libxc/xc_core_ia64.c b/tools/libxc/xc_core_ia64.c
index b385d65f7d..77c8596605 100644
--- a/tools/libxc/xc_core_ia64.c
+++ b/tools/libxc/xc_core_ia64.c
@@ -251,13 +251,10 @@ xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info
void
xc_core_arch_context_init(struct xc_core_arch_context* arch_ctxt)
{
- int i;
-
arch_ctxt->mapped_regs_size =
(XMAPPEDREGS_SIZE < PAGE_SIZE) ? PAGE_SIZE: XMAPPEDREGS_SIZE;
arch_ctxt->nr_vcpus = 0;
- for ( i = 0; i < MAX_VIRT_CPUS; i++ )
- arch_ctxt->mapped_regs[i] = NULL;
+ arch_ctxt->mapped_regs = NULL;
xc_ia64_p2m_init(&arch_ctxt->p2m_table);
}
@@ -269,6 +266,7 @@ xc_core_arch_context_free(struct xc_core_arch_context* arch_ctxt)
for ( i = 0; i < arch_ctxt->nr_vcpus; i++ )
if ( arch_ctxt->mapped_regs[i] != NULL )
munmap(arch_ctxt->mapped_regs[i], arch_ctxt->mapped_regs_size);
+ free(arch_ctxt->mapped_regs);
xc_ia64_p2m_unmap(&arch_ctxt->p2m_table);
}
@@ -289,6 +287,21 @@ xc_core_arch_context_get(struct xc_core_arch_context* arch_ctxt,
errno = ENOENT;
return -1;
}
+ if ( !(arch_ctxt->nr_vcpus & (arch_ctxt->nr_vcpus - 1)) ) {
+ unsigned int nr = arch_ctxt->nr_vcpus ? arch_ctxt->nr_vcpus << 1 : 1;
+ mapped_regs_t** new = realloc(arch_ctxt->mapped_regs,
+ nr * sizeof(*new));
+
+ if ( !new )
+ {
+ PERROR("Could not alloc mapped regs pointer array");
+ return -1;
+ }
+ memset(new + arch_ctxt->nr_vcpus, 0,
+ (nr - arch_ctxt->nr_vcpus) * sizeof(*new));
+ arch_ctxt->mapped_regs = new;
+ }
+
mapped_regs = xc_map_foreign_range(xc_handle, domid,
arch_ctxt->mapped_regs_size,
PROT_READ, ctxt->privregs_pfn);
diff --git a/tools/libxc/xc_core_ia64.h b/tools/libxc/xc_core_ia64.h
index 75dd40fdc7..89ffd6ec5d 100644
--- a/tools/libxc/xc_core_ia64.h
+++ b/tools/libxc/xc_core_ia64.h
@@ -29,7 +29,7 @@
struct xc_core_arch_context {
size_t mapped_regs_size;
int nr_vcpus;
- mapped_regs_t* mapped_regs[MAX_VIRT_CPUS];
+ mapped_regs_t** mapped_regs;
struct xen_ia64_p2m_table p2m_table;
};
diff --git a/tools/libxc/xc_dom_ia64.c b/tools/libxc/xc_dom_ia64.c
index 76f845ab1c..2d4086e41d 100644
--- a/tools/libxc/xc_dom_ia64.c
+++ b/tools/libxc/xc_dom_ia64.c
@@ -87,7 +87,7 @@ int shared_info_ia64(struct xc_dom_image *dom, void *ptr)
xc_dom_printf("%s: called\n", __FUNCTION__);
memset(shared_info, 0, sizeof(*shared_info));
- for (i = 0; i < MAX_VIRT_CPUS; i++)
+ for (i = 0; i < XEN_LEGACY_MAX_VCPUS; i++)
shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
shared_info->arch.start_info_pfn = dom->start_info_pfn;
shared_info->arch.memmap_info_num_pages = 1; //XXX
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index a89eb4fef7..30f13970ac 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -498,7 +498,7 @@ static int shared_info_x86_32(struct xc_dom_image *dom, void *ptr)
xc_dom_printf("%s: called\n", __FUNCTION__);
memset(shared_info, 0, sizeof(*shared_info));
- for ( i = 0; i < MAX_VIRT_CPUS; i++ )
+ for ( i = 0; i < XEN_LEGACY_MAX_VCPUS; i++ )
shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
return 0;
}
@@ -511,7 +511,7 @@ static int shared_info_x86_64(struct xc_dom_image *dom, void *ptr)
xc_dom_printf("%s: called\n", __FUNCTION__);
memset(shared_info, 0, sizeof(*shared_info));
- for ( i = 0; i < MAX_VIRT_CPUS; i++ )
+ for ( i = 0; i < XEN_LEGACY_MAX_VCPUS; i++ )
shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
return 0;
}
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 9987d35dfa..13e83c3f13 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -1146,7 +1146,7 @@ int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
/* clear any pending events and the selector */
MEMSET_ARRAY_FIELD(new_shared_info, evtchn_pending, 0);
- for ( i = 0; i < MAX_VIRT_CPUS; i++ )
+ for ( i = 0; i < XEN_LEGACY_MAX_VCPUS; i++ )
SET_FIELD(new_shared_info, vcpu_info[i].evtchn_pending_sel, 0);
/* mask event channels */
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index d95bd0675d..4676fe8ea2 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -191,11 +191,6 @@ void *xc_map_foreign_ranges(int xc_handle, uint32_t dom,
size_t size, int prot, size_t chunksize,
privcmd_mmap_entry_t entries[], int nentries);
-void *map_domain_va_core(unsigned long domfd, int cpu, void *guest_va,
- vcpu_guest_context_any_t *ctxt);
-int xc_waitdomain_core(int xc_handle, int domain, int *status,
- int options, vcpu_guest_context_any_t *ctxt);
-
void bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, int nbits);
void bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, int nbits);
diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c
index 39f02198a9..725a022339 100644
--- a/tools/libxc/xc_ptrace.c
+++ b/tools/libxc/xc_ptrace.c
@@ -42,7 +42,8 @@ static int current_is_hvm;
static uint64_t online_cpumap;
static uint64_t regs_valid;
-static vcpu_guest_context_any_t ctxt[MAX_VIRT_CPUS];
+static unsigned int nr_vcpu_ids;
+static vcpu_guest_context_any_t *ctxt;
#define FOREACH_CPU(cpumap, i) for ( cpumap = online_cpumap; (i = xc_ffs64(cpumap)); cpumap &= ~(1 << (index - 1)) )
@@ -101,6 +102,21 @@ paging_enabled(vcpu_guest_context_any_t *v)
return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG);
}
+vcpu_guest_context_any_t *xc_ptrace_get_vcpu_ctxt(unsigned int nr_cpus)
+{
+ if (nr_cpus > nr_vcpu_ids) {
+ vcpu_guest_context_any_t *new;
+
+ new = realloc(ctxt, nr_cpus * sizeof(*ctxt));
+ if (!new)
+ return NULL;
+ ctxt = new;
+ nr_vcpu_ids = nr_cpus;
+ }
+
+ return ctxt;
+}
+
/*
* Fetch registers for all online cpus and set the cpumap
* to indicate which cpus are online
@@ -113,6 +129,9 @@ get_online_cpumap(int xc_handle, struct xen_domctl_getdomaininfo *d,
{
int i, online;
+ if (!xc_ptrace_get_vcpu_ctxt(d->max_vcpu_id + 1))
+ return -ENOMEM;
+
*cpumap = 0;
for (i = 0; i <= d->max_vcpu_id; i++) {
fetch_regs(xc_handle, i, &online);
@@ -261,7 +280,7 @@ xc_ptrace(
case PTRACE_PEEKDATA:
if (current_isfile)
guest_va = (unsigned long *)map_domain_va_core(
- current_domid, cpu, addr, ctxt);
+ current_domid, cpu, addr);
else
guest_va = (unsigned long *)map_domain_va(
xc_handle, cpu, addr, PROT_READ);
@@ -277,7 +296,7 @@ xc_ptrace(
/* XXX assume that all CPUs have the same address space */
if (current_isfile)
guest_va = (unsigned long *)map_domain_va_core(
- current_domid, cpu, addr, ctxt);
+ current_domid, cpu, addr);
else
guest_va = (unsigned long *)map_domain_va(
xc_handle, cpu, addr, PROT_READ|PROT_WRITE);
@@ -433,7 +452,7 @@ xc_waitdomain(
int options)
{
if (current_isfile)
- return xc_waitdomain_core(xc_handle, domain, status, options, ctxt);
+ return xc_waitdomain_core(xc_handle, domain, status, options);
return __xc_waitdomain(xc_handle, domain, status, options);
}
diff --git a/tools/libxc/xc_ptrace.h b/tools/libxc/xc_ptrace.h
index baaadb5b0b..c8ba4041e0 100644
--- a/tools/libxc/xc_ptrace.h
+++ b/tools/libxc/xc_ptrace.h
@@ -157,4 +157,9 @@ struct gdb_regs {
}
#endif
+void *map_domain_va_core(unsigned long domfd, int cpu, void *guest_va);
+int xc_waitdomain_core(int xc_handle, int domain, int *status, int options);
+vcpu_guest_context_any_t *xc_ptrace_get_vcpu_ctxt(unsigned int nr_cpus);
+
+
#endif /* XC_PTRACE */
diff --git a/tools/libxc/xc_ptrace_core.c b/tools/libxc/xc_ptrace_core.c
index a159591c4d..b6a5eb9ffd 100644
--- a/tools/libxc/xc_ptrace_core.c
+++ b/tools/libxc/xc_ptrace_core.c
@@ -12,6 +12,44 @@
#include <time.h>
#include <inttypes.h>
+static unsigned int max_nr_vcpus;
+static unsigned long *cr3;
+static unsigned long *cr3_phys;
+static unsigned long **cr3_virt;
+static unsigned long *pde_phys;
+static unsigned long **pde_virt;
+static unsigned long *page_phys;
+static unsigned long **page_virt;
+
+static vcpu_guest_context_t *
+ptrace_core_get_vcpu_ctxt(unsigned int nr_vcpus)
+{
+ if (nr_vcpus > max_nr_vcpus) {
+ void *new;
+
+#define REALLOC(what) \
+ new = realloc(what, nr_vcpus * sizeof(*what)); \
+ if (!new) \
+ return NULL; \
+ memset(what + max_nr_vcpus, 0, \
+ (nr_vcpus - max_nr_vcpus) * sizeof(*what)); \
+ what = new
+
+ REALLOC(cr3);
+ REALLOC(cr3_phys);
+ REALLOC(cr3_virt);
+ REALLOC(pde_phys);
+ REALLOC(pde_virt);
+ REALLOC(page_phys);
+ REALLOC(page_virt);
+
+#undef REALLOC
+ max_nr_vcpus = nr_vcpus;
+ }
+
+ return &xc_ptrace_get_vcpu_ctxt(nr_vcpus)->c;
+}
+
/* Leave the code for the old format as is. */
/* --- compatible layer for old format ------------------------------------- */
/* XXX application state */
@@ -21,7 +59,6 @@ static long nr_pages_compat = 0;
static unsigned long *p2m_array_compat = NULL;
static unsigned long *m2p_array_compat = NULL;
static unsigned long pages_offset_compat;
-static unsigned long cr3_compat[MAX_VIRT_CPUS];
/* --------------------- */
@@ -34,23 +71,15 @@ map_mtop_offset_compat(unsigned long ma)
static void *
-map_domain_va_core_compat(unsigned long domfd, int cpu, void *guest_va,
- vcpu_guest_context_t *ctxt)
+map_domain_va_core_compat(unsigned long domfd, int cpu, void *guest_va)
{
unsigned long pde, page;
unsigned long va = (unsigned long)guest_va;
void *v;
- static unsigned long cr3_phys[MAX_VIRT_CPUS];
- static unsigned long *cr3_virt[MAX_VIRT_CPUS];
- static unsigned long pde_phys[MAX_VIRT_CPUS];
- static unsigned long *pde_virt[MAX_VIRT_CPUS];
- static unsigned long page_phys[MAX_VIRT_CPUS];
- static unsigned long *page_virt[MAX_VIRT_CPUS];
-
- if (cr3_compat[cpu] != cr3_phys[cpu])
+ if (cr3[cpu] != cr3_phys[cpu])
{
- cr3_phys[cpu] = cr3_compat[cpu];
+ cr3_phys[cpu] = cr3[cpu];
if (cr3_virt[cpu])
munmap(cr3_virt[cpu], PAGE_SIZE);
v = mmap(
@@ -93,7 +122,7 @@ map_domain_va_core_compat(unsigned long domfd, int cpu, void *guest_va,
map_mtop_offset_compat(page_phys[cpu]));
if (v == MAP_FAILED)
{
- IPRINTF("cr3 %lx pde %lx page %lx pti %lx\n", cr3_compat[cpu], pde, page, l1_table_offset_i386(va));
+ IPRINTF("cr3 %lx pde %lx page %lx pti %lx\n", cr3[cpu], pde, page, l1_table_offset_i386(va));
page_phys[cpu] = 0;
return NULL;
}
@@ -107,11 +136,11 @@ xc_waitdomain_core_compat(
int xc_handle,
int domfd,
int *status,
- int options,
- vcpu_guest_context_t *ctxt)
+ int options)
{
int nr_vcpus;
int i;
+ vcpu_guest_context_t *ctxt;
xc_core_header_t header;
if ( nr_pages_compat == 0 )
@@ -132,12 +161,18 @@ xc_waitdomain_core_compat(
nr_vcpus = header.xch_nr_vcpus;
pages_offset_compat = header.xch_pages_offset;
+ if ((ctxt = ptrace_core_get_vcpu_ctxt(nr_vcpus)) == NULL)
+ {
+ IPRINTF("Could not allocate vcpu context array\n");
+ return -1;
+ }
+
if (read(domfd, ctxt, sizeof(vcpu_guest_context_t)*nr_vcpus) !=
sizeof(vcpu_guest_context_t)*nr_vcpus)
return -1;
for (i = 0; i < nr_vcpus; i++)
- cr3_compat[i] = ctxt[i].ctrlreg[3];
+ cr3[i] = ctxt[i].ctrlreg[3];
if ((p2m_array_compat = malloc(nr_pages_compat * sizeof(unsigned long))) == NULL)
{
@@ -375,7 +410,6 @@ static uint64_t* pfn_array = NULL; /* for auto translated physmap mode */
static uint64_t pfn_array_size = 0;
static long nr_pages = 0;
static uint64_t pages_offset;
-static unsigned long cr3[MAX_VIRT_CPUS];
static const struct xen_dumpcore_elfnote_format_version_desc
known_format_version[] =
@@ -413,21 +447,13 @@ map_gmfn_to_offset_elf(unsigned long gmfn)
}
static void *
-map_domain_va_core_elf(unsigned long domfd, int cpu, void *guest_va,
- vcpu_guest_context_t *ctxt)
+map_domain_va_core_elf(unsigned long domfd, int cpu, void *guest_va)
{
unsigned long pde, page;
unsigned long va = (unsigned long)guest_va;
unsigned long offset;
void *v;
- static unsigned long cr3_phys[MAX_VIRT_CPUS];
- static unsigned long *cr3_virt[MAX_VIRT_CPUS];
- static unsigned long pde_phys[MAX_VIRT_CPUS];
- static unsigned long *pde_virt[MAX_VIRT_CPUS];
- static unsigned long page_phys[MAX_VIRT_CPUS];
- static unsigned long *page_virt[MAX_VIRT_CPUS];
-
if (cr3[cpu] != cr3_phys[cpu])
{
if (cr3_virt[cpu])
@@ -498,10 +524,10 @@ xc_waitdomain_core_elf(
int xc_handle,
int domfd,
int *status,
- int options,
- vcpu_guest_context_t *ctxt)
+ int options)
{
int i;
+ vcpu_guest_context_t *ctxt;
struct elf_core ecore;
struct xen_dumpcore_elfnote_none *none;
@@ -527,14 +553,13 @@ xc_waitdomain_core_elf(
if ((header->header.xch_magic != XC_CORE_MAGIC &&
header->header.xch_magic != XC_CORE_MAGIC_HVM) ||
header->header.xch_nr_vcpus == 0 ||
- header->header.xch_nr_vcpus >= MAX_VIRT_CPUS ||
header->header.xch_nr_pages == 0 ||
header->header.xch_page_size != PAGE_SIZE)
goto out;
current_is_auto_translated_physmap =
(header->header.xch_magic == XC_CORE_MAGIC_HVM);
nr_pages = header->header.xch_nr_pages;
-
+
/* .note.Xen: xen_version */
if (elf_core_search_note(&ecore, XEN_DUMPCORE_ELFNOTE_NAME,
XEN_ELFNOTE_DUMPCORE_XEN_VERSION,
@@ -561,6 +586,9 @@ xc_waitdomain_core_elf(
format_version->format_version.version);
}
+ if ((ctxt = ptrace_core_get_vcpu_ctxt(header->header.xch_nr_vcpus)) == NULL)
+ goto out;
+
/* .xen_prstatus: read vcpu_guest_context_t*/
if (elf_core_read_sec_by_name(&ecore, XEN_DUMPCORE_SEC_PRSTATUS,
(char*)ctxt) < 0)
@@ -621,12 +649,10 @@ out:
typedef int (*xc_waitdomain_core_t)(int xc_handle,
int domfd,
int *status,
- int options,
- vcpu_guest_context_t *ctxt);
+ int options);
typedef void *(*map_domain_va_core_t)(unsigned long domfd,
int cpu,
- void *guest_va,
- vcpu_guest_context_t *ctxt);
+ void *guest_va);
struct xc_core_format_type {
xc_waitdomain_core_t waitdomain_core;
map_domain_va_core_t map_domain_va_core;
@@ -642,25 +668,22 @@ static const struct xc_core_format_type format_type[] = {
static const struct xc_core_format_type* current_format_type = NULL;
void *
-map_domain_va_core(unsigned long domfd, int cpu, void *guest_va,
- vcpu_guest_context_any_t *ctxt)
+map_domain_va_core(unsigned long domfd, int cpu, void *guest_va)
{
if (current_format_type == NULL)
return NULL;
- return (current_format_type->map_domain_va_core)(domfd, cpu, guest_va,
- &ctxt->c);
+ return (current_format_type->map_domain_va_core)(domfd, cpu, guest_va);
}
int
-xc_waitdomain_core(int xc_handle, int domfd, int *status, int options,
- vcpu_guest_context_any_t *ctxt)
+xc_waitdomain_core(int xc_handle, int domfd, int *status, int options)
{
int ret;
int i;
for (i = 0; i < NR_FORMAT_TYPE; i++) {
ret = (format_type[i].waitdomain_core)(xc_handle, domfd, status,
- options, &ctxt->c);
+ options);
if (ret == 0) {
current_format_type = &format_type[i];
break;