int virt_to_phys (int is_inst, unsigned long vaddr, unsigned long *paddr);
+/* wrapper for vcpu_gest_context_any_t */
+static int xc_ia64_vcpu_getcontext(int xc_handle,
+ uint32_t domid,
+ uint32_t vcpu,
+ vcpu_guest_context_t *ctxt)
+{
+ return xc_vcpu_getcontext(xc_handle, domid, vcpu,
+ (vcpu_guest_context_any_t *)ctxt);
+}
+
static inline unsigned int ctx_slot (vcpu_guest_context_t *ctx)
{
return (ctx->regs.psr >> PSR_RI_SHIFT) & 3;
fflush (stdout);
nanosleep (&ts, NULL);
}
- return xc_vcpu_getcontext (xc_handle, domid, vcpu, ctx);
+ return xc_ia64_vcpu_getcontext (xc_handle, domid, vcpu, ctx);
}
int virt_to_phys (int is_inst, unsigned long vaddr, unsigned long *paddr)
return res;
}
-vcpu_guest_context_t vcpu_ctx[MAX_VIRT_CPUS];
+vcpu_guest_context_any_t vcpu_ctx_any[MAX_VIRT_CPUS];
int vcpu_setcontext (int vcpu)
{
int ret;
- ret = xc_vcpu_setcontext (xc_handle, domid, vcpu, &vcpu_ctx[vcpu]);
+ ret = xc_vcpu_setcontext (xc_handle, domid, vcpu, &vcpu_ctx_any[vcpu]);
if (ret < 0)
perror ("xc_vcpu_setcontext");
int flag_ambiguous;
cur_vcpu = vcpu;
- cur_ctx = &vcpu_ctx[vcpu];
+ cur_ctx = &vcpu_ctx_any[vcpu].c;
/* Handle repeat last-command. */
if (*line == 0) {
int ret;
struct sigaction sa;
- cur_ctx = &vcpu_ctx[vcpu];
+ cur_ctx = &vcpu_ctx_any[vcpu].c;
xc_handle = xc_interface_open (); /* for accessing control interface */
exit (-1);
}
- ret = xc_vcpu_getcontext (xc_handle, domid, vcpu, cur_ctx);
+ ret = xc_ia64_vcpu_getcontext (xc_handle, domid, vcpu, cur_ctx);
if (ret < 0) {
- perror ("xc_vcpu_getcontext");
+ perror ("xc_ia64_vcpu_getcontext");
exit (-1);
}
int
xc_hvm_build(int xc_handle, uint32_t domid, int memsize, const char *image_name)
{
- vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
+ vcpu_guest_context_any_t st_ctxt_any;
+ vcpu_guest_context_t *ctxt = &st_ctxt_any.c;
char *image = NULL;
unsigned long image_size;
unsigned long nr_pages;
free(image);
- memset(ctxt, 0, sizeof(*ctxt));
+ memset(&st_ctxt_any, 0, sizeof(st_ctxt_any));
ctxt->regs.ip = 0x80000000ffffffb0UL;
ctxt->regs.ar.fpsr = xc_ia64_fpsr_default();
ctxt->regs.cr.itir = 14 << 2;
ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_BN;
ctxt->regs.cr.dcr = 0;
ctxt->regs.cr.pta = 15 << 2;
- return xc_vcpu_setcontext(xc_handle, domid, 0, ctxt);
+ return xc_vcpu_setcontext(xc_handle, domid, 0, &st_ctxt_any);
error_out:
free(image);
static int
xc_ia64_recv_vcpu_context(int xc_handle, int io_fd, uint32_t dom,
- uint32_t vcpu, vcpu_guest_context_t *ctxt)
+ uint32_t vcpu, vcpu_guest_context_any_t *ctxt_any)
{
+ vcpu_guest_context_t *ctxt = &ctxt_any->c;
if (read_exact(io_fd, ctxt, sizeof(*ctxt))) {
ERROR("Error when reading ctxt");
return -1;
/* Initialize and set registers. */
ctxt->flags = VGCF_EXTRA_REGS | VGCF_SET_CR_IRR;
- if (xc_vcpu_setcontext(xc_handle, dom, vcpu, ctxt) != 0) {
+ if (xc_vcpu_setcontext(xc_handle, dom, vcpu, ctxt_any) != 0) {
ERROR("Couldn't set vcpu context");
return -1;
}
/* Just a check. */
ctxt->flags = 0;
- if (xc_vcpu_getcontext(xc_handle, dom, vcpu, ctxt)) {
+ if (xc_vcpu_getcontext(xc_handle, dom, vcpu, ctxt_any)) {
ERROR("Could not get vcpu context");
return -1;
}
unsigned long gmfn;
/* A copy of the CPU context of the guest. */
- vcpu_guest_context_t ctxt;
+ vcpu_guest_context_any_t ctxt_any;
+ vcpu_guest_context_t *ctxt = &ctxt_any.c;
/* A temporary mapping of the guest's start_info page. */
start_info_t *start_info;
- if (lock_pages(&ctxt, sizeof(ctxt))) {
+ if (lock_pages(&ctxt_any, sizeof(ctxt_any))) {
/* needed for build domctl, but might as well do early */
ERROR("Unable to lock_pages ctxt");
return -1;
}
- if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, 0, &ctxt))
+ if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, 0, &ctxt_any))
goto out;
/* Then get privreg page. */
- if (read_page(xc_handle, io_fd, dom, ctxt.privregs_pfn) < 0) {
+ if (read_page(xc_handle, io_fd, dom, ctxt->privregs_pfn) < 0) {
ERROR("Could not read vcpu privregs");
goto out;
}
rc = 0;
out:
- unlock_pages(&ctxt, sizeof(ctxt));
+ unlock_pages(&ctxt_any, sizeof(ctxt_any));
return rc;
}
/* vcpu context */
for (i = 0; i <= info.max_vcpu_id; i++) {
/* A copy of the CPU context of the guest. */
- vcpu_guest_context_t ctxt;
+ vcpu_guest_context_any_t ctxt_any;
if (!__test_bit(i, vcpumap))
continue;
- if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, i, &ctxt))
+ if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, i, &ctxt_any))
goto out;
// system context of vcpu is recieved as hvm context.
static int
xc_ia64_send_vcpu_context(int xc_handle, int io_fd, uint32_t dom,
- uint32_t vcpu, vcpu_guest_context_t *ctxt)
+ uint32_t vcpu, vcpu_guest_context_any_t *ctxt_any)
{
- if (xc_vcpu_getcontext(xc_handle, dom, vcpu, ctxt)) {
+ vcpu_guest_context_t *ctxt = &ctxt_any->c;
+ if (xc_vcpu_getcontext(xc_handle, dom, vcpu, ctxt_any)) {
ERROR("Could not get vcpu context");
return -1;
}
shared_info_t *live_shinfo)
{
/* A copy of the CPU context of the guest. */
- vcpu_guest_context_t ctxt;
+ vcpu_guest_context_any_t ctxt_any;
+ vcpu_guest_context_t *ctxt = &ctxt_any.c;
char *mem;
- if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, 0, &ctxt))
+ if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, 0, &ctxt_any))
return -1;
mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
- PROT_READ|PROT_WRITE, ctxt.privregs_pfn);
+ PROT_READ|PROT_WRITE, ctxt->privregs_pfn);
if (mem == NULL) {
ERROR("cannot map privreg page");
return -1;
/* vcpu context */
for (i = 0; i <= info->max_vcpu_id; i++) {
/* A copy of the CPU context of the guest. */
- vcpu_guest_context_t ctxt;
+ vcpu_guest_context_any_t ctxt_any;
if (!__test_bit(i, vcpumap))
continue;
- if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, i, &ctxt))
+ if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, i, &ctxt_any))
goto out;
// system context of vcpu is sent as hvm context.
int
xc_core_arch_context_get(struct xc_core_arch_context* arch_ctxt,
- vcpu_guest_context_t* ctxt,
+ vcpu_guest_context_any_t* ctxt_any,
int xc_handle, uint32_t domid)
{
+ vcpu_guest_context_t *ctxt = &ctxt_any->c;
mapped_regs_t* mapped_regs;
if ( ctxt->privregs_pfn == VGC_PRIVREGS_HVM )
xc_core_arch_context_free(struct xc_core_arch_context* arch_ctxt);
int
xc_core_arch_context_get(struct xc_core_arch_context* arch_ctxt,
- vcpu_guest_context_t* ctxt,
+ vcpu_guest_context_any_t* ctxt,
int xc_handle, uint32_t domid);
int
xc_core_arch_context_get_shdr(struct xc_core_arch_context* arch_ctxt,