static void xen_eventfd_add(MemoryListener *listener,
MemoryRegionSection *section,
- bool match_data, uint64_t data, int fd)
+ bool match_data, uint64_t data,
+ EventNotifier *e)
{
}
static void xen_eventfd_del(MemoryListener *listener,
MemoryRegionSection *section,
- bool match_data, uint64_t data, int fd)
+ bool match_data, uint64_t data,
+ EventNotifier *e)
{
}
"data: %"PRIx64", count: %" FMT_ioreq_size ", size: %" FMT_ioreq_size "\n",
req->state, req->data_is_ptr, req->addr,
req->data, req->count, req->size);
- destroy_hvm_domain();
+ destroy_hvm_domain(false);
return;
}
*/
if (runstate_is_running()) {
if (qemu_shutdown_requested_get()) {
- destroy_hvm_domain();
+ destroy_hvm_domain(false);
}
if (qemu_reset_requested_get()) {
qemu_system_reset(VMRESET_REPORT);
+ destroy_hvm_domain(true);
}
}
return 0;
}
-void destroy_hvm_domain(void)
+void destroy_hvm_domain(bool reboot)
{
XenXC xc_handle;
int sts;
if (xc_handle == XC_HANDLER_INITIAL_VALUE) {
fprintf(stderr, "Cannot acquire xenctrl handle\n");
} else {
- sts = xc_domain_shutdown(xc_handle, xen_domid, SHUTDOWN_poweroff);
+ sts = xc_domain_shutdown(xc_handle, xen_domid,
+ reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);
if (sts != 0) {
- fprintf(stderr, "? xc_domain_shutdown failed to issue poweroff, "
- "sts %d, %s\n", sts, strerror(errno));
+ fprintf(stderr, "xc_domain_shutdown failed to issue %s, "
+ "sts %d, %s\n", reboot ? "reboot" : "poweroff",
+ sts, strerror(errno));
} else {
- fprintf(stderr, "Issued domain %d poweroff\n", xen_domid);
+ fprintf(stderr, "Issued domain %d %s\n", xen_domid,
+ reboot ? "reboot" : "poweroff");
}
xc_interface_close(xc_handle);
}
{
framebuffer = mr;
}
+
+void xen_shutdown_fatal_error(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "Will destroy the domain.\n");
+ /* destroy the domain */
+ qemu_system_shutdown_request();
+}