aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c9
-rw-r--r--tools/debugger/libxendebug/Makefile75
-rw-r--r--tools/debugger/libxendebug/list.h186
-rw-r--r--tools/debugger/libxendebug/xendebug.c599
-rw-r--r--tools/debugger/libxendebug/xendebug.h78
-rw-r--r--tools/libxc/ia64/xc_ia64_hvm_build.c37
-rw-r--r--tools/libxc/ia64/xc_ia64_linux_restore.c46
-rw-r--r--tools/libxc/ia64/xc_ia64_linux_save.c24
-rw-r--r--tools/libxc/ia64/xc_ia64_stubs.c24
-rw-r--r--tools/libxc/powerpc64/xc_linux_build.c1
-rw-r--r--tools/libxc/xc_csched.c32
-rw-r--r--tools/libxc/xc_domain.c300
-rw-r--r--tools/libxc/xc_hvm_build.c32
-rw-r--r--tools/libxc/xc_linux_build.c55
-rw-r--r--tools/libxc/xc_linux_restore.c112
-rw-r--r--tools/libxc/xc_linux_save.c71
-rw-r--r--tools/libxc/xc_misc.c48
-rw-r--r--tools/libxc/xc_private.c71
-rw-r--r--tools/libxc/xc_private.h53
-rw-r--r--tools/libxc/xc_ptrace.c83
-rw-r--r--tools/libxc/xc_sedf.c47
-rw-r--r--tools/libxc/xc_tbuf.c88
-rw-r--r--tools/libxc/xenctrl.h32
-rw-r--r--tools/libxc/xg_private.h9
-rw-r--r--tools/misc/xenperf.c6
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c18
-rw-r--r--tools/xenmon/setmask.c35
-rw-r--r--tools/xenstat/libxenstat/src/xenstat.c6
28 files changed, 677 insertions, 1500 deletions
diff --git a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c
index ad4e4224fc..c87096d1c4 100644
--- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c
+++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c
@@ -54,15 +54,6 @@ curvcpuid()
}
-
-#define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
-#define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut down. */
-#define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
-#define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
-#define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
-
-
-
struct inferior_list all_processes;
static int current_domid;
static int expect_signal = 0;
diff --git a/tools/debugger/libxendebug/Makefile b/tools/debugger/libxendebug/Makefile
deleted file mode 100644
index 2e16446253..0000000000
--- a/tools/debugger/libxendebug/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-
-INSTALL = install
-INSTALL_PROG = $(INSTALL) -m0755
-INSTALL_DATA = $(INSTALL) -m0644
-INSTALL_DIR = $(INSTALL) -d -m0755
-
-MAJOR = 3.0
-MINOR = 0
-
-XEN_ROOT = ../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-SRCS := xendebug.c
-
-CFLAGS += -Werror -fno-strict-aliasing
-CFLAGS += $(INCLUDES) -I. -I$(XEN_ROOT)/tools/libxc
-# Get gcc to generate the dependencies for us.
-CFLAGS += -Wp,-MD,.$(@F).d
-DEPS = .*.d
-
-LDFLAGS += -L$(XEN_ROOT)/tools/libxc -lxenctrl
-
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
-
-LIB := libxendebug.a libxendebug.so
-LIB += libxendebug.so.$(MAJOR) libxendebug.so.$(MAJOR).$(MINOR)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
- $(MAKE) $(LIB)
-
-.PHONY: install
-install: build
- [ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
- [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
- $(INSTALL_PROG) libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
- $(INSTALL_DATA) libxendebug.a $(DESTDIR)/usr/$(LIBDIR)
- ln -sf libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so.$(MAJOR)
- ln -sf libxendebug.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so
- $(INSTALL_DATA) xendebug.h $(DESTDIR)/usr/include
-
-.PHONY: TAGS
-TAGS:
- etags -t $(SRCS) *.h
-
-.PHONY: clean
-clean:
- rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
-
-.PHONY: rpm
-rpm: build
- rm -rf staging
- mkdir staging
- mkdir staging/i386
- rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
- --define "_rpmdir$$PWD/staging" -bb rpm.spec
- mv staging/i386/*.rpm .
- rm -rf staging
-
-libxendebug.a: $(LIB_OBJS)
- $(AR) rc $@ $^
-
-libxendebug.so: libxendebug.so.$(MAJOR)
- ln -sf $< $@
-libxendebug.so.$(MAJOR): libxendebug.so.$(MAJOR).$(MINOR)
- ln -sf $< $@
-
-libxendebug.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxendebug.so.$(MAJOR) -shared -o $@ $^
-
--include $(DEPS)
diff --git a/tools/debugger/libxendebug/list.h b/tools/debugger/libxendebug/list.h
deleted file mode 100644
index d2ee720f34..0000000000
--- a/tools/debugger/libxendebug/list.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct list_head {
- struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
-
-#define INIT_LIST_HEAD(ptr) do { \
- (ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-/*
- * Insert a new entry between two known consecutive entries.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __list_add(struct list_head * new,
- struct list_head * prev,
- struct list_head * next)
-{
- next->prev = new;
- new->next = next;
- new->prev = prev;
- prev->next = new;
-}
-
-/**
- * list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static __inline__ void list_add(struct list_head *new, struct list_head *head)
-{
- __list_add(new, head, head->next);
-}
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
-{
- __list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __list_del(struct list_head * prev,
- struct list_head * next)
-{
- next->prev = prev;
- prev->next = next;
-}
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static __inline__ void list_del(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static __inline__ void list_del_init(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static __inline__ int list_empty(struct list_head *head)
-{
- return head->next == head;
-}
-
-/**
- * list_splice - join two lists
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static __inline__ void list_splice(struct list_head *list, struct list_head *head)
-{
- struct list_head *first = list->next;
-
- if (first != list) {
- struct list_head *last = list->prev;
- struct list_head *at = head->next;
-
- first->prev = head;
- head->next = first;
-
- last->next = at;
- at->prev = last;
- }
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-/**
- * list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
- */
-#define list_for_each(pos, head) \
- for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos: the &struct list_head to use as a loop counter.
- * @n: another &struct list_head to use as temporary storage
- * @head: the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-
-/**
- * list_for_each_entry - iterate over list of given type
- * @pos: the type * to use as a loop counter.
- * @head: the head for your list.
- * @member: the name of the list_struct within the struct.
- */
-#define list_for_each_entry(pos, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = list_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next))
-
-/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos: the type * to use as a loop counter.
- * @n: another type * to use as temporary storage
- * @head: the head for your list.
- * @member: the name of the list_struct within the struct.
- */
-#define list_for_each_entry_safe(pos, n, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- n = list_entry(pos->member.next, typeof(*pos), member); \
- &pos->member != (head); \
- pos = n, n = list_entry(n->member.next, typeof(*n), member))
-#endif /* _LINUX_LIST_H */
-
diff --git a/tools/debugger/libxendebug/xendebug.c b/tools/debugger/libxendebug/xendebug.c
deleted file mode 100644
index c5d6143b77..0000000000
--- a/tools/debugger/libxendebug/xendebug.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * xendebug.c
- *
- * alex ho
- * http://www.cl.cam.ac.uk/netos/pdb
- *
- * xendebug_memory_page adapted from xc_ptrace.c
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <xenctrl.h>
-#include "list.h"
-
-#if defined(__i386__)
-#define L1_PAGETABLE_SHIFT 12
-#define L2_PAGETABLE_SHIFT 22
-#elif defined(__x86_64__)
-#define L1_PAGETABLE_SHIFT 12
-#define L2_PAGETABLE_SHIFT 21
-#define L3_PAGETABLE_SHIFT 30
-#define L4_PAGETABLE_SHIFT 39
-#endif
-
-#define PAGE_SHIFT L1_PAGETABLE_SHIFT
-#define PAGE_SIZE (1UL<<PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE - 1))
-
-/* from xen/include/asm-x86/processor.h */
-#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
-
-typedef int boolean;
-#define true 1
-#define false 0
-
-
-typedef struct bwcpoint /* break/watch/catch point */
-{
- struct list_head list;
- unsigned long address;
- uint32_t domain;
- uint8_t old_value; /* old value for software bkpt */
-} bwcpoint_t, *bwcpoint_p;
-
-static bwcpoint_t bwcpoint_list;
-
-
-
-typedef struct domain_context /* local cache of domain state */
-{
- struct list_head list;
- uint32_t domid;
- boolean valid[MAX_VIRT_CPUS];
- vcpu_guest_context_t context[MAX_VIRT_CPUS];
-
- long total_pages;
- xen_pfn_t *page_array;
-
- unsigned long cr3_phys[MAX_VIRT_CPUS];
- unsigned long *cr3_virt[MAX_VIRT_CPUS];
- unsigned long pde_phys[MAX_VIRT_CPUS];
- unsigned long *pde_virt[MAX_VIRT_CPUS];
- unsigned long page_phys[MAX_VIRT_CPUS];
- unsigned long *page_virt[MAX_VIRT_CPUS];
- int page_perm[MAX_VIRT_CPUS];
-} domain_context_t, *domain_context_p;
-
-static domain_context_t domain_context_list;
-
-/* initialization */
-
-static boolean xendebug_initialized = false;
-
-static __inline__ void
-xendebug_initialize()
-{
- if ( !xendebug_initialized )
- {
- memset((void *) &domain_context_list, 0, sizeof(domain_context_t));
- INIT_LIST_HEAD(&domain_context_list.list);
-
- memset((void *) &bwcpoint_list, 0, sizeof(bwcpoint_t));
- INIT_LIST_HEAD(&bwcpoint_list.list);
-
- xendebug_initialized = true;
- }
-}
-
-/**************/
-
-static domain_context_p
-xendebug_domain_context_search (uint32_t domid)
-{
- struct list_head *entry;
- domain_context_p ctxt;
-
- list_for_each(entry, &domain_context_list.list)
- {
- ctxt = list_entry(entry, domain_context_t, list);
- if ( domid == ctxt->domid )
- return ctxt;
- }
- return (domain_context_p)NULL;
-}
-
-static __inline__ domain_context_p
-xendebug_get_context (int xc_handle, uint32_t domid, uint32_t vcpu)
-{
- int rc;
- domain_context_p ctxt;
-
- xendebug_initialize();
-
- if ( (ctxt = xendebug_domain_context_search(domid)) == NULL)
- return NULL;
-
- if ( !ctxt->valid[vcpu] )
- {
- if ( (rc = xc_vcpu_getcontext(xc_handle, domid, vcpu,
- &ctxt->context[vcpu])) )
- return NULL;
-
- ctxt->valid[vcpu] = true;
- }
-
- return ctxt;
-}
-
-static __inline__ int
-xendebug_set_context (int xc_handle, domain_context_p ctxt, uint32_t vcpu)
-{
- dom0_op_t op;
- int rc;
-
- if ( !ctxt->valid[vcpu] )
- return -EINVAL;
-
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.cmd = DOM0_SETVCPUCONTEXT;
- op.u.setvcpucontext.domain = ctxt->domid;
- op.u.setvcpucontext.vcpu = vcpu;
- op.u.setvcpucontext.ctxt = &ctxt->context[vcpu];
-
- if ( (rc = mlock(&ctxt->context[vcpu], sizeof(vcpu_guest_context_t))) )
- return rc;
-
- rc = xc_dom0_op(xc_handle, &op);
- (void) munlock(&ctxt->context[vcpu], sizeof(vcpu_guest_context_t));
-
- return rc;
-}
-
-/**************/
-
-int
-xendebug_attach(int xc_handle,
- uint32_t domid,
- uint32_t vcpu)
-{
- domain_context_p ctxt;
-
- xendebug_initialize();
-
- if ( (ctxt = malloc(sizeof(domain_context_t))) == NULL )
- return -1;
- memset(ctxt, 0, sizeof(domain_context_t));
-
- ctxt->domid = domid;
- list_add(&ctxt->list, &domain_context_list.list);
-
- return xc_domain_pause(xc_handle, domid);
-}
-
-int
-xendebug_detach(int xc_handle,
- uint32_t domid,
- uint32_t vcpu)
-{
- domain_context_p ctxt;
-
- xendebug_initialize();
-
- if ( (ctxt = xendebug_domain_context_search (domid)) == NULL)
- return -EINVAL;
-
- list_del(&ctxt->list);
-
- if ( ctxt->page_array ) free(ctxt->page_array);
-
- free(ctxt);
-
- return xc_domain_unpause(xc_handle, domid);
-}
-
-int
-xendebug_read_registers(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- cpu_user_regs_t **regs)
-{
- domain_context_p ctxt;
- int rc = -1;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
- if (ctxt)
- {
- *regs = &ctxt->context[vcpu].user_regs;
- rc = 0;
- }
-
- return rc;
-}
-
-int
-xendebug_read_fpregisters (int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- char **regs)
-{
- domain_context_p ctxt;
- int rc = -1;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
- if (ctxt)
- {
- *regs = ctxt->context[vcpu].fpu_ctxt.x;
- rc = 0;
- }
-
- return rc;
-}
-
-int
-xendebug_write_registers(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- cpu_user_regs_t *regs)
-{
- domain_context_p ctxt;
- int rc = -1;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
- if (ctxt)
- {
- memcpy(&ctxt->context[vcpu].user_regs, regs, sizeof(cpu_user_regs_t));
- rc = xendebug_set_context(xc_handle, ctxt, vcpu);
- }
-
- return rc;
-}
-
-int
-xendebug_step(int xc_handle,
- uint32_t domid,
- uint32_t vcpu)
-{
- domain_context_p ctxt;
- int rc;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
- if (!ctxt) return -EINVAL;
-
- ctxt->context[vcpu].user_regs.eflags |= X86_EFLAGS_TF;
-
- if ( (rc = xendebug_set_context(xc_handle, ctxt, vcpu)) )
- return rc;
-
- ctxt->valid[vcpu] = false;
- return xc_domain_unpause(xc_handle, domid);
-}
-
-int
-xendebug_continue(int xc_handle,
- uint32_t domid,
- uint32_t vcpu)
-{
- domain_context_p ctxt;
- int rc;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
- if (!ctxt) return -EINVAL;
-
- if ( ctxt->context[vcpu].user_regs.eflags & X86_EFLAGS_TF )
- {
- ctxt->context[vcpu].user_regs.eflags &= ~X86_EFLAGS_TF;
- if ( (rc = xendebug_set_context(xc_handle, ctxt, vcpu)) )
- return rc;
- }
- ctxt->valid[vcpu] = false;
- return xc_domain_unpause(xc_handle, domid);
-}
-
-/*************************************************/
-
-#define vtopdi(va) ((va) >> L2_PAGETABLE_SHIFT)
-#define vtopti(va) (((va) >> PAGE_SHIFT) & 0x3ff)
-
-/* access to one page */
-static int
-xendebug_memory_page (domain_context_p ctxt, int xc_handle, uint32_t vcpu,
- int protection, unsigned long address, int length, uint8_t *buffer)
-{
- vcpu_guest_context_t *vcpu_ctxt = &ctxt->context[vcpu];
- unsigned long pde, page;
- unsigned long va = (unsigned long)address;
- void *ptr;
- long pages;
-
- pages = xc_get_tot_pages(xc_handle, ctxt->domid);
-
- if ( ctxt->total_pages != pages )
- {
- if ( ctxt->total_pages > 0 ) free( ctxt->page_array );
- ctxt->total_pages = pages;
-
- ctxt->page_array = malloc(pages * sizeof(unsigned long));
- if ( ctxt->page_array == NULL )
- {
- printf("Could not allocate memory\n");
- return 0;
- }
-
- if ( xc_get_pfn_list(xc_handle, ctxt->domid, ctxt->page_array,pages) !=
- pages )
- {
- printf("Could not get the page frame list\n");
- return 0;
- }
- }
-
- if ( vcpu_ctxt->ctrlreg[3] != ctxt->cr3_phys[vcpu])
- {
- ctxt->cr3_phys[vcpu] = vcpu_ctxt->ctrlreg[3];
- if ( ctxt->cr3_virt[vcpu] )
- munmap(ctxt->cr3_virt[vcpu], PAGE_SIZE);
- ctxt->cr3_virt[vcpu] = xc_map_foreign_range(
- xc_handle, ctxt->domid, PAGE_SIZE, PROT_READ,
- xen_cr3_to_pfn(ctxt->cr3_phys[vcpu]));
- if ( ctxt->cr3_virt[vcpu] == NULL )
- return 0;
- }
-
-
- if ( (pde = ctxt->cr3_virt[vcpu][vtopdi(va)]) == 0) /* logical address */
- return 0;
- if (ctxt->context[vcpu].flags & VGCF_HVM_GUEST)
- pde = ctxt->page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
- if (pde != ctxt->pde_phys[vcpu])
- {
- ctxt->pde_phys[vcpu] = pde;
- if ( ctxt->pde_virt[vcpu])
- munmap(ctxt->pde_virt[vcpu], PAGE_SIZE);
- ctxt->pde_virt[vcpu] = xc_map_foreign_range(xc_handle, ctxt->domid,
- PAGE_SIZE, PROT_READ, ctxt->pde_phys[vcpu] >> PAGE_SHIFT);
- if ( ctxt->pde_virt[vcpu] == NULL )
- return 0;
- }
-
- if ((page = ctxt->pde_virt[vcpu][vtopti(va)]) == 0) /* logical address */
- return 0;
- if (ctxt->context[vcpu].flags & VGCF_HVM_GUEST)
- page = ctxt->page_array[page >> PAGE_SHIFT] << PAGE_SHIFT;
- if (page != ctxt->page_phys[vcpu] || protection != ctxt->page_perm[vcpu])
- {
- ctxt->page_phys[vcpu] = page;
- if (ctxt->page_virt[vcpu])
- munmap(ctxt->page_virt[vcpu], PAGE_SIZE);
- ctxt->page_virt[vcpu] = xc_map_foreign_range(xc_handle, ctxt->domid,
- PAGE_SIZE, protection, ctxt->page_phys[vcpu] >> PAGE_SHIFT);
- if ( ctxt->page_virt[vcpu] == NULL )
- {
- printf("cr3 %lx pde %lx page %lx pti %lx\n",
- vcpu_ctxt->ctrlreg[3], pde, page, vtopti(va));
- ctxt->page_phys[vcpu] = 0;
- return 0;
- }
- ctxt->page_perm[vcpu] = protection;
- }
-
- ptr = (void *)( (unsigned long)ctxt->page_virt[vcpu] |
- (va & ~PAGE_MASK) );
-
- if ( protection & PROT_WRITE )
- {
- memcpy(ptr, buffer, length);
- }
- else
- {
- memcpy(buffer, ptr, length);
- }
-
- return length;
-}
-
-/* divide a memory operation into accesses to individual pages */
-static int
-xendebug_memory_op (domain_context_p ctxt, int xc_handle, uint32_t vcpu,
- int protection, unsigned long address, int length, uint8_t *buffer)
-{
- int remain; /* number of bytes to touch past this page */
- int bytes = 0;
-
- while ( (remain = (address + length - 1) - (address | (PAGE_SIZE-1))) > 0)
- {
- bytes += xendebug_memory_page(ctxt, xc_handle, vcpu, protection,
- address, length - remain, buffer);
- buffer += (length - remain);
- length = remain;
- address = (address | (PAGE_SIZE - 1)) + 1;
- }
-
- bytes += xendebug_memory_page(ctxt, xc_handle, vcpu, protection,
- address, length, buffer);
-
- return bytes;
-}
-
-int
-xendebug_read_memory(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length,
- uint8_t *data)
-{
- domain_context_p ctxt;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
-
- xendebug_memory_op(ctxt, xc_handle, vcpu, PROT_READ,
- address, length, data);
-
- return 0;
-}
-
-int
-xendebug_write_memory(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length,
- uint8_t *data)
-{
- domain_context_p ctxt;
-
- xendebug_initialize();
-
- ctxt = xendebug_get_context(xc_handle, domid, vcpu);
- xendebug_memory_op(ctxt, xc_handle, vcpu, PROT_READ | PROT_WRITE,
-
- address, length, data);
-
- return 0;
-}
-
-int
-xendebug_insert_memory_breakpoint(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length)
-{
- bwcpoint_p bkpt;
- uint8_t breakpoint_opcode = 0xcc;
-
- printf("insert breakpoint %d:%lx %d\n",
- domid, address, length);
-
- xendebug_initialize();
-
- bkpt = malloc(sizeof(bwcpoint_t));
- if ( bkpt == NULL )
- {
- printf("error: breakpoint length should be 1\n");
- return -1;
- }
-
- if ( length != 1 )
- {
- printf("error: breakpoint length should be 1\n");
- free(bkpt);
- return -1;
- }
-
- bkpt->address = address;
- bkpt->domain = domid;
-
- xendebug_read_memory(xc_handle, domid, vcpu, address, 1,
- &bkpt->old_value);
-
- xendebug_write_memory(xc_handle, domid, vcpu, address, 1,
- &breakpoint_opcode);
-
- list_add(&bkpt->list, &bwcpoint_list.list);
-
- printf("breakpoint_set %d:%lx 0x%x\n",
- domid, address, bkpt->old_value);
-
- return 0;
-}
-
-int
-xendebug_remove_memory_breakpoint(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length)
-{
- bwcpoint_p bkpt = NULL;
-
- printf ("remove breakpoint %d:%lx\n",
- domid, address);
-
- struct list_head *entry;
- list_for_each(entry, &bwcpoint_list.list)
- {
- bkpt = list_entry(entry, bwcpoint_t, list);
- if ( domid == bkpt->domain && address == bkpt->address )
- break;
- }
-
- if (bkpt == &bwcpoint_list || bkpt == NULL)
- {
- printf ("error: no breakpoint found\n");
- return -1;
- }
-
- list_del(&bkpt->list);
-
- xendebug_write_memory(xc_handle, domid, vcpu, address, 1,
- &bkpt->old_value);
-
- free(bkpt);
- return 0;
-}
-
-int
-xendebug_query_domain_stop(int xc_handle, int *dom_list, int dom_list_size)
-{
- xc_dominfo_t *info;
- uint32_t first_dom = 0;
- int max_doms = 1024;
- int nr_doms, loop;
- int count = 0;
-
- if ( (info = malloc(max_doms * sizeof(xc_dominfo_t))) == NULL )
- return -ENOMEM;
-
- nr_doms = xc_domain_getinfo(xc_handle, first_dom, max_doms, info);
-
- for (loop = 0; loop < nr_doms; loop++)
- {
- printf ("domid: %d", info[loop].domid);
- printf (" %c%c%c%c%c%c",
- info[loop].dying ? 'D' : '-',
- info[loop].crashed ? 'C' : '-',
- info[loop].shutdown ? 'S' : '-',
- info[loop].paused ? 'P' : '-',
- info[loop].blocked ? 'B' : '-',
- info[loop].running ? 'R' : '-');
- printf (" pages: %ld, vcpus %d",
- info[loop].nr_pages, info[loop].vcpus);
- printf ("\n");
-
- if ( info[loop].paused && count < dom_list_size)
- {
- dom_list[count++] = info[loop].domid;
- }
- }
-
- free(info);
-
- return count;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/tools/debugger/libxendebug/xendebug.h b/tools/debugger/libxendebug/xendebug.h
deleted file mode 100644
index dfd2c3e2d3..0000000000
--- a/tools/debugger/libxendebug/xendebug.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * xendebug.h
- *
- * alex ho
- * http://www.cl.cam.ac.uk/netos/pdb
- *
- */
-
-#ifndef _XENDEBUG_H_DEFINED
-#define _XENDEBUG_H_DEFINED
-
-#include <xenctrl.h>
-
-int xendebug_attach(int xc_handle,
- uint32_t domid,
- uint32_t vcpu);
-
-int xendebug_detach(int xc_handle,
- uint32_t domid,
- uint32_t vcpu);
-
-int xendebug_read_registers(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- cpu_user_regs_t **regs);
-
-int xendebug_read_fpregisters (int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- char **regs);
-
-int xendebug_write_registers(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- cpu_user_regs_t *regs);
-
-int xendebug_step(int xc_handle,
- uint32_t domid,
- uint32_t vcpu);
-
-int xendebug_continue(int xc_handle,
- uint32_t domid,
- uint32_t vcpu);
-
-int xendebug_read_memory(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length,
- uint8_t *data);
-
-
-int xendebug_write_memory(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length,
- uint8_t *data);
-
-
-int xendebug_insert_memory_breakpoint(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length);
-
-int xendebug_remove_memory_breakpoint(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- unsigned long address,
- uint32_t length);
-
-int xendebug_query_domain_stop(int xc_handle,
- int *dom_list,
- int dom_list_size);
-
-
-#endif /* _XENDEBUG_H_DEFINED */
diff --git a/tools/libxc/ia64/xc_ia64_hvm_build.c b/tools/libxc/ia64/xc_ia64_hvm_build.c
index ededfe6e5d..b400162192 100644
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c
@@ -555,7 +555,7 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
shared_iopage_t *sp;
int i;
unsigned long dom_memsize = (memsize << 20);
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
if ((image_size > 12 * MEM_M) || (image_size & (PAGE_SIZE - 1))) {
PERROR("Guest firmware size is incorrect [%ld]?", image_size);
@@ -563,13 +563,12 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
}
/* This will creates the physmap. */
- op.u.domain_setup.flags = XEN_DOMAINSETUP_hvm_guest;
- op.u.domain_setup.domain = (domid_t)dom;
- op.u.domain_setup.bp = 0;
- op.u.domain_setup.maxmem = 0;
-
- op.cmd = DOM0_DOMAIN_SETUP;
- if (xc_dom0_op(xc_handle, &op))
+ domctl.u.arch_setup.flags = XEN_DOMAINSETUP_hvm_guest;
+ domctl.u.arch_setup.bp = 0;
+ domctl.u.arch_setup.maxmem = 0;
+ domctl.cmd = XEN_DOMCTL_arch_setup;
+ domctl.domain = (domid_t)dom;
+ if (xc_domctl(xc_handle, &domctl))
goto error_out;
/* Load guest firmware */
@@ -631,7 +630,7 @@ xc_hvm_build(int xc_handle, uint32_t domid, int memsize,
unsigned int acpi, unsigned int apic, unsigned int store_evtchn,
unsigned long *store_mfn)
{
- dom0_op_t launch_op, op;
+ struct xen_domctl launch_domctl, domctl;
int rc;
vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
char *image = NULL;
@@ -657,10 +656,10 @@ xc_hvm_build(int xc_handle, uint32_t domid, int memsize,
return 1;
}
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)domid;
- if (do_dom0_op(xc_handle, &op) < 0 ||
- (uint16_t)op.u.getdomaininfo.domain != domid) {
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)domid;
+ if (do_domctl(xc_handle, &domctl) < 0 ||
+ (uint16_t)domctl.domain != domid) {
PERROR("Could not get info on domain");
goto error_out;
}
@@ -677,14 +676,14 @@ xc_hvm_build(int xc_handle, uint32_t domid, int memsize,
ctxt->user_regs.cr_iip = 0x80000000ffffffb0UL;
- memset(&launch_op, 0, sizeof(launch_op));
+ memset(&launch_domctl, 0, sizeof(launch_domctl));
- launch_op.u.setvcpucontext.domain = (domid_t)domid;
- launch_op.u.setvcpucontext.vcpu = 0;
- set_xen_guest_handle(launch_op.u.setvcpucontext.ctxt, ctxt);
+ launch_domctl.domain = (domid_t)domid;
+ launch_domctl.u.vcpucontext.vcpu = 0;
+ set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
- launch_op.cmd = DOM0_SETVCPUCONTEXT;
- rc = do_dom0_op(xc_handle, &launch_op);
+ launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ rc = do_domctl(xc_handle, &launch_domctl);
return rc;
error_out:
diff --git a/tools/libxc/ia64/xc_ia64_linux_restore.c b/tools/libxc/ia64/xc_ia64_linux_restore.c
index 36e075ea8a..ef8476126b 100644
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c
@@ -61,7 +61,7 @@ xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
unsigned long *store_mfn, unsigned int console_evtchn,
unsigned long *console_mfn)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int rc = 1, i;
unsigned long mfn, pfn;
unsigned long ver;
@@ -94,19 +94,19 @@ xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
}
if (mlock(&ctxt, sizeof(ctxt))) {
- /* needed for build dom0 op, but might as well do early */
+ /* needed for build domctl, but might as well do early */
ERR("Unable to mlock ctxt");
return 1;
}
/* Get the domain's shared-info frame. */
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)dom;
- if (xc_dom0_op(xc_handle, &op) < 0) {
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)dom;
+ if (xc_domctl(xc_handle, &domctl) < 0) {
ERR("Could not get information on new domain");
goto out;
}
- shared_info_frame = op.u.getdomaininfo.shared_info_frame;
+ shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
if (xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
errno = ENOMEM;
@@ -122,20 +122,20 @@ xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
DPRINTF("Increased domain reservation by %ld KB\n", PFN_TO_KB(max_pfn));
- if (!read_exact(io_fd, &op.u.domain_setup, sizeof(op.u.domain_setup))) {
+ if (!read_exact(io_fd, &domctl.u.arch_setup, sizeof(domctl.u.arch_setup))) {
ERR("read: domain setup");
goto out;
}
/* Build firmware (will be overwritten). */
- op.u.domain_setup.domain = (domid_t)dom;
- op.u.domain_setup.flags &= ~XEN_DOMAINSETUP_query;
- op.u.domain_setup.bp = ((nr_pfns - 3) << PAGE_SHIFT)
+ domctl.domain = (domid_t)dom;
+ domctl.u.arch_setup.flags &= ~XEN_DOMAINSETUP_query;
+ domctl.u.arch_setup.bp = ((nr_pfns - 3) << PAGE_SHIFT)
+ sizeof (start_info_t);
- op.u.domain_setup.maxmem = (nr_pfns - 3) << PAGE_SHIFT;
+ domctl.u.arch_setup.maxmem = (nr_pfns - 3) << PAGE_SHIFT;
- op.cmd = DOM0_DOMAIN_SETUP;
- if (xc_dom0_op(xc_handle, &op))
+ domctl.cmd = XEN_DOMCTL_arch_setup;
+ if (xc_domctl(xc_handle, &domctl))
goto out;
/* Get pages. */
@@ -226,22 +226,22 @@ xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
}
/* First to initialize. */
- op.cmd = DOM0_SETVCPUCONTEXT;
- op.u.setvcpucontext.domain = (domid_t)dom;
- op.u.setvcpucontext.vcpu = 0;
- set_xen_guest_handle(op.u.setvcpucontext.ctxt, &ctxt);
- if (xc_dom0_op(xc_handle, &op) != 0) {
+ domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ domctl.domain = (domid_t)dom;
+ domctl.u.vcpucontext.vcpu = 0;
+ set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
+ if (xc_domctl(xc_handle, &domctl) != 0) {
ERR("Couldn't set vcpu context");
goto out;
}
/* Second to set registers... */
ctxt.flags = VGCF_EXTRA_REGS;
- op.cmd = DOM0_SETVCPUCONTEXT;
- op.u.setvcpucontext.domain = (domid_t)dom;
- op.u.setvcpucontext.vcpu = 0;
- set_xen_guest_handle(op.u.setvcpucontext.ctxt, &ctxt);
- if (xc_dom0_op(xc_handle, &op) != 0) {
+ domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ domctl.domain = (domid_t)dom;
+ domctl.u.vcpucontext.vcpu = 0;
+ set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
+ if (xc_domctl(xc_handle, &domctl) != 0) {
ERR("Couldn't set vcpu context");
goto out;
}
diff --git a/tools/libxc/ia64/xc_ia64_linux_save.c b/tools/libxc/ia64/xc_ia64_linux_save.c
index 72183f1383..50f09773e0 100644
--- a/tools/libxc/ia64/xc_ia64_linux_save.c
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c
@@ -60,7 +60,7 @@ static int xc_ia64_shadow_control(int xc_handle,
unsigned int sop,
unsigned long *dirty_bitmap,
unsigned long pages,
- xc_shadow_control_stats_t *stats)
+ xc_shadow_op_stats_t *stats)
{
if (dirty_bitmap != NULL && pages > 0) {
int i;
@@ -137,7 +137,7 @@ int
xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags, int (*suspend)(int))
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
xc_dominfo_t info;
int rc = 1;
@@ -242,15 +242,15 @@ xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
}
}
- op.cmd = DOM0_DOMAIN_SETUP;
- op.u.domain_setup.domain = (domid_t)dom;
- op.u.domain_setup.flags = XEN_DOMAINSETUP_query;
- if (xc_dom0_op(xc_handle, &op) < 0) {
+ domctl.cmd = XEN_DOMCTL_arch_setup;
+ domctl.domain = (domid_t)dom;
+ domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query;
+ if (xc_domctl(xc_handle, &domctl) < 0) {
ERR("Could not get domain setup");
goto out;
}
- op.u.domain_setup.domain = 0;
- if (!write_exact(io_fd, &op.u.domain_setup, sizeof(op.u.domain_setup))) {
+ if (!write_exact(io_fd, &domctl.u.arch_setup,
+ sizeof(domctl.u.arch_setup))) {
ERR("write: domain setup");
goto out;
}
@@ -259,7 +259,7 @@ xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
if (live) {
if (xc_ia64_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY,
+ XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
NULL, 0, NULL ) < 0) {
ERR("Couldn't enable shadow mode");
goto out;
@@ -324,7 +324,7 @@ xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
but this is fast enough for the moment. */
if (!last_iter) {
if (xc_ia64_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_PEEK,
+ XEN_DOMCTL_SHADOW_OP_PEEK,
to_skip, max_pfn, NULL) != max_pfn) {
ERR("Error peeking shadow bitmap");
goto out;
@@ -392,7 +392,7 @@ xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
/* Pages to be sent are pages which were dirty. */
if (xc_ia64_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_CLEAN,
+ XEN_DOMCTL_SHADOW_OP_CLEAN,
to_send, max_pfn, NULL ) != max_pfn) {
ERR("Error flushing shadow PT");
goto out;
@@ -481,7 +481,7 @@ xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
out:
if (live) {
- if (xc_ia64_shadow_control(xc_handle, dom, DOM0_SHADOW_CONTROL_OP_OFF,
+ if (xc_ia64_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF,
NULL, 0, NULL ) < 0) {
DPRINTF("Warning - couldn't disable shadow mode");
}
diff --git a/tools/libxc/ia64/xc_ia64_stubs.c b/tools/libxc/ia64/xc_ia64_stubs.c
index 85f5d732fa..6b3639ff52 100644
--- a/tools/libxc/ia64/xc_ia64_stubs.c
+++ b/tools/libxc/ia64/xc_ia64_stubs.c
@@ -33,7 +33,7 @@ int
xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
unsigned int start_page, unsigned int nr_pages)
{
- dom0_op_t op;
+ struct xen_domctl domctl;
int num_pfns,ret;
unsigned int __start_page, __nr_pages;
unsigned long max_pfns;
@@ -45,11 +45,11 @@ xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
while (__nr_pages) {
max_pfns = ((unsigned long)__start_page << 32) | __nr_pages;
- op.cmd = DOM0_GETMEMLIST;
- op.u.getmemlist.domain = (domid_t)domid;
- op.u.getmemlist.max_pfns = max_pfns;
- op.u.getmemlist.num_pfns = 0;
- set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
+ domctl.cmd = XEN_DOMCTL_getmemlist;
+ domctl.domain = (domid_t)domid;
+ domctl.u.getmemlist.max_pfns = max_pfns;
+ domctl.u.getmemlist.num_pfns = 0;
+ set_xen_guest_handle(domctl.u.getmemlist.buffer, __pfn_buf);
if ((max_pfns != -1UL)
&& mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
@@ -57,7 +57,7 @@ xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
return -1;
}
- ret = do_dom0_op(xc_handle, &op);
+ ret = do_domctl(xc_handle, &domctl);
if (max_pfns != -1UL)
(void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
@@ -65,7 +65,7 @@ xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
if (max_pfns == -1UL)
return 0;
- num_pfns = op.u.getmemlist.num_pfns;
+ num_pfns = domctl.u.getmemlist.num_pfns;
__start_page += num_pfns;
__nr_pages -= num_pfns;
__pfn_buf += num_pfns;
@@ -89,10 +89,10 @@ xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
long
xc_get_max_pages(int xc_handle, uint32_t domid)
{
- dom0_op_t op;
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)domid;
- return (do_dom0_op(xc_handle, &op) < 0) ? -1 : op.u.getdomaininfo.max_pages;
+ struct xen_domctl domctl;
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)domid;
+ return (do_domctl(xc_handle, &domctl) < 0) ? -1 : domctl.u.getdomaininfo.max_pages;
}
/*
diff --git a/tools/libxc/powerpc64/xc_linux_build.c b/tools/libxc/powerpc64/xc_linux_build.c
index df3da87aef..2624ed400f 100644
--- a/tools/libxc/powerpc64/xc_linux_build.c
+++ b/tools/libxc/powerpc64/xc_linux_build.c
@@ -27,7 +27,6 @@
#include <sys/types.h>
#include <inttypes.h>
-#include <xen/dom0_ops.h>
#include <xen/memory.h>
#include <xc_private.h>
#include <xg_private.h>
diff --git a/tools/libxc/xc_csched.c b/tools/libxc/xc_csched.c
index 944529fea0..4ea986fae2 100644
--- a/tools/libxc/xc_csched.c
+++ b/tools/libxc/xc_csched.c
@@ -15,36 +15,36 @@ int
xc_sched_credit_domain_set(
int xc_handle,
uint32_t domid,
- struct sched_credit_adjdom *sdom)
+ struct xen_domctl_sched_credit *sdom)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_ADJUSTDOM;
- op.u.adjustdom.domain = (domid_t) domid;
- op.u.adjustdom.sched_id = SCHED_CREDIT;
- op.u.adjustdom.direction = SCHED_INFO_PUT;
- op.u.adjustdom.u.credit = *sdom;
+ domctl.cmd = XEN_DOMCTL_scheduler_op;
+ domctl.domain = (domid_t) domid;
+ domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+ domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
+ domctl.u.scheduler_op.u.credit = *sdom;
- return do_dom0_op(xc_handle, &op);
+ return do_domctl(xc_handle, &domctl);
}
int
xc_sched_credit_domain_get(
int xc_handle,
uint32_t domid,
- struct sched_credit_adjdom *sdom)
+ struct xen_domctl_sched_credit *sdom)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int err;
- op.cmd = DOM0_ADJUSTDOM;
- op.u.adjustdom.domain = (domid_t) domid;
- op.u.adjustdom.sched_id = SCHED_CREDIT;
- op.u.adjustdom.direction = SCHED_INFO_GET;
+ domctl.cmd = XEN_DOMCTL_scheduler_op;
+ domctl.domain = (domid_t) domid;
+ domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+ domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
- err = do_dom0_op(xc_handle, &op);
+ err = do_domctl(xc_handle, &domctl);
if ( err == 0 )
- *sdom = op.u.adjustdom.u.credit;
+ *sdom = domctl.u.scheduler_op.u.credit;
return err;
}
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index f182f43a43..20b0c764c3 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -15,16 +15,16 @@ int xc_domain_create(int xc_handle,
uint32_t *pdomid)
{
int err;
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_CREATEDOMAIN;
- op.u.createdomain.domain = (domid_t)*pdomid;
- op.u.createdomain.ssidref = ssidref;
- memcpy(op.u.createdomain.handle, handle, sizeof(xen_domain_handle_t));
- if ( (err = do_dom0_op(xc_handle, &op)) != 0 )
+ domctl.cmd = XEN_DOMCTL_createdomain;
+ domctl.domain = (domid_t)*pdomid;
+ domctl.u.createdomain.ssidref = ssidref;
+ memcpy(domctl.u.createdomain.handle, handle, sizeof(xen_domain_handle_t));
+ if ( (err = do_domctl(xc_handle, &domctl)) != 0 )
return err;
- *pdomid = (uint16_t)op.u.createdomain.domain;
+ *pdomid = (uint16_t)domctl.domain;
return 0;
}
@@ -32,30 +32,30 @@ int xc_domain_create(int xc_handle,
int xc_domain_pause(int xc_handle,
uint32_t domid)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_PAUSEDOMAIN;
- op.u.pausedomain.domain = (domid_t)domid;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_pausedomain;
+ domctl.domain = (domid_t)domid;
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_unpause(int xc_handle,
uint32_t domid)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_UNPAUSEDOMAIN;
- op.u.unpausedomain.domain = (domid_t)domid;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_unpausedomain;
+ domctl.domain = (domid_t)domid;
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_destroy(int xc_handle,
uint32_t domid)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_DESTROYDOMAIN;
- op.u.destroydomain.domain = (domid_t)domid;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_destroydomain;
+ domctl.domain = (domid_t)domid;
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_shutdown(int xc_handle,
@@ -90,14 +90,62 @@ int xc_domain_shutdown(int xc_handle,
int xc_vcpu_setaffinity(int xc_handle,
uint32_t domid,
int vcpu,
- cpumap_t cpumap)
+ uint64_t cpumap)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_SETVCPUAFFINITY;
- op.u.setvcpuaffinity.domain = (domid_t)domid;
- op.u.setvcpuaffinity.vcpu = vcpu;
- op.u.setvcpuaffinity.cpumap = cpumap;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ int ret = -1;
+
+ domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
+ domctl.domain = (domid_t)domid;
+ domctl.u.vcpuaffinity.vcpu = vcpu;
+
+ set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
+ (uint8_t *)&cpumap);
+ domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
+
+ if ( mlock(&cpumap, sizeof(cpumap)) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ goto out;
+ }
+
+ ret = do_domctl(xc_handle, &domctl);
+
+ safe_munlock(&cpumap, sizeof(cpumap));
+
+ out:
+ return ret;
+}
+
+
+int xc_vcpu_getaffinity(int xc_handle,
+ uint32_t domid,
+ int vcpu,
+ uint64_t *cpumap)
+{
+ DECLARE_DOMCTL;
+ int ret = -1;
+
+ domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
+ domctl.domain = (domid_t)domid;
+ domctl.u.vcpuaffinity.vcpu = vcpu;
+
+ set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
+ (uint8_t *)cpumap);
+ domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
+
+ if ( mlock(cpumap, sizeof(*cpumap)) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ goto out;
+ }
+
+ ret = do_domctl(xc_handle, &domctl);
+
+ safe_munlock(cpumap, sizeof(*cpumap));
+
+ out:
+ return ret;
}
@@ -108,27 +156,27 @@ int xc_domain_getinfo(int xc_handle,
{
unsigned int nr_doms;
uint32_t next_domid = first_domid;
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int rc = 0;
memset(info, 0, max_doms*sizeof(xc_dominfo_t));
for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
{
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)next_domid;
- if ( (rc = do_dom0_op(xc_handle, &op)) < 0 )
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)next_domid;
+ if ( (rc = do_domctl(xc_handle, &domctl)) < 0 )
break;
- info->domid = (uint16_t)op.u.getdomaininfo.domain;
+ info->domid = (uint16_t)domctl.domain;
- info->dying = !!(op.u.getdomaininfo.flags & DOMFLAGS_DYING);
- info->shutdown = !!(op.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
- info->paused = !!(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
- info->blocked = !!(op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
- info->running = !!(op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
+ info->dying = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_DYING);
+ info->shutdown = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
+ info->paused = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
+ info->blocked = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
+ info->running = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
info->shutdown_reason =
- (op.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) &
+ (domctl.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) &
DOMFLAGS_SHUTDOWNMASK;
if ( info->shutdown && (info->shutdown_reason == SHUTDOWN_crash) )
@@ -137,18 +185,18 @@ int xc_domain_getinfo(int xc_handle,
info->crashed = 1;
}
- info->ssidref = op.u.getdomaininfo.ssidref;
- info->nr_pages = op.u.getdomaininfo.tot_pages;
- info->max_memkb = op.u.getdomaininfo.max_pages << (PAGE_SHIFT - 10);
- info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
- info->cpu_time = op.u.getdomaininfo.cpu_time;
- info->nr_online_vcpus = op.u.getdomaininfo.nr_online_vcpus;
- info->max_vcpu_id = op.u.getdomaininfo.max_vcpu_id;
+ info->ssidref = domctl.u.getdomaininfo.ssidref;
+ info->nr_pages = domctl.u.getdomaininfo.tot_pages;
+ info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10);
+ info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
+ info->cpu_time = domctl.u.getdomaininfo.cpu_time;
+ info->nr_online_vcpus = domctl.u.getdomaininfo.nr_online_vcpus;
+ info->max_vcpu_id = domctl.u.getdomaininfo.max_vcpu_id;
- memcpy(info->handle, op.u.getdomaininfo.handle,
+ memcpy(info->handle, domctl.u.getdomaininfo.handle,
sizeof(xen_domain_handle_t));
- next_domid = (uint16_t)op.u.getdomaininfo.domain + 1;
+ next_domid = (uint16_t)domctl.domain + 1;
info++;
}
@@ -163,20 +211,20 @@ int xc_domain_getinfolist(int xc_handle,
xc_domaininfo_t *info)
{
int ret = 0;
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
return -1;
- op.cmd = DOM0_GETDOMAININFOLIST;
- op.u.getdomaininfolist.first_domain = first_domain;
- op.u.getdomaininfolist.max_domains = max_domains;
- set_xen_guest_handle(op.u.getdomaininfolist.buffer, info);
+ sysctl.cmd = XEN_SYSCTL_getdomaininfolist;
+ sysctl.u.getdomaininfolist.first_domain = first_domain;
+ sysctl.u.getdomaininfolist.max_domains = max_domains;
+ set_xen_guest_handle(sysctl.u.getdomaininfolist.buffer, info);
- if ( xc_dom0_op(xc_handle, &op) < 0 )
+ if ( xc_sysctl(xc_handle, &sysctl) < 0 )
ret = -1;
else
- ret = op.u.getdomaininfolist.num_domains;
+ ret = sysctl.u.getdomaininfolist.num_domains;
if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
ret = -1;
@@ -190,17 +238,17 @@ int xc_vcpu_getcontext(int xc_handle,
vcpu_guest_context_t *ctxt)
{
int rc;
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_GETVCPUCONTEXT;
- op.u.getvcpucontext.domain = (domid_t)domid;
- op.u.getvcpucontext.vcpu = (uint16_t)vcpu;
- set_xen_guest_handle(op.u.getvcpucontext.ctxt, ctxt);
+ domctl.cmd = XEN_DOMCTL_getvcpucontext;
+ domctl.domain = (domid_t)domid;
+ domctl.u.vcpucontext.vcpu = (uint16_t)vcpu;
+ set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
return rc;
- rc = do_dom0_op(xc_handle, &op);
+ rc = do_domctl(xc_handle, &domctl);
safe_munlock(ctxt, sizeof(*ctxt));
@@ -215,28 +263,28 @@ int xc_shadow_control(int xc_handle,
unsigned long pages,
unsigned long *mb,
uint32_t mode,
- xc_shadow_control_stats_t *stats)
+ xc_shadow_op_stats_t *stats)
{
int rc;
- DECLARE_DOM0_OP;
- op.cmd = DOM0_SHADOW_CONTROL;
- op.u.shadow_control.domain = (domid_t)domid;
- op.u.shadow_control.op = sop;
- op.u.shadow_control.pages = pages;
- op.u.shadow_control.mb = mb ? *mb : 0;
- op.u.shadow_control.mode = mode;
- set_xen_guest_handle(op.u.shadow_control.dirty_bitmap, dirty_bitmap);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_shadow_op;
+ domctl.domain = (domid_t)domid;
+ domctl.u.shadow_op.op = sop;
+ domctl.u.shadow_op.pages = pages;
+ domctl.u.shadow_op.mb = mb ? *mb : 0;
+ domctl.u.shadow_op.mode = mode;
+ set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap, dirty_bitmap);
- rc = do_dom0_op(xc_handle, &op);
+ rc = do_domctl(xc_handle, &domctl);
if ( stats )
- memcpy(stats, &op.u.shadow_control.stats,
- sizeof(xc_shadow_control_stats_t));
+ memcpy(stats, &domctl.u.shadow_op.stats,
+ sizeof(xc_shadow_op_stats_t));
if ( mb )
- *mb = op.u.shadow_control.mb;
+ *mb = domctl.u.shadow_op.mb;
- return (rc == 0) ? op.u.shadow_control.pages : rc;
+ return (rc == 0) ? domctl.u.shadow_op.pages : rc;
}
int xc_domain_setcpuweight(int xc_handle,
@@ -258,22 +306,22 @@ int xc_domain_setmaxmem(int xc_handle,
uint32_t domid,
unsigned int max_memkb)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_SETDOMAINMAXMEM;
- op.u.setdomainmaxmem.domain = (domid_t)domid;
- op.u.setdomainmaxmem.max_memkb = max_memkb;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_max_mem;
+ domctl.domain = (domid_t)domid;
+ domctl.u.max_mem.max_memkb = max_memkb;
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_set_time_offset(int xc_handle,
uint32_t domid,
int32_t time_offset_seconds)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_SETTIMEOFFSET;
- op.u.settimeoffset.domain = (domid_t)domid;
- op.u.settimeoffset.time_offset_seconds = time_offset_seconds;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_settimeoffset;
+ domctl.domain = (domid_t)domid;
+ domctl.u.settimeoffset.time_offset_seconds = time_offset_seconds;
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_memory_increase_reservation(int xc_handle,
@@ -397,21 +445,22 @@ int xc_domain_translate_gpfn_list(int xc_handle,
int xc_domain_max_vcpus(int xc_handle, uint32_t domid, unsigned int max)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_MAX_VCPUS;
- op.u.max_vcpus.domain = (domid_t)domid;
- op.u.max_vcpus.max = max;
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_max_vcpus;
+ domctl.domain = (domid_t)domid;
+ domctl.u.max_vcpus.max = max;
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_sethandle(int xc_handle, uint32_t domid,
xen_domain_handle_t handle)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_SETDOMAINHANDLE;
- op.u.setdomainhandle.domain = (domid_t)domid;
- memcpy(op.u.setdomainhandle.handle, handle, sizeof(xen_domain_handle_t));
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_setdomainhandle;
+ domctl.domain = (domid_t)domid;
+ memcpy(domctl.u.setdomainhandle.handle, handle,
+ sizeof(xen_domain_handle_t));
+ return do_domctl(xc_handle, &domctl);
}
int xc_vcpu_getinfo(int xc_handle,
@@ -420,14 +469,15 @@ int xc_vcpu_getinfo(int xc_handle,
xc_vcpuinfo_t *info)
{
int rc;
- DECLARE_DOM0_OP;
- op.cmd = DOM0_GETVCPUINFO;
- op.u.getvcpuinfo.domain = (domid_t)domid;
- op.u.getvcpuinfo.vcpu = (uint16_t)vcpu;
+ DECLARE_DOMCTL;
+
+ domctl.cmd = XEN_DOMCTL_getvcpuinfo;
+ domctl.domain = (domid_t)domid;
+ domctl.u.getvcpuinfo.vcpu = (uint16_t)vcpu;
- rc = do_dom0_op(xc_handle, &op);
+ rc = do_domctl(xc_handle, &domctl);
- memcpy(info, &op.u.getvcpuinfo, sizeof(*info));
+ memcpy(info, &domctl.u.getvcpuinfo, sizeof(*info));
return rc;
}
@@ -438,15 +488,15 @@ int xc_domain_ioport_permission(int xc_handle,
uint32_t nr_ports,
uint32_t allow_access)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_IOPORT_PERMISSION;
- op.u.ioport_permission.domain = (domid_t)domid;
- op.u.ioport_permission.first_port = first_port;
- op.u.ioport_permission.nr_ports = nr_ports;
- op.u.ioport_permission.allow_access = allow_access;
+ domctl.cmd = XEN_DOMCTL_ioport_permission;
+ domctl.domain = (domid_t)domid;
+ domctl.u.ioport_permission.first_port = first_port;
+ domctl.u.ioport_permission.nr_ports = nr_ports;
+ domctl.u.ioport_permission.allow_access = allow_access;
- return do_dom0_op(xc_handle, &op);
+ return do_domctl(xc_handle, &domctl);
}
int xc_vcpu_setcontext(int xc_handle,
@@ -454,18 +504,18 @@ int xc_vcpu_setcontext(int xc_handle,
uint32_t vcpu,
vcpu_guest_context_t *ctxt)
{
- dom0_op_t op;
+ DECLARE_DOMCTL;
int rc;
- op.cmd = DOM0_SETVCPUCONTEXT;
- op.u.setvcpucontext.domain = domid;
- op.u.setvcpucontext.vcpu = vcpu;
- set_xen_guest_handle(op.u.setvcpucontext.ctxt, ctxt);
+ domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ domctl.domain = domid;
+ domctl.u.vcpucontext.vcpu = vcpu;
+ set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
return rc;
- rc = do_dom0_op(xc_handle, &op);
+ rc = do_domctl(xc_handle, &domctl);
safe_munlock(ctxt, sizeof(*ctxt));
@@ -478,14 +528,14 @@ int xc_domain_irq_permission(int xc_handle,
uint8_t pirq,
uint8_t allow_access)
{
- dom0_op_t op;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_IRQ_PERMISSION;
- op.u.irq_permission.domain = domid;
- op.u.irq_permission.pirq = pirq;
- op.u.irq_permission.allow_access = allow_access;
+ domctl.cmd = XEN_DOMCTL_irq_permission;
+ domctl.domain = domid;
+ domctl.u.irq_permission.pirq = pirq;
+ domctl.u.irq_permission.allow_access = allow_access;
- return do_dom0_op(xc_handle, &op);
+ return do_domctl(xc_handle, &domctl);
}
int xc_domain_iomem_permission(int xc_handle,
@@ -494,15 +544,15 @@ int xc_domain_iomem_permission(int xc_handle,
unsigned long nr_mfns,
uint8_t allow_access)
{
- dom0_op_t op;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_IOMEM_PERMISSION;
- op.u.iomem_permission.domain = domid;
- op.u.iomem_permission.first_mfn = first_mfn;
- op.u.iomem_permission.nr_mfns = nr_mfns;
- op.u.iomem_permission.allow_access = allow_access;
+ domctl.cmd = XEN_DOMCTL_iomem_permission;
+ domctl.domain = domid;
+ domctl.u.iomem_permission.first_mfn = first_mfn;
+ domctl.u.iomem_permission.nr_mfns = nr_mfns;
+ domctl.u.iomem_permission.allow_access = allow_access;
- return do_dom0_op(xc_handle, &op);
+ return do_domctl(xc_handle, &domctl);
}
/*
diff --git a/tools/libxc/xc_hvm_build.c b/tools/libxc/xc_hvm_build.c
index 98cb5ebd68..c39ffa323f 100644
--- a/tools/libxc/xc_hvm_build.c
+++ b/tools/libxc/xc_hvm_build.c
@@ -395,7 +395,7 @@ static int xc_hvm_build_internal(int xc_handle,
unsigned int store_evtchn,
unsigned long *store_mfn)
{
- dom0_op_t launch_op, op;
+ struct xen_domctl launch_domctl, domctl;
int rc, i;
vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
unsigned long nr_pages;
@@ -432,21 +432,21 @@ static int xc_hvm_build_internal(int xc_handle,
return 1;
}
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)domid;
- if ( (xc_dom0_op(xc_handle, &op) < 0) ||
- ((uint16_t)op.u.getdomaininfo.domain != domid) )
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)domid;
+ if ( (xc_domctl(xc_handle, &domctl) < 0) ||
+ ((uint16_t)domctl.domain != domid) )
{
PERROR("Could not get info on domain");
goto error_out;
}
/* HVM domains must be put into shadow2 mode at the start of day */
- if ( xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_ENABLE,
+ if ( xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_ENABLE,
NULL, 0, NULL,
- DOM0_SHADOW_ENABLE_REFCOUNT |
- DOM0_SHADOW_ENABLE_TRANSLATE |
- DOM0_SHADOW_ENABLE_EXTERNAL,
+ XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT |
+ XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE |
+ XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL,
NULL) )
{
PERROR("Could not enable shadow paging for domain.\n");
@@ -457,7 +457,7 @@ static int xc_hvm_build_internal(int xc_handle,
ctxt->flags = VGCF_HVM_GUEST;
if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages,
- ctxt, op.u.getdomaininfo.shared_info_frame,
+ ctxt, domctl.u.getdomaininfo.shared_info_frame,
vcpus, pae, acpi, apic, store_evtchn, store_mfn) < 0)
{
ERROR("Error constructing guest OS");
@@ -495,14 +495,14 @@ static int xc_hvm_build_internal(int xc_handle,
ctxt->syscall_callback_eip = 0;
#endif
- memset( &launch_op, 0, sizeof(launch_op) );
+ memset(&launch_domctl, 0, sizeof(launch_domctl));
- launch_op.u.setvcpucontext.domain = (domid_t)domid;
- launch_op.u.setvcpucontext.vcpu = 0;
- set_xen_guest_handle(launch_op.u.setvcpucontext.ctxt, ctxt);
+ launch_domctl.domain = (domid_t)domid;
+ launch_domctl.u.vcpucontext.vcpu = 0;
+ set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
- launch_op.cmd = DOM0_SETVCPUCONTEXT;
- rc = xc_dom0_op(xc_handle, &launch_op);
+ launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ rc = xc_domctl(xc_handle, &launch_domctl);
return rc;
diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c
index d9802b640c..98c84da3b2 100644
--- a/tools/libxc/xc_linux_build.c
+++ b/tools/libxc/xc_linux_build.c
@@ -474,7 +474,7 @@ static int setup_guest(int xc_handle,
struct xen_ia64_boot_param *bp;
shared_info_t *shared_info;
int i;
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int rc;
rc = probeimageformat(image, image_size, &load_funcs);
@@ -494,14 +494,13 @@ static int setup_guest(int xc_handle,
start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
/* Build firmware. */
- memset(&op.u.domain_setup, 0, sizeof(op.u.domain_setup));
- op.u.domain_setup.flags = 0;
- op.u.domain_setup.domain = (domid_t)dom;
- op.u.domain_setup.bp = start_info_mpa + sizeof (start_info_t);
- op.u.domain_setup.maxmem = (nr_pages - 3) << PAGE_SHIFT;
-
- op.cmd = DOM0_DOMAIN_SETUP;
- if ( xc_dom0_op(xc_handle, &op) )
+ memset(&domctl.u.arch_setup, 0, sizeof(domctl.u.arch_setup));
+ domctl.u.arch_setup.flags = 0;
+ domctl.u.arch_setup.bp = start_info_mpa + sizeof (start_info_t);
+ domctl.u.arch_setup.maxmem = (nr_pages - 3) << PAGE_SHIFT;
+ domctl.cmd = XEN_DOMCTL_arch_setup;
+ domctl.domain = (domid_t)dom;
+ if ( xc_domctl(xc_handle, &domctl) )
goto error_out;
start_page = dsi.v_start >> PAGE_SHIFT;
@@ -662,7 +661,7 @@ static int setup_guest(int xc_handle,
shared_info_t *shared_info;
xc_mmu_t *mmu = NULL;
const char *p;
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int rc;
unsigned long nr_pt_pages;
@@ -966,7 +965,7 @@ static int setup_guest(int xc_handle,
/* Enable shadow translate mode */
if ( xc_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE,
+ XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE,
NULL, 0, NULL, 0, NULL) < 0 )
{
PERROR("Could not enable translation mode");
@@ -1077,11 +1076,11 @@ static int setup_guest(int xc_handle,
unsigned long long pfn = (hypercall_page - dsi.v_start) >> PAGE_SHIFT;
if ( pfn >= nr_pages )
goto error_out;
- op.u.hypercall_init.domain = (domid_t)dom;
- op.u.hypercall_init.gmfn = shadow_mode_enabled ?
+ domctl.domain = (domid_t)dom;
+ domctl.u.hypercall_init.gmfn = shadow_mode_enabled ?
pfn : page_array[pfn];
- op.cmd = DOM0_HYPERCALL_INIT;
- if ( xc_dom0_op(xc_handle, &op) )
+ domctl.cmd = XEN_DOMCTL_hypercall_init;
+ if ( xc_domctl(xc_handle, &domctl) )
goto error_out;
}
@@ -1114,8 +1113,8 @@ static int xc_linux_build_internal(int xc_handle,
unsigned int console_evtchn,
unsigned long *console_mfn)
{
- dom0_op_t launch_op;
- DECLARE_DOM0_OP;
+ struct xen_domctl launch_domctl;
+ DECLARE_DOMCTL;
int rc, i;
vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
unsigned long nr_pages;
@@ -1147,10 +1146,10 @@ static int xc_linux_build_internal(int xc_handle,
return 1;
}
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)domid;
- if ( (xc_dom0_op(xc_handle, &op) < 0) ||
- ((uint16_t)op.u.getdomaininfo.domain != domid) )
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)domid;
+ if ( (xc_domctl(xc_handle, &domctl) < 0) ||
+ ((uint16_t)domctl.domain != domid) )
{
PERROR("Could not get info on domain");
goto error_out;
@@ -1163,7 +1162,7 @@ static int xc_linux_build_internal(int xc_handle,
nr_pages,
&vstartinfo_start, &vkern_entry,
&vstack_start, ctxt, cmdline,
- op.u.getdomaininfo.shared_info_frame,
+ domctl.u.getdomaininfo.shared_info_frame,
flags, store_evtchn, store_mfn,
console_evtchn, console_mfn,
features_bitmap) < 0 )
@@ -1239,14 +1238,14 @@ static int xc_linux_build_internal(int xc_handle,
#endif
#endif /* x86 */
- memset( &launch_op, 0, sizeof(launch_op) );
+ memset( &launch_domctl, 0, sizeof(launch_domctl) );
- launch_op.u.setvcpucontext.domain = (domid_t)domid;
- launch_op.u.setvcpucontext.vcpu = 0;
- set_xen_guest_handle(launch_op.u.setvcpucontext.ctxt, ctxt);
+ launch_domctl.domain = (domid_t)domid;
+ launch_domctl.u.vcpucontext.vcpu = 0;
+ set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
- launch_op.cmd = DOM0_SETVCPUCONTEXT;
- rc = xc_dom0_op(xc_handle, &launch_op);
+ launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ rc = xc_domctl(xc_handle, &launch_domctl);
return rc;
diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c
index 7eed8cead8..6243701911 100644
--- a/tools/libxc/xc_linux_restore.c
+++ b/tools/libxc/xc_linux_restore.c
@@ -107,7 +107,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
unsigned int store_evtchn, unsigned long *store_mfn,
unsigned int console_evtchn, unsigned long *console_mfn)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int rc = 1, i, n, pae_extended_cr3 = 0;
unsigned long mfn, pfn;
unsigned int prev_pc, this_pc;
@@ -163,7 +163,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
}
if (mlock(&ctxt, sizeof(ctxt))) {
- /* needed for build dom0 op, but might as well do early */
+ /* needed for build domctl, but might as well do early */
ERR("Unable to mlock ctxt");
return 1;
}
@@ -257,13 +257,13 @@ int xc_linux_restore(int xc_handle, int io_fd,
}
/* Get the domain's shared-info frame. */
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)dom;
- if (xc_dom0_op(xc_handle, &op) < 0) {
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)dom;
+ if (xc_domctl(xc_handle, &domctl) < 0) {
ERR("Could not get information on new domain");
goto out;
}
- shared_info_frame = op.u.getdomaininfo.shared_info_frame;
+ shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
if(xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
errno = ENOMEM;
@@ -337,17 +337,22 @@ int xc_linux_restore(int xc_handle, int io_fd,
goto out;
}
- for (i = 0; i < j; i++) {
+ for ( i = 0; i < j; i++ )
+ {
+ unsigned long pfn, pagetype;
+ pfn = region_pfn_type[i] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
+ pagetype = region_pfn_type[i] & XEN_DOMCTL_PFINFO_LTAB_MASK;
- if ((region_pfn_type[i] & LTAB_MASK) == XTAB)
+ if ( pagetype == XEN_DOMCTL_PFINFO_XTAB)
region_mfn[i] = 0; /* we know map will fail, but don't care */
else
- region_mfn[i] = p2m[region_pfn_type[i] & ~LTAB_MASK];
-
+ region_mfn[i] = p2m[pfn];
}
- if (!(region_base = xc_map_foreign_batch(
- xc_handle, dom, PROT_WRITE, region_mfn, j))) {
+ region_base = xc_map_foreign_batch(
+ xc_handle, dom, PROT_WRITE, region_mfn, j);
+ if ( region_base == NULL )
+ {
ERR("map batch failed");
goto out;
}
@@ -357,14 +362,15 @@ int xc_linux_restore(int xc_handle, int io_fd,
void *page;
unsigned long pagetype;
- pfn = region_pfn_type[i] & ~LTAB_MASK;
- pagetype = region_pfn_type[i] & LTAB_MASK;
+ pfn = region_pfn_type[i] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
+ pagetype = region_pfn_type[i] & XEN_DOMCTL_PFINFO_LTAB_MASK;
- if (pagetype == XTAB)
+ if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
/* a bogus/unmapped page: skip it */
continue;
- if (pfn > max_pfn) {
+ if ( pfn > max_pfn )
+ {
ERR("pfn out of range");
goto out;
}
@@ -381,10 +387,11 @@ int xc_linux_restore(int xc_handle, int io_fd,
goto out;
}
- pagetype &= LTABTYPE_MASK;
-
- if(pagetype >= L1TAB && pagetype <= L4TAB) {
+ pagetype &= XEN_DOMCTL_PFINFO_LTABTYPE_MASK;
+ if ( (pagetype >= XEN_DOMCTL_PFINFO_L1TAB) &&
+ (pagetype <= XEN_DOMCTL_PFINFO_L4TAB) )
+ {
/*
** A page table page - need to 'uncanonicalize' it, i.e.
** replace all the references to pfns with the corresponding
@@ -396,7 +403,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
*/
if ((pt_levels != 3) ||
pae_extended_cr3 ||
- (pagetype != L1TAB)) {
+ (pagetype != XEN_DOMCTL_PFINFO_L1TAB)) {
if (!uncanonicalize_pagetable(pagetype, page)) {
/*
@@ -412,8 +419,9 @@ int xc_linux_restore(int xc_handle, int io_fd,
}
- } else if(pagetype != NOTAB) {
-
+ }
+ else if ( pagetype != XEN_DOMCTL_PFINFO_NOTAB )
+ {
ERR("Bogus page type %lx page table is out of range: "
"i=%d max_pfn=%lu", pagetype, i, max_pfn);
goto out;
@@ -484,10 +492,12 @@ int xc_linux_restore(int xc_handle, int io_fd,
int j, k;
/* First pass: find all L3TABs current in > 4G mfns and get new mfns */
- for (i = 0; i < max_pfn; i++) {
-
- if (((pfn_type[i] & LTABTYPE_MASK)==L3TAB) && (p2m[i]>0xfffffUL)) {
-
+ for ( i = 0; i < max_pfn; i++ )
+ {
+ if ( ((pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) ==
+ XEN_DOMCTL_PFINFO_L3TAB) &&
+ (p2m[i] > 0xfffffUL) )
+ {
unsigned long new_mfn;
uint64_t l3ptes[4];
uint64_t *l3tab;
@@ -530,9 +540,11 @@ int xc_linux_restore(int xc_handle, int io_fd,
/* Second pass: find all L1TABs and uncanonicalize them */
j = 0;
- for(i = 0; i < max_pfn; i++) {
-
- if (((pfn_type[i] & LTABTYPE_MASK)==L1TAB)) {
+ for ( i = 0; i < max_pfn; i++ )
+ {
+ if ( ((pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) ==
+ XEN_DOMCTL_PFINFO_L1TAB) )
+ {
region_mfn[j] = p2m[i];
j++;
}
@@ -547,7 +559,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
}
for(k = 0; k < j; k++) {
- if(!uncanonicalize_pagetable(L1TAB,
+ if(!uncanonicalize_pagetable(XEN_DOMCTL_PFINFO_L1TAB,
region_base + k*PAGE_SIZE)) {
ERR("failed uncanonicalize pt!");
goto out;
@@ -570,26 +582,26 @@ int xc_linux_restore(int xc_handle, int io_fd,
* will barf when doing the type-checking.
*/
nr_pins = 0;
- for (i = 0; i < max_pfn; i++) {
-
- if ( (pfn_type[i] & LPINTAB) == 0 )
+ for ( i = 0; i < max_pfn; i++ )
+ {
+ if ( (pfn_type[i] & XEN_DOMCTL_PFINFO_LPINTAB) == 0 )
continue;
- switch (pfn_type[i]) {
-
- case (L1TAB|LPINTAB):
+ switch ( pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK )
+ {
+ case XEN_DOMCTL_PFINFO_L1TAB:
pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE;
break;
- case (L2TAB|LPINTAB):
+ case XEN_DOMCTL_PFINFO_L2TAB:
pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE;
break;
- case (L3TAB|LPINTAB):
+ case XEN_DOMCTL_PFINFO_L3TAB:
pin[nr_pins].cmd = MMUEXT_PIN_L3_TABLE;
break;
- case (L4TAB|LPINTAB):
+ case XEN_DOMCTL_PFINFO_L4TAB:
pin[nr_pins].cmd = MMUEXT_PIN_L4_TABLE;
break;
@@ -678,7 +690,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
/* Uncanonicalise the suspend-record frame number and poke resume rec. */
pfn = ctxt.user_regs.edx;
- if ((pfn >= max_pfn) || (pfn_type[pfn] != NOTAB)) {
+ if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
ERR("Suspend record frame number is bad");
goto out;
}
@@ -703,7 +715,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
for (i = 0; i < ctxt.gdt_ents; i += 512) {
pfn = ctxt.gdt_frames[i];
- if ((pfn >= max_pfn) || (pfn_type[pfn] != NOTAB)) {
+ if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
ERR("GDT frame number is bad");
goto out;
}
@@ -719,11 +731,11 @@ int xc_linux_restore(int xc_handle, int io_fd,
goto out;
}
- if ( (pfn_type[pfn] & LTABTYPE_MASK) !=
- ((unsigned long)pt_levels<<LTAB_SHIFT) ) {
+ if ( (pfn_type[pfn] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) !=
+ ((unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT) ) {
ERR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
pfn, max_pfn, pfn_type[pfn],
- (unsigned long)pt_levels<<LTAB_SHIFT);
+ (unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT);
goto out;
}
@@ -744,7 +756,7 @@ int xc_linux_restore(int xc_handle, int io_fd,
/* Uncanonicalise the pfn-to-mfn table frame-number list. */
for (i = 0; i < P2M_FL_ENTRIES; i++) {
pfn = p2m_frame_list[i];
- if ((pfn >= max_pfn) || (pfn_type[pfn] != NOTAB)) {
+ if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
ERR("PFN-to-MFN frame number is bad");
goto out;
}
@@ -797,11 +809,11 @@ int xc_linux_restore(int xc_handle, int io_fd,
DPRINTF("Domain ready to be built.\n");
- op.cmd = DOM0_SETVCPUCONTEXT;
- op.u.setvcpucontext.domain = (domid_t)dom;
- op.u.setvcpucontext.vcpu = 0;
- set_xen_guest_handle(op.u.setvcpucontext.ctxt, &ctxt);
- rc = xc_dom0_op(xc_handle, &op);
+ domctl.cmd = XEN_DOMCTL_setvcpucontext;
+ domctl.domain = (domid_t)dom;
+ domctl.u.vcpucontext.vcpu = 0;
+ set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
+ rc = xc_domctl(xc_handle, &domctl);
if (rc != 0) {
ERR("Couldn't build the domain");
diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c
index af388f572e..b5008a6cee 100644
--- a/tools/libxc/xc_linux_save.c
+++ b/tools/libxc/xc_linux_save.c
@@ -271,7 +271,7 @@ static inline ssize_t write_exact(int fd, void *buf, size_t count)
static int print_stats(int xc_handle, uint32_t domid, int pages_sent,
- xc_shadow_control_stats_t *stats, int print)
+ xc_shadow_op_stats_t *stats, int print)
{
static struct timeval wall_last;
static long long d0_cpu_last;
@@ -329,7 +329,7 @@ static int analysis_phase(int xc_handle, uint32_t domid, int max_pfn,
unsigned long *arr, int runs)
{
long long start, now;
- xc_shadow_control_stats_t stats;
+ xc_shadow_op_stats_t stats;
int j;
start = llgettimeofday();
@@ -337,13 +337,13 @@ static int analysis_phase(int xc_handle, uint32_t domid, int max_pfn,
for (j = 0; j < runs; j++) {
int i;
- xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_CLEAN,
+ xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_CLEAN,
arr, max_pfn, NULL, 0, NULL);
DPRINTF("#Flush\n");
for ( i = 0; i < 40; i++ ) {
usleep(50000);
now = llgettimeofday();
- xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_PEEK,
+ xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_PEEK,
NULL, 0, NULL, 0, &stats);
DPRINTF("now= %lld faults= %"PRId32" dirty= %"PRId32"\n",
@@ -427,10 +427,10 @@ int canonicalize_pagetable(unsigned long type, unsigned long pfn,
*/
xen_start = xen_end = pte_last = PAGE_SIZE / ((pt_levels == 2)? 4 : 8);
- if (pt_levels == 2 && type == L2TAB)
+ if (pt_levels == 2 && type == XEN_DOMCTL_PFINFO_L2TAB)
xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT);
- if (pt_levels == 3 && type == L3TAB)
+ if (pt_levels == 3 && type == XEN_DOMCTL_PFINFO_L3TAB)
xen_start = L3_PAGETABLE_ENTRIES_PAE;
/*
@@ -439,7 +439,7 @@ int canonicalize_pagetable(unsigned long type, unsigned long pfn,
** Xen always ensures is present in that L2. Guests must ensure
** that this check will fail for other L2s.
*/
- if (pt_levels == 3 && type == L2TAB) {
+ if (pt_levels == 3 && type == XEN_DOMCTL_PFINFO_L2TAB) {
/* XXX index of the L2 entry in PAE mode which holds the guest LPT */
#define PAE_GLPT_L2ENTRY (495)
@@ -449,7 +449,7 @@ int canonicalize_pagetable(unsigned long type, unsigned long pfn,
xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
}
- if (pt_levels == 4 && type == L4TAB) {
+ if (pt_levels == 4 && type == XEN_DOMCTL_PFINFO_L4TAB) {
/*
** XXX SMH: should compute these from hvirt_start (which we have)
** and hvirt_end (which we don't)
@@ -603,7 +603,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
- to fixup by sending at the end if not already resent; */
unsigned long *to_send = NULL, *to_skip = NULL, *to_fix = NULL;
- xc_shadow_control_stats_t stats;
+ xc_shadow_op_stats_t stats;
unsigned long needed_to_fix = 0;
unsigned long total_sent = 0;
@@ -724,7 +724,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
if (live) {
if (xc_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY,
+ XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
NULL, 0, NULL, 0, NULL) < 0) {
ERR("Couldn't enable shadow mode");
goto out;
@@ -781,8 +781,8 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
analysis_phase(xc_handle, dom, max_pfn, to_skip, 0);
/* We want zeroed memory so use calloc rather than malloc. */
- pfn_type = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
- pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
+ pfn_type = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type));
+ pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
if ((pfn_type == NULL) || (pfn_batch == NULL)) {
ERR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
@@ -790,12 +790,11 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
goto out;
}
- if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(unsigned long))) {
+ if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
ERR("Unable to mlock");
goto out;
}
-
/*
* Quick belt and braces sanity check.
*/
@@ -876,7 +875,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
/* slightly wasteful to peek the whole array evey time,
but this is fast enough for the moment. */
if (!last_iter && xc_shadow_control(
- xc_handle, dom, DOM0_SHADOW_CONTROL_OP_PEEK,
+ xc_handle, dom, XEN_DOMCTL_SHADOW_OP_PEEK,
to_skip, max_pfn, NULL, 0, NULL) != max_pfn) {
ERR("Error peeking shadow bitmap");
goto out;
@@ -930,7 +929,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
if(last_iter && test_bit(n, to_fix) && !test_bit(n, to_send)) {
needed_to_fix++;
DPRINTF("Fix! iter %d, pfn %x. mfn %lx\n",
- iter,n,pfn_type[batch]);
+ iter, n, pfn_type[batch]);
}
clear_bit(n, to_fix);
@@ -952,9 +951,12 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
goto out;
}
- for (j = 0; j < batch; j++) {
+ for ( j = 0; j < batch; j++ )
+ {
- if ((pfn_type[j] & LTAB_MASK) == XTAB) {
+ if ( (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) ==
+ XEN_DOMCTL_PFINFO_XTAB )
+ {
DPRINTF("type fail: page %i mfn %08lx\n", j, pfn_type[j]);
continue;
}
@@ -963,13 +965,16 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
DPRINTF("%d pfn= %08lx mfn= %08lx [mfn]= %08lx"
" sum= %08lx\n",
iter,
- (pfn_type[j] & LTAB_MASK) | pfn_batch[j],
+ (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) |
+ pfn_batch[j],
pfn_type[j],
- mfn_to_pfn(pfn_type[j]&(~LTAB_MASK)),
+ mfn_to_pfn(pfn_type[j] &
+ ~XEN_DOMCTL_PFINFO_LTAB_MASK),
csum_page(region_base + (PAGE_SIZE*j)));
/* canonicalise mfn->pfn */
- pfn_type[j] = (pfn_type[j] & LTAB_MASK) | pfn_batch[j];
+ pfn_type[j] = (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) |
+ pfn_batch[j];
}
if(!write_exact(io_fd, &batch, sizeof(unsigned int))) {
@@ -983,21 +988,23 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
}
/* entering this loop, pfn_type is now in pfns (Not mfns) */
- for (j = 0; j < batch; j++) {
-
- unsigned long pfn = pfn_type[j] & ~LTAB_MASK;
- unsigned long pagetype = pfn_type[j] & LTAB_MASK;
- void *spage = (void *) region_base + (PAGE_SIZE*j);
+ for ( j = 0; j < batch; j++ )
+ {
+ unsigned long pfn, pagetype;
+ void *spage = (char *)region_base + (PAGE_SIZE*j);
+ pfn = pfn_type[j] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
+ pagetype = pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK;
/* write out pages in batch */
- if (pagetype == XTAB)
+ if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
continue;
- pagetype &= LTABTYPE_MASK;
-
- if (pagetype >= L1TAB && pagetype <= L4TAB) {
+ pagetype &= XEN_DOMCTL_PFINFO_LTABTYPE_MASK;
+ if ( (pagetype >= XEN_DOMCTL_PFINFO_L1TAB) &&
+ (pagetype <= XEN_DOMCTL_PFINFO_L4TAB) )
+ {
/* We have a pagetable page: need to rewrite it. */
race =
canonicalize_pagetable(pagetype, pfn, spage, page);
@@ -1083,7 +1090,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
}
if (xc_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_CLEAN, to_send,
+ XEN_DOMCTL_SHADOW_OP_CLEAN, to_send,
max_pfn, NULL, 0, &stats) != max_pfn) {
ERR("Error flushing shadow PT");
goto out;
@@ -1174,7 +1181,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
if (live) {
if(xc_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_OFF,
+ XEN_DOMCTL_SHADOW_OP_OFF,
NULL, 0, NULL, 0, NULL) < 0) {
DPRINTF("Warning - couldn't disable shadow mode");
}
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index 3fc8536a47..7b598124c4 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -12,20 +12,20 @@ int xc_readconsolering(int xc_handle,
int clear)
{
int ret;
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
char *buffer = *pbuffer;
unsigned int nr_chars = *pnr_chars;
- op.cmd = DOM0_READCONSOLE;
- set_xen_guest_handle(op.u.readconsole.buffer, buffer);
- op.u.readconsole.count = nr_chars;
- op.u.readconsole.clear = clear;
+ sysctl.cmd = XEN_SYSCTL_readconsole;
+ set_xen_guest_handle(sysctl.u.readconsole.buffer, buffer);
+ sysctl.u.readconsole.count = nr_chars;
+ sysctl.u.readconsole.clear = clear;
if ( (ret = mlock(buffer, nr_chars)) != 0 )
return ret;
- if ( (ret = do_dom0_op(xc_handle, &op)) == 0 )
- *pnr_chars = op.u.readconsole.count;
+ if ( (ret = do_sysctl(xc_handle, &sysctl)) == 0 )
+ *pnr_chars = sysctl.u.readconsole.count;
safe_munlock(buffer, nr_chars);
@@ -36,15 +36,14 @@ int xc_physinfo(int xc_handle,
xc_physinfo_t *put_info)
{
int ret;
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_PHYSINFO;
- op.interface_version = DOM0_INTERFACE_VERSION;
+ sysctl.cmd = XEN_SYSCTL_physinfo;
- if ( (ret = do_dom0_op(xc_handle, &op)) != 0 )
+ if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
return ret;
- memcpy(put_info, &op.u.physinfo, sizeof(*put_info));
+ memcpy(put_info, &sysctl.u.physinfo, sizeof(*put_info));
return 0;
}
@@ -53,15 +52,14 @@ int xc_sched_id(int xc_handle,
int *sched_id)
{
int ret;
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_SCHED_ID;
- op.interface_version = DOM0_INTERFACE_VERSION;
+ sysctl.cmd = XEN_SYSCTL_sched_id;
- if ( (ret = do_dom0_op(xc_handle, &op)) != 0 )
+ if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
return ret;
- *sched_id = op.u.sched_id.sched_id;
+ *sched_id = sysctl.u.sched_id.sched_id;
return 0;
}
@@ -74,19 +72,19 @@ int xc_perfc_control(int xc_handle,
int *nbr_val)
{
int rc;
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_PERFCCONTROL;
- op.u.perfccontrol.op = opcode;
- set_xen_guest_handle(op.u.perfccontrol.desc, desc);
- set_xen_guest_handle(op.u.perfccontrol.val, val);
+ sysctl.cmd = XEN_SYSCTL_perfc_op;
+ sysctl.u.perfc_op.cmd = opcode;
+ set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
+ set_xen_guest_handle(sysctl.u.perfc_op.val, val);
- rc = do_dom0_op(xc_handle, &op);
+ rc = do_sysctl(xc_handle, &sysctl);
if (nbr_desc)
- *nbr_desc = op.u.perfccontrol.nr_counters;
+ *nbr_desc = sysctl.u.perfc_op.nr_counters;
if (nbr_val)
- *nbr_val = op.u.perfccontrol.nr_vals;
+ *nbr_val = sysctl.u.perfc_op.nr_vals;
return rc;
}
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index e307fc7f02..93537ef811 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -11,12 +11,12 @@
int xc_get_pfn_type_batch(int xc_handle,
uint32_t dom, int num, unsigned long *arr)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_GETPAGEFRAMEINFO2;
- op.u.getpageframeinfo2.domain = (domid_t)dom;
- op.u.getpageframeinfo2.num = num;
- set_xen_guest_handle(op.u.getpageframeinfo2.array, arr);
- return do_dom0_op(xc_handle, &op);
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_getpageframeinfo2;
+ domctl.domain = (domid_t)dom;
+ domctl.u.getpageframeinfo2.num = num;
+ set_xen_guest_handle(domctl.u.getpageframeinfo2.array, arr);
+ return do_domctl(xc_handle, &domctl);
}
#define GETPFN_ERR (~0U)
@@ -24,16 +24,16 @@ unsigned int get_pfn_type(int xc_handle,
unsigned long mfn,
uint32_t dom)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_GETPAGEFRAMEINFO;
- op.u.getpageframeinfo.gmfn = mfn;
- op.u.getpageframeinfo.domain = (domid_t)dom;
- if ( do_dom0_op(xc_handle, &op) < 0 )
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_getpageframeinfo;
+ domctl.u.getpageframeinfo.gmfn = mfn;
+ domctl.domain = (domid_t)dom;
+ if ( do_domctl(xc_handle, &domctl) < 0 )
{
PERROR("Unexpected failure when getting page frame info!");
return GETPFN_ERR;
}
- return op.u.getpageframeinfo.type;
+ return domctl.u.getpageframeinfo.type;
}
int xc_mmuext_op(
@@ -248,17 +248,17 @@ int xc_memory_op(int xc_handle,
long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
- op.cmd = DOM0_GETVCPUINFO;
- op.u.getvcpuinfo.domain = (domid_t)domid;
- op.u.getvcpuinfo.vcpu = (uint16_t)vcpu;
- if ( (do_dom0_op(xc_handle, &op) < 0) )
+ domctl.cmd = XEN_DOMCTL_getvcpuinfo;
+ domctl.domain = (domid_t)domid;
+ domctl.u.getvcpuinfo.vcpu = (uint16_t)vcpu;
+ if ( (do_domctl(xc_handle, &domctl) < 0) )
{
PERROR("Could not get info on domain");
return -1;
}
- return op.u.getvcpuinfo.cpu_time;
+ return domctl.u.getvcpuinfo.cpu_time;
}
@@ -268,12 +268,12 @@ int xc_get_pfn_list(int xc_handle,
xen_pfn_t *pfn_buf,
unsigned long max_pfns)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int ret;
- op.cmd = DOM0_GETMEMLIST;
- op.u.getmemlist.domain = (domid_t)domid;
- op.u.getmemlist.max_pfns = max_pfns;
- set_xen_guest_handle(op.u.getmemlist.buffer, pfn_buf);
+ domctl.cmd = XEN_DOMCTL_getmemlist;
+ domctl.domain = (domid_t)domid;
+ domctl.u.getmemlist.max_pfns = max_pfns;
+ set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
#ifdef VALGRIND
memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
@@ -285,7 +285,7 @@ int xc_get_pfn_list(int xc_handle,
return -1;
}
- ret = do_dom0_op(xc_handle, &op);
+ ret = do_domctl(xc_handle, &domctl);
safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t));
@@ -294,7 +294,7 @@ int xc_get_pfn_list(int xc_handle,
DPRINTF(("Ret for xc_get_pfn_list is %d\n", ret));
if (ret >= 0) {
int i, j;
- for (i = 0; i < op.u.getmemlist.num_pfns; i += 16) {
+ for (i = 0; i < domctl.u.getmemlist.num_pfns; i += 16) {
DPRINTF("0x%x: ", i);
for (j = 0; j < 16; j++)
DPRINTF("0x%lx ", pfn_buf[i + j]);
@@ -304,17 +304,17 @@ int xc_get_pfn_list(int xc_handle,
#endif
#endif
- return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
+ return (ret < 0) ? -1 : domctl.u.getmemlist.num_pfns;
}
#endif
long xc_get_tot_pages(int xc_handle, uint32_t domid)
{
- DECLARE_DOM0_OP;
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = (domid_t)domid;
- return (do_dom0_op(xc_handle, &op) < 0) ?
- -1 : op.u.getdomaininfo.tot_pages;
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = (domid_t)domid;
+ return (do_domctl(xc_handle, &domctl) < 0) ?
+ -1 : domctl.u.getdomaininfo.tot_pages;
}
int xc_copy_to_domain_page(int xc_handle,
@@ -386,9 +386,14 @@ void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size,
}
}
-int xc_dom0_op(int xc_handle, dom0_op_t *op)
+int xc_domctl(int xc_handle, struct xen_domctl *domctl)
{
- return do_dom0_op(xc_handle, op);
+ return do_domctl(xc_handle, domctl);
+}
+
+int xc_sysctl(int xc_handle, struct xen_sysctl *sysctl)
+{
+ return do_sysctl(xc_handle, sysctl);
}
int xc_version(int xc_handle, int cmd, void *arg)
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index 6e1b262375..513daed6f9 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -18,14 +18,16 @@
#include <xen/sys/privcmd.h>
/* valgrind cannot see when a hypercall has filled in some values. For this
- reason, we must zero the privcmd_hypercall_t or dom0_op_t instance before a
- call, if using valgrind. */
+ reason, we must zero the privcmd_hypercall_t or domctl/sysctl instance
+ before a call, if using valgrind. */
#ifdef VALGRIND
#define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 }
-#define DECLARE_DOM0_OP dom0_op_t op = { 0 }
+#define DECLARE_DOMCTL struct xen_domctl domctl = { 0 }
+#define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 }
#else
#define DECLARE_HYPERCALL privcmd_hypercall_t hypercall
-#define DECLARE_DOM0_OP dom0_op_t op
+#define DECLARE_DOMCTL struct xen_domctl domctl
+#define DECLARE_SYSCTL struct xen_sysctl sysctl
#endif
#define PAGE_SHIFT XC_PAGE_SHIFT
@@ -94,17 +96,17 @@ static inline int do_xen_version(int xc_handle, int cmd, void *dest)
return do_xen_hypercall(xc_handle, &hypercall);
}
-static inline int do_dom0_op(int xc_handle, dom0_op_t *op)
+static inline int do_domctl(int xc_handle, struct xen_domctl *domctl)
{
int ret = -1;
DECLARE_HYPERCALL;
- op->interface_version = DOM0_INTERFACE_VERSION;
+ domctl->interface_version = XEN_DOMCTL_INTERFACE_VERSION;
- hypercall.op = __HYPERVISOR_dom0_op;
- hypercall.arg[0] = (unsigned long)op;
+ hypercall.op = __HYPERVISOR_domctl;
+ hypercall.arg[0] = (unsigned long)domctl;
- if ( mlock(op, sizeof(*op)) != 0 )
+ if ( mlock(domctl, sizeof(*domctl)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out1;
@@ -113,11 +115,40 @@ static inline int do_dom0_op(int xc_handle, dom0_op_t *op)
if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
{
if ( errno == EACCES )
- DPRINTF("Dom0 operation failed -- need to"
+ DPRINTF("domctl operation failed -- need to"
" rebuild the user-space tool set?\n");
}
- safe_munlock(op, sizeof(*op));
+ safe_munlock(domctl, sizeof(*domctl));
+
+ out1:
+ return ret;
+}
+
+static inline int do_sysctl(int xc_handle, struct xen_sysctl *sysctl)
+{
+ int ret = -1;
+ DECLARE_HYPERCALL;
+
+ sysctl->interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+
+ hypercall.op = __HYPERVISOR_sysctl;
+ hypercall.arg[0] = (unsigned long)sysctl;
+
+ if ( mlock(sysctl, sizeof(*sysctl)) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ goto out1;
+ }
+
+ if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
+ {
+ if ( errno == EACCES )
+ DPRINTF("sysctl operation failed -- need to"
+ " rebuild the user-space tool set?\n");
+ }
+
+ safe_munlock(sysctl, sizeof(*sysctl));
out1:
return ret;
diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c
index bfe455bd5a..ab9c2fae45 100644
--- a/tools/libxc/xc_ptrace.c
+++ b/tools/libxc/xc_ptrace.c
@@ -41,8 +41,8 @@ static char *ptrace_names[] = {
static int current_domid = -1;
static int current_isfile;
-static cpumap_t online_cpumap;
-static cpumap_t regs_valid;
+static uint64_t online_cpumap;
+static uint64_t regs_valid;
static vcpu_guest_context_t ctxt[MAX_VIRT_CPUS];
extern int ffsll(long long int);
@@ -111,7 +111,8 @@ paging_enabled(vcpu_guest_context_t *v)
*/
static int
-get_online_cpumap(int xc_handle, dom0_getdomaininfo_t *d, cpumap_t *cpumap)
+get_online_cpumap(int xc_handle, struct xen_domctl_getdomaininfo *d,
+ uint64_t *cpumap)
{
int i, online, retval;
@@ -133,9 +134,9 @@ get_online_cpumap(int xc_handle, dom0_getdomaininfo_t *d, cpumap_t *cpumap)
*/
static void
-online_vcpus_changed(cpumap_t cpumap)
+online_vcpus_changed(uint64_t cpumap)
{
- cpumap_t changed_cpumap = cpumap ^ online_cpumap;
+ uint64_t changed_cpumap = cpumap ^ online_cpumap;
int index;
while ( (index = ffsll(changed_cpumap)) ) {
@@ -418,25 +419,25 @@ __xc_waitdomain(
int *status,
int options)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int retval;
struct timespec ts;
- cpumap_t cpumap;
+ uint64_t cpumap;
ts.tv_sec = 0;
ts.tv_nsec = 10*1000*1000;
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = domain;
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = domain;
retry:
- retval = do_dom0_op(xc_handle, &op);
- if ( retval || (op.u.getdomaininfo.domain != domain) )
+ retval = do_domctl(xc_handle, &domctl);
+ if ( retval || (domctl.domain != domain) )
{
IPRINTF("getdomaininfo failed\n");
goto done;
}
- *status = op.u.getdomaininfo.flags;
+ *status = domctl.u.getdomaininfo.flags;
if ( options & WNOHANG )
goto done;
@@ -447,13 +448,13 @@ __xc_waitdomain(
goto done;
}
- if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
+ if ( !(domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
{
nanosleep(&ts,NULL);
goto retry;
}
done:
- if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
+ if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap))
IPRINTF("get_online_cpumap failed\n");
if (online_cpumap != cpumap)
online_vcpus_changed(cpumap);
@@ -470,11 +471,11 @@ xc_ptrace(
long eaddr,
long edata)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
struct gdb_regs pt;
long retval = 0;
unsigned long *guest_va;
- cpumap_t cpumap;
+ uint64_t cpumap;
int cpu, index;
void *addr = (char *)eaddr;
void *data = (char *)edata;
@@ -535,7 +536,7 @@ xc_ptrace(
SET_XC_REGS(((struct gdb_regs *)data), ctxt[cpu].user_regs);
if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
&ctxt[cpu])))
- goto out_error_dom0;
+ goto out_error_domctl;
break;
case PTRACE_SINGLESTEP:
@@ -547,7 +548,7 @@ xc_ptrace(
ctxt[cpu].user_regs.eflags |= PSL_T;
if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
&ctxt[cpu])))
- goto out_error_dom0;
+ goto out_error_domctl;
/* FALLTHROUGH */
case PTRACE_CONT:
@@ -566,22 +567,22 @@ xc_ptrace(
ctxt[cpu].user_regs.eflags &= ~PSL_T;
if ((retval = xc_vcpu_setcontext(xc_handle, current_domid,
cpu, &ctxt[cpu])))
- goto out_error_dom0;
+ goto out_error_domctl;
}
}
}
if ( request == PTRACE_DETACH )
{
- op.cmd = DOM0_SETDEBUGGING;
- op.u.setdebugging.domain = current_domid;
- op.u.setdebugging.enable = 0;
- if ((retval = do_dom0_op(xc_handle, &op)))
- goto out_error_dom0;
+ domctl.cmd = XEN_DOMCTL_setdebugging;
+ domctl.domain = current_domid;
+ domctl.u.setdebugging.enable = 0;
+ if ((retval = do_domctl(xc_handle, &domctl)))
+ goto out_error_domctl;
}
regs_valid = 0;
if ((retval = xc_domain_unpause(xc_handle, current_domid > 0 ?
current_domid : -current_domid)))
- goto out_error_dom0;
+ goto out_error_domctl;
break;
case PTRACE_ATTACH:
@@ -589,22 +590,22 @@ xc_ptrace(
current_isfile = (int)edata;
if (current_isfile)
break;
- op.cmd = DOM0_GETDOMAININFO;
- op.u.getdomaininfo.domain = current_domid;
- retval = do_dom0_op(xc_handle, &op);
- if ( retval || (op.u.getdomaininfo.domain != current_domid) )
- goto out_error_dom0;
- if ( op.u.getdomaininfo.flags & DOMFLAGS_PAUSED )
+ domctl.cmd = XEN_DOMCTL_getdomaininfo;
+ domctl.domain = current_domid;
+ retval = do_domctl(xc_handle, &domctl);
+ if ( retval || (domctl.domain != current_domid) )
+ goto out_error_domctl;
+ if ( domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED )
IPRINTF("domain currently paused\n");
else if ((retval = xc_domain_pause(xc_handle, current_domid)))
- goto out_error_dom0;
- op.cmd = DOM0_SETDEBUGGING;
- op.u.setdebugging.domain = current_domid;
- op.u.setdebugging.enable = 1;
- if ((retval = do_dom0_op(xc_handle, &op)))
- goto out_error_dom0;
-
- if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
+ goto out_error_domctl;
+ domctl.cmd = XEN_DOMCTL_setdebugging;
+ domctl.domain = current_domid;
+ domctl.u.setdebugging.enable = 1;
+ if ((retval = do_domctl(xc_handle, &domctl)))
+ goto out_error_domctl;
+
+ if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap))
IPRINTF("get_online_cpumap failed\n");
if (online_cpumap != cpumap)
online_vcpus_changed(cpumap);
@@ -625,8 +626,8 @@ xc_ptrace(
return retval;
- out_error_dom0:
- perror("dom0 op failed");
+ out_error_domctl:
+ perror("domctl failed");
out_error:
errno = EINVAL;
return retval;
diff --git a/tools/libxc/xc_sedf.c b/tools/libxc/xc_sedf.c
index 7097e4f9d7..20cffa5d35 100644
--- a/tools/libxc/xc_sedf.c
+++ b/tools/libxc/xc_sedf.c
@@ -10,37 +10,50 @@
#include "xc_private.h"
-int xc_sedf_domain_set(int xc_handle,
- uint32_t domid, uint64_t period, uint64_t slice,uint64_t latency, uint16_t extratime,uint16_t weight)
+int xc_sedf_domain_set(
+ int xc_handle,
+ uint32_t domid,
+ uint64_t period,
+ uint64_t slice,
+ uint64_t latency,
+ uint16_t extratime,
+ uint16_t weight)
{
- DECLARE_DOM0_OP;
- struct sedf_adjdom *p = &op.u.adjustdom.u.sedf;
+ DECLARE_DOMCTL;
+ struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
- op.cmd = DOM0_ADJUSTDOM;
- op.u.adjustdom.domain = (domid_t)domid;
- op.u.adjustdom.sched_id = SCHED_SEDF;
- op.u.adjustdom.direction = SCHED_INFO_PUT;
+ domctl.cmd = XEN_DOMCTL_scheduler_op;
+ domctl.domain = (domid_t)domid;
+ domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_SEDF;
+ domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
p->period = period;
p->slice = slice;
p->latency = latency;
p->extratime = extratime;
p->weight = weight;
- return do_dom0_op(xc_handle, &op);
+ return do_domctl(xc_handle, &domctl);
}
-int xc_sedf_domain_get(int xc_handle, uint32_t domid, uint64_t *period, uint64_t *slice, uint64_t* latency, uint16_t* extratime, uint16_t* weight)
+int xc_sedf_domain_get(
+ int xc_handle,
+ uint32_t domid,
+ uint64_t *period,
+ uint64_t *slice,
+ uint64_t *latency,
+ uint16_t *extratime,
+ uint16_t *weight)
{
- DECLARE_DOM0_OP;
+ DECLARE_DOMCTL;
int ret;
- struct sedf_adjdom *p = &op.u.adjustdom.u.sedf;
+ struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
- op.cmd = DOM0_ADJUSTDOM;
- op.u.adjustdom.domain = (domid_t)domid;
- op.u.adjustdom.sched_id = SCHED_SEDF;
- op.u.adjustdom.direction = SCHED_INFO_GET;
+ domctl.cmd = XEN_DOMCTL_scheduler_op;
+ domctl.domain = (domid_t)domid;
+ domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_SEDF;
+ domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
- ret = do_dom0_op(xc_handle, &op);
+ ret = do_domctl(xc_handle, &domctl);
*period = p->period;
*slice = p->slice;
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
index 3160da1942..13614f0f8a 100644
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -18,49 +18,49 @@
static int tbuf_enable(int xc_handle, int enable)
{
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
if (enable)
- op.u.tbufcontrol.op = DOM0_TBUF_ENABLE;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_enable;
else
- op.u.tbufcontrol.op = DOM0_TBUF_DISABLE;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_disable;
- return xc_dom0_op(xc_handle, &op);
+ return xc_sysctl(xc_handle, &sysctl);
}
int xc_tbuf_set_size(int xc_handle, unsigned long size)
{
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_SET_SIZE;
- op.u.tbufcontrol.size = size;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_size;
+ sysctl.u.tbuf_op.size = size;
- return xc_dom0_op(xc_handle, &op);
+ return xc_sysctl(xc_handle, &sysctl);
}
int xc_tbuf_get_size(int xc_handle, unsigned long *size)
{
int rc;
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info;
- rc = xc_dom0_op(xc_handle, &op);
+ rc = xc_sysctl(xc_handle, &sysctl);
if (rc == 0)
- *size = op.u.tbufcontrol.size;
+ *size = sysctl.u.tbuf_op.size;
return rc;
}
int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn,
unsigned long *size)
{
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
int rc;
/*
@@ -73,15 +73,15 @@ int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn,
if ( tbuf_enable(xc_handle, 1) != 0 )
return -1;
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info;
- rc = xc_dom0_op(xc_handle, &op);
+ rc = xc_sysctl(xc_handle, &sysctl);
if ( rc == 0 )
{
- *size = op.u.tbufcontrol.size;
- *mfn = op.u.tbufcontrol.buffer_mfn;
+ *size = sysctl.u.tbuf_op.size;
+ *mfn = sysctl.u.tbuf_op.buffer_mfn;
}
return 0;
@@ -94,25 +94,39 @@ int xc_tbuf_disable(int xc_handle)
int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask)
{
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
+ int ret = -1;
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_SET_CPU_MASK;
- op.u.tbufcontrol.cpu_mask = mask;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_cpu_mask;
- return do_dom0_op(xc_handle, &op);
+ set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask);
+ sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8;
+
+ if ( mlock(&mask, sizeof(mask)) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ goto out;
+ }
+
+ ret = do_sysctl(xc_handle, &sysctl);
+
+ safe_munlock(&mask, sizeof(mask));
+
+ out:
+ return ret;
}
int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask)
{
- DECLARE_DOM0_OP;
+ DECLARE_SYSCTL;
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_SET_EVT_MASK;
- op.u.tbufcontrol.evt_mask = mask;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_evt_mask;
+ sysctl.u.tbuf_op.evt_mask = mask;
- return do_dom0_op(xc_handle, &op);
+ return do_sysctl(xc_handle, &sysctl);
}
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 9ab9db9217..f2f32c47bd 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -13,11 +13,11 @@
#include <stdint.h>
#include <sys/ptrace.h>
#include <xen/xen.h>
-#include <xen/dom0_ops.h>
+#include <xen/domctl.h>
+#include <xen/sysctl.h>
#include <xen/version.h>
#include <xen/event_channel.h>
#include <xen/sched.h>
-#include <xen/sched_ctl.h>
#include <xen/memory.h>
#include <xen/acm.h>
#include <xen/acm_ops.h>
@@ -139,7 +139,7 @@ typedef struct {
xen_domain_handle_t handle;
} xc_dominfo_t;
-typedef dom0_getdomaininfo_t xc_domaininfo_t;
+typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
int xc_domain_create(int xc_handle,
uint32_t ssidref,
xen_domain_handle_t handle,
@@ -231,7 +231,11 @@ int xc_domain_shutdown(int xc_handle,
int xc_vcpu_setaffinity(int xc_handle,
uint32_t domid,
int vcpu,
- cpumap_t cpumap);
+ uint64_t cpumap);
+int xc_vcpu_getaffinity(int xc_handle,
+ uint32_t domid,
+ int vcpu,
+ uint64_t *cpumap);
/**
* This function will return information about one or more domains. It is
@@ -301,7 +305,7 @@ int xc_vcpu_getcontext(int xc_handle,
uint32_t vcpu,
vcpu_guest_context_t *ctxt);
-typedef dom0_getvcpuinfo_t xc_vcpuinfo_t;
+typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
int xc_vcpu_getinfo(int xc_handle,
uint32_t domid,
uint32_t vcpu,
@@ -317,7 +321,7 @@ long long xc_domain_get_cpu_usage(int xc_handle,
int xc_domain_sethandle(int xc_handle, uint32_t domid,
xen_domain_handle_t handle);
-typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
+typedef xen_domctl_shadow_op_stats_t xc_shadow_op_stats_t;
int xc_shadow_control(int xc_handle,
uint32_t domid,
unsigned int sop,
@@ -325,7 +329,7 @@ int xc_shadow_control(int xc_handle,
unsigned long pages,
unsigned long *mb,
uint32_t mode,
- xc_shadow_control_stats_t *stats);
+ xc_shadow_op_stats_t *stats);
int xc_sedf_domain_set(int xc_handle,
uint32_t domid,
@@ -341,11 +345,11 @@ int xc_sedf_domain_get(int xc_handle,
int xc_sched_credit_domain_set(int xc_handle,
uint32_t domid,
- struct sched_credit_adjdom *sdom);
+ struct xen_domctl_sched_credit *sdom);
int xc_sched_credit_domain_get(int xc_handle,
uint32_t domid,
- struct sched_credit_adjdom *sdom);
+ struct xen_domctl_sched_credit *sdom);
/*
* EVENT CHANNEL FUNCTIONS
@@ -377,7 +381,7 @@ int xc_readconsolering(int xc_handle,
unsigned int *pnr_chars,
int clear);
-typedef dom0_physinfo_t xc_physinfo_t;
+typedef xen_sysctl_physinfo_t xc_physinfo_t;
int xc_physinfo(int xc_handle,
xc_physinfo_t *info);
@@ -438,8 +442,8 @@ int xc_domain_iomem_permission(int xc_handle,
unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
unsigned long mfn);
-typedef dom0_perfc_desc_t xc_perfc_desc_t;
-typedef dom0_perfc_val_t xc_perfc_val_t;
+typedef xen_sysctl_perfc_desc_t xc_perfc_desc_t;
+typedef xen_sysctl_perfc_val_t xc_perfc_val_t;
/* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val
arrays. */
int xc_perfc_control(int xc_handle,
@@ -561,8 +565,8 @@ int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask);
int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask);
-/* Execute a privileged dom0 operation. */
-int xc_dom0_op(int xc_handle, dom0_op_t *op);
+int xc_domctl(int xc_handle, struct xen_domctl *domctl);
+int xc_sysctl(int xc_handle, struct xen_sysctl *sysctl);
int xc_version(int xc_handle, int cmd, void *arg);
diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h
index fcf8d25c7a..c471e94cb6 100644
--- a/tools/libxc/xg_private.h
+++ b/tools/libxc/xg_private.h
@@ -19,15 +19,6 @@
#include <xen/memory.h>
#include <xen/elfnote.h>
-/* valgrind cannot see when a hypercall has filled in some values. For this
- reason, we must zero the dom0_op_t instance before a call, if using
- valgrind. */
-#ifdef VALGRIND
-#define DECLARE_DOM0_OP dom0_op_t op = { 0 }
-#else
-#define DECLARE_DOM0_OP dom0_op_t op
-#endif
-
#ifndef ELFSIZE
#include <limits.h>
#if UINT_MAX == ULONG_MAX
diff --git a/tools/misc/xenperf.c b/tools/misc/xenperf.c
index 1054d022f7..44fc3b445a 100644
--- a/tools/misc/xenperf.c
+++ b/tools/misc/xenperf.c
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
if ( reset )
{
- if ( xc_perfc_control(xc_handle, DOM0_PERFCCONTROL_OP_RESET,
+ if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_reset,
NULL, NULL, NULL, NULL) != 0 )
{
fprintf(stderr, "Error reseting performance counters: %d (%s)\n",
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
return 0;
}
- if ( xc_perfc_control(xc_handle, DOM0_PERFCCONTROL_OP_QUERY,
+ if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query,
NULL, NULL, &num_desc, &num_val) != 0 )
{
fprintf(stderr, "Error getting number of perf counters: %d (%s)\n",
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
exit(-1);
}
- if ( xc_perfc_control(xc_handle, DOM0_PERFCCONTROL_OP_QUERY,
+ if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query,
pcd, pcv, NULL, NULL) != 0 )
{
fprintf(stderr, "Error getting perf counter: %d (%s)\n",
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 87356c7339..3137623505 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -141,7 +141,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
{
uint32_t dom;
int vcpu = 0, i;
- cpumap_t cpumap = ~0ULL;
+ uint64_t cpumap = ~0ULL;
PyObject *cpulist = NULL;
static char *kwd_list[] = { "dom", "vcpu", "cpumap", NULL };
@@ -154,7 +154,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
{
cpumap = 0ULL;
for ( i = 0; i < PyList_Size(cpulist); i++ )
- cpumap |= (cpumap_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, i));
+ cpumap |= (uint64_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, i));
}
if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap) != 0 )
@@ -289,7 +289,7 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
uint32_t dom, vcpu = 0;
xc_vcpuinfo_t info;
int rc, i;
- cpumap_t cpumap;
+ uint64_t cpumap;
static char *kwd_list[] = { "dom", "vcpu", NULL };
@@ -300,6 +300,9 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info);
if ( rc < 0 )
return PyErr_SetFromErrno(xc_error);
+ rc = xc_vcpu_getaffinity(self->xc_handle, dom, vcpu, &cpumap);
+ if ( rc < 0 )
+ return PyErr_SetFromErrno(xc_error);
info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}",
"online", info.online,
@@ -308,7 +311,6 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
"cpu_time", info.cpu_time,
"cpu", info.cpu);
- cpumap = info.cpumap;
cpulist = PyList_New(0);
for ( i = 0; cpumap != 0; i++ )
{
@@ -632,11 +634,11 @@ static PyObject *pyxc_shadow_mem_control(PyObject *self,
return NULL;
if ( mbarg < 0 )
- op = DOM0_SHADOW_CONTROL_OP_GET_ALLOCATION;
+ op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
else
{
mb = mbarg;
- op = DOM0_SHADOW_CONTROL_OP_SET_ALLOCATION;
+ op = XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION;
}
if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0, &mb, 0, NULL) < 0 )
return PyErr_SetFromErrno(xc_error);
@@ -654,7 +656,7 @@ static PyObject *pyxc_sched_credit_domain_set(XcObject *self,
uint16_t cap;
static char *kwd_list[] = { "dom", "weight", "cap", NULL };
static char kwd_type[] = "I|HH";
- struct sched_credit_adjdom sdom;
+ struct xen_domctl_sched_credit sdom;
weight = 0;
cap = (uint16_t)~0U;
@@ -675,7 +677,7 @@ static PyObject *pyxc_sched_credit_domain_set(XcObject *self,
static PyObject *pyxc_sched_credit_domain_get(XcObject *self, PyObject *args)
{
uint32_t domid;
- struct sched_credit_adjdom sdom;
+ struct xen_domctl_sched_credit sdom;
if( !PyArg_ParseTuple(args, "I", &domid) )
return NULL;
diff --git a/tools/xenmon/setmask.c b/tools/xenmon/setmask.c
index 333280d359..676dd6dcf7 100644
--- a/tools/xenmon/setmask.c
+++ b/tools/xenmon/setmask.c
@@ -40,15 +40,14 @@ typedef struct { int counter; } atomic_t;
int main(int argc, char * argv[])
{
-
- dom0_op_t op;
+ struct xen_sysctl sysctl;
int ret;
int xc_handle = xc_interface_open();
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO;
- ret = xc_dom0_op(xc_handle, &op);
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info;
+ ret = xc_sysctl(xc_handle, &sysctl);
if ( ret != 0 )
{
perror("Failure to get event mask from Xen");
@@ -56,26 +55,26 @@ int main(int argc, char * argv[])
}
else
{
- printf("Current event mask: 0x%.8x\n", op.u.tbufcontrol.evt_mask);
+ printf("Current event mask: 0x%.8x\n", sysctl.u.tbuf_op.evt_mask);
}
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_SET_EVT_MASK;
- op.u.tbufcontrol.evt_mask = XENMON;
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_evt_mask;
+ sysctl.u.tbuf_op.evt_mask = XENMON;
- ret = xc_dom0_op(xc_handle, &op);
- printf("Setting mask to 0x%.8x\n", op.u.tbufcontrol.evt_mask);
+ ret = xc_sysctl(xc_handle, &sysctl);
+ printf("Setting mask to 0x%.8x\n", sysctl.u.tbuf_op.evt_mask);
if ( ret != 0 )
{
perror("Failure to get scheduler ID from Xen");
exit(1);
}
- op.cmd = DOM0_TBUFCONTROL;
- op.interface_version = DOM0_INTERFACE_VERSION;
- op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO;
- ret = xc_dom0_op(xc_handle, &op);
+ sysctl.cmd = XEN_SYSCTL_tbuf_op;
+ sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
+ sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info;
+ ret = xc_sysctl(xc_handle, &sysctl);
if ( ret != 0 )
{
perror("Failure to get event mask from Xen");
@@ -83,7 +82,7 @@ int main(int argc, char * argv[])
}
else
{
- printf("Current event mask: 0x%.8x\n", op.u.tbufcontrol.evt_mask);
+ printf("Current event mask: 0x%.8x\n", sysctl.u.tbuf_op.evt_mask);
}
xc_interface_close(xc_handle);
return 0;
diff --git a/tools/xenstat/libxenstat/src/xenstat.c b/tools/xenstat/libxenstat/src/xenstat.c
index 37a0e52b53..4af20372d3 100644
--- a/tools/xenstat/libxenstat/src/xenstat.c
+++ b/tools/xenstat/libxenstat/src/xenstat.c
@@ -210,8 +210,8 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags)
{
#define DOMAIN_CHUNK_SIZE 256
xenstat_node *node;
- dom0_physinfo_t physinfo;
- dom0_getdomaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
+ xc_physinfo_t physinfo;
+ xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
unsigned int new_domains;
unsigned int i;
@@ -530,7 +530,7 @@ static int xenstat_collect_vcpus(xenstat_node * node)
for (vcpu = 0; vcpu < node->domains[i].num_vcpus; vcpu++) {
/* FIXME: need to be using a more efficient mechanism*/
- dom0_getvcpuinfo_t info;
+ xc_vcpuinfo_t info;
if (xc_vcpu_getinfo(node->handle->xc_handle,
node->domains[i].id, vcpu, &info) != 0) {