int HYPERVISOR_shutdown(int reboot) { sched_shutdown_t arg; arg.reason = reboot? SHUTDOWN_reboot : SHUTDOWN_poweroff; return xencall3(__HYPERVISOR_sched_op, SCHEDOP_shutdown, (ulong)&arg); }
long HYPERVISOR_set_timer_op(uvlong timeout) { ulong hi, lo; hi = timeout>>32; lo = timeout; return xencall3(__HYPERVISOR_set_timer_op, lo, hi); }
int xendevicemodel_xcall(xendevicemodel_handle *dmod, domid_t domid, unsigned int nr_bufs, struct xendevicemodel_buf bufs[]) { int ret = -1; void **xcall_bufs; xen_dm_op_buf_t *op_bufs = NULL; unsigned int i; xcall_bufs = calloc(nr_bufs, sizeof(*xcall_bufs)); if (xcall_bufs == NULL) goto out; op_bufs = xencall_alloc_buffer(dmod->xcall, sizeof(xen_dm_op_buf_t) * nr_bufs); if (op_bufs == NULL) goto out; for (i = 0; i < nr_bufs; i++) { xcall_bufs[i] = xencall_alloc_buffer(dmod->xcall, bufs[i].size); if ( xcall_bufs[i] == NULL ) goto out; memcpy(xcall_bufs[i], bufs[i].ptr, bufs[i].size); set_xen_guest_handle_raw(op_bufs[i].h, xcall_bufs[i]); op_bufs[i].size = bufs[i].size; } ret = xencall3(dmod->xcall, __HYPERVISOR_dm_op, domid, nr_bufs, (unsigned long)op_bufs); if (ret < 0) goto out; for (i = 0; i < nr_bufs; i++) memcpy(bufs[i].ptr, xcall_bufs[i], bufs[i].size); out: if (xcall_bufs) for (i = 0; i < nr_bufs; i++) xencall_free_buffer(dmod->xcall, xcall_bufs[i]); xencall_free_buffer(dmod->xcall, op_bufs); free(xcall_bufs); return ret; }
int HYPERVISOR_yield(void) { return xencall3(__HYPERVISOR_sched_op, SCHEDOP_yield, 0); }
int HYPERVISOR_stack_switch(ulong ss, ulong esp) { return xencall3(__HYPERVISOR_stack_switch, ss, esp); }
int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries) { return xencall3(__HYPERVISOR_set_gdt, (ulong)frame_list, entries); }
int HYPERVISOR_memory_op(int cmd, struct xen_memory_reservation *arg) { return xencall3(__HYPERVISOR_memory_op, cmd, (ulong)arg); }
int HYPERVISOR_xen_version(int cmd, void *arg) { return xencall3(__HYPERVISOR_xen_version, cmd, (ulong)arg); }
int HYPERVISOR_multicall(void *call_list, int nr_calls) { return xencall3(__HYPERVISOR_multicall, (ulong)call_list, nr_calls); }
int HYPERVISOR_block(void) { return xencall3(__HYPERVISOR_sched_op, SCHEDOP_block, 0); }