aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_core.c
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-10-17 11:36:36 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-10-17 11:36:36 +0100
commit981d9b117d4ad6b759af0c42a044050ab06207f5 (patch)
tree81cc2c335bfa6af1eeca01ad0adaa753ba0031e8 /tools/libxc/xc_core.c
parentec82f54895da4932edc67d190ccf592f219f1f01 (diff)
downloadxen-981d9b117d4ad6b759af0c42a044050ab06207f5.tar.gz
xen-981d9b117d4ad6b759af0c42a044050ab06207f5.tar.bz2
xen-981d9b117d4ad6b759af0c42a044050ab06207f5.zip
Plumb GETVCPUINFO dom0_op through to Python. Remove
n_vcpu field from GETDOMAININFO: replaced with nr_online_vcpus and max_vcpu_id (both plumbed through to Python). TODO: Remove 'vcpus' entry in getdomaininfo Python dictionary. TODO: Don't represent 'cpumap' as a bitmap in Python. It would be more sensible to represent as a list of integer CPU numbers. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_core.c')
-rw-r--r--tools/libxc/xc_core.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
index 4694c0fe2f..207fbe8fb1 100644
--- a/tools/libxc/xc_core.c
+++ b/tools/libxc/xc_core.c
@@ -33,10 +33,10 @@ xc_domain_dumpcore(int xc_handle,
unsigned long nr_pages;
unsigned long *page_array;
xc_dominfo_t info;
- int i, j, dump_fd;
+ int i, nr_vcpus = 0, dump_fd;
char *dump_mem, *dump_mem_start = NULL;
struct xc_core_header header;
- vcpu_guest_context_t ctxt[MAX_VIRT_CPUS];
+ vcpu_guest_context_t ctxt[MAX_VIRT_CPUS];
if ((dump_fd = open(corename, O_CREAT|O_RDWR, S_IWUSR|S_IRUSR)) < 0) {
@@ -54,24 +54,25 @@ xc_domain_dumpcore(int xc_handle,
goto error_out;
}
- for (i = 0, j = 0; i < 32; i++)
- if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j]) == 0)
- j++;
+ for (i = 0; i < info.max_vcpu_id; i++)
+ if (xc_domain_get_vcpu_context(xc_handle, domid,
+ i, &ctxt[nr_vcpus]) == 0)
+ nr_vcpus++;
nr_pages = info.nr_pages;
header.xch_magic = 0xF00FEBED;
- header.xch_nr_vcpus = info.vcpus;
+ header.xch_nr_vcpus = nr_vcpus;
header.xch_nr_pages = nr_pages;
header.xch_ctxt_offset = sizeof(struct xc_core_header);
header.xch_index_offset = sizeof(struct xc_core_header) +
- sizeof(vcpu_guest_context_t)*info.vcpus;
+ sizeof(vcpu_guest_context_t)*nr_vcpus;
header.xch_pages_offset = round_pgup(sizeof(struct xc_core_header) +
- (sizeof(vcpu_guest_context_t) * info.vcpus) +
+ (sizeof(vcpu_guest_context_t) * nr_vcpus) +
(nr_pages * sizeof(unsigned long)));
write(dump_fd, &header, sizeof(struct xc_core_header));
- write(dump_fd, &ctxt, sizeof(ctxt[0]) * info.vcpus);
+ write(dump_fd, &ctxt, sizeof(ctxt[0]) * nr_vcpus);
if ((page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL) {
printf("Could not allocate memory\n");