int xc_hvm_set_mem_type( xc_interface *xch, domid_t dom, hvmmem_type_t mem_type, uint64_t first_pfn, uint64_t nr) { DECLARE_HYPERCALL_BUFFER(struct xen_hvm_set_mem_type, arg); int rc; arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); if ( arg == NULL ) { PERROR("Could not allocate memory for xc_hvm_set_mem_type hypercall"); return -1; } arg->domid = dom; arg->hvmmem_type = mem_type; arg->first_pfn = first_pfn; arg->nr = nr; rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, HVMOP_set_mem_type, HYPERCALL_BUFFER_AS_ARG(arg)); xc_hypercall_buffer_free(xch, arg); return rc; }
int xc_hvm_inject_trap( xc_interface *xch, domid_t dom, int vcpu, uint32_t vector, uint32_t type, uint32_t error_code, uint32_t insn_len, uint64_t cr2) { DECLARE_HYPERCALL_BUFFER(struct xen_hvm_inject_trap, arg); int rc; arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); if ( arg == NULL ) { PERROR("Could not allocate memory for xc_hvm_inject_trap hypercall"); return -1; } arg->domid = dom; arg->vcpuid = vcpu; arg->vector = vector; arg->type = type; arg->error_code = error_code; arg->insn_len = insn_len; arg->cr2 = cr2; rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, HVMOP_inject_trap, HYPERCALL_BUFFER_AS_ARG(arg)); xc_hypercall_buffer_free(xch, arg); return rc; }
int xc_hvm_inject_msi( xc_interface *xch, domid_t dom, uint64_t addr, uint32_t data) { DECLARE_HYPERCALL_BUFFER(struct xen_hvm_inject_msi, arg); int rc; arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); if ( arg == NULL ) { PERROR("Could not allocate memory for xc_hvm_inject_msi hypercall"); return -1; } arg->domid = dom; arg->addr = addr; arg->data = data; rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, HVMOP_inject_msi, HYPERCALL_BUFFER_AS_ARG(arg)); xc_hypercall_buffer_free(xch, arg); return rc; }
int xc_hvm_track_dirty_vram( xc_interface *xch, domid_t dom, uint64_t first_pfn, uint64_t nr, unsigned long *dirty_bitmap) { DECLARE_HYPERCALL_BOUNCE(dirty_bitmap, (nr+7) / 8, XC_HYPERCALL_BUFFER_BOUNCE_OUT); DECLARE_HYPERCALL_BUFFER(struct xen_hvm_track_dirty_vram, arg); int rc; arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); if ( arg == NULL || xc_hypercall_bounce_pre(xch, dirty_bitmap) ) { PERROR("Could not bounce memory for xc_hvm_track_dirty_vram hypercall"); rc = -1; goto out; } arg->domid = dom; arg->first_pfn = first_pfn; arg->nr = nr; set_xen_guest_handle(arg->dirty_bitmap, dirty_bitmap); rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, HVMOP_track_dirty_vram, HYPERCALL_BUFFER_AS_ARG(arg)); out: xc_hypercall_buffer_free(xch, arg); xc_hypercall_bounce_post(xch, dirty_bitmap); return rc; }
int xc_hvm_set_isa_irq_level( xc_interface *xch, domid_t dom, uint8_t isa_irq, unsigned int level) { DECLARE_HYPERCALL_BUFFER(struct xen_hvm_set_isa_irq_level, arg); int rc; arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); if ( arg == NULL ) { PERROR("Could not allocate memory for xc_hvm_set_isa_irq_level hypercall"); return -1; } arg->domid = dom; arg->isa_irq = isa_irq; arg->level = level; rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, HVMOP_set_isa_irq_level, HYPERCALL_BUFFER_AS_ARG(arg)); xc_hypercall_buffer_free(xch, arg); return rc; }
int xc_hvm_set_pci_link_route( xc_interface *xch, domid_t dom, uint8_t link, uint8_t isa_irq) { DECLARE_HYPERCALL_BUFFER(struct xen_hvm_set_pci_link_route, arg); int rc; arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); if ( arg == NULL ) { PERROR("Could not allocate memory for xc_hvm_set_pci_link_route hypercall"); return -1; } arg->domid = dom; arg->link = link; arg->isa_irq = isa_irq; rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op, HVMOP_set_pci_link_route, HYPERCALL_BUFFER_AS_ARG(arg)); xc_hypercall_buffer_free(xch, arg); return rc; }
int xc_kexec_get_range(xc_interface *xch, int range, int nr, uint64_t *size, uint64_t *start) { DECLARE_HYPERCALL_BUFFER(xen_kexec_range_t, get_range); int ret = -1; get_range = xc_hypercall_buffer_alloc(xch, get_range, sizeof(*get_range)); if ( get_range == NULL ) { PERROR("Could not alloc bounce buffer for kexec_get_range hypercall"); goto out; } get_range->range = range; get_range->nr = nr; ret = xencall2(xch->xcall, __HYPERVISOR_kexec_op, KEXEC_CMD_kexec_get_range, HYPERCALL_BUFFER_AS_ARG(get_range)); *size = get_range->size; *start = get_range->start; out: xc_hypercall_buffer_free(xch, get_range); return ret; }
long do_memory_op(xc_interface *xch, int cmd, void *arg, size_t len) { DECLARE_HYPERCALL_BOUNCE(arg, len, XC_HYPERCALL_BUFFER_BOUNCE_BOTH); long ret = -1; if ( xc_hypercall_bounce_pre(xch, arg) ) { PERROR("Could not bounce memory for XENMEM hypercall"); goto out1; } ret = xencall2(xch->xcall, __HYPERVISOR_memory_op, cmd, HYPERCALL_BUFFER_AS_ARG(arg)); xc_hypercall_bounce_post(xch, arg); out1: return ret; }
int xc_kexec_exec(xc_interface *xch, int type) { DECLARE_HYPERCALL_BUFFER(xen_kexec_exec_t, exec); int ret = -1; exec = xc_hypercall_buffer_alloc(xch, exec, sizeof(*exec)); if ( exec == NULL ) { PERROR("Could not alloc bounce buffer for kexec_exec hypercall"); goto out; } exec->type = type; ret = xencall2(xch->xcall, __HYPERVISOR_kexec_op, KEXEC_CMD_kexec, HYPERCALL_BUFFER_AS_ARG(exec)); out: xc_hypercall_buffer_free(xch, exec); return ret; }
int xc_kexec_unload(xc_interface *xch, int type) { DECLARE_HYPERCALL_BUFFER(xen_kexec_unload_t, unload); int ret = -1; unload = xc_hypercall_buffer_alloc(xch, unload, sizeof(*unload)); if ( unload == NULL ) { PERROR("Could not alloc buffer for kexec unload hypercall"); goto out; } unload->type = type; ret = xencall2(xch->xcall, __HYPERVISOR_kexec_op, KEXEC_CMD_kexec_unload, HYPERCALL_BUFFER_AS_ARG(unload)); out: xc_hypercall_buffer_free(xch, unload); return ret; }
int xc_kexec_load(xc_interface *xch, uint8_t type, uint16_t arch, uint64_t entry_maddr, uint32_t nr_segments, xen_kexec_segment_t *segments) { int ret = -1; DECLARE_HYPERCALL_BOUNCE(segments, sizeof(*segments) * nr_segments, XC_HYPERCALL_BUFFER_BOUNCE_IN); DECLARE_HYPERCALL_BUFFER(xen_kexec_load_t, load); if ( xc_hypercall_bounce_pre(xch, segments) ) { PERROR("Could not allocate bounce buffer for kexec load hypercall"); goto out; } load = xc_hypercall_buffer_alloc(xch, load, sizeof(*load)); if ( load == NULL ) { PERROR("Could not allocate buffer for kexec load hypercall"); goto out; } load->type = type; load->arch = arch; load->entry_maddr = entry_maddr; load->nr_segments = nr_segments; set_xen_guest_handle(load->segments.h, segments); ret = xencall2(xch->xcall, __HYPERVISOR_kexec_op, KEXEC_CMD_kexec_load, HYPERCALL_BUFFER_AS_ARG(load)); out: xc_hypercall_buffer_free(xch, load); xc_hypercall_bounce_post(xch, segments); return ret; }
int HYPERVISOR_set_trap_table(trap_info_t *table) { return xencall2(__HYPERVISOR_set_trap_table, (ulong)table); }
int HYPERVISOR_event_channel_op(void *op) { return xencall2(__HYPERVISOR_event_channel_op, (ulong)op); }