static void cpu_debug_handler(CPUState *env)
{
gdb_set_stop_cpu(env);
- debug_requested = EXCP_DEBUG;
- vm_stop(EXCP_DEBUG);
+ debug_requested = VMSTOP_DEBUG;
+ vm_stop(VMSTOP_DEBUG);
}
#ifdef CONFIG_LINUX
const char *type;
int ret;
- if (running || (reason != EXCP_DEBUG && reason != EXCP_INTERRUPT) ||
- s->state == RS_INACTIVE || s->state == RS_SYSCALL)
+ if (running || (reason != VMSTOP_DEBUG && reason != VMSTOP_USER) ||
+ s->state == RS_INACTIVE || s->state == RS_SYSCALL) {
return;
-
+ }
/* disable single step if it was enable */
cpu_single_step(env, 0);
- if (reason == EXCP_DEBUG) {
+ if (reason == VMSTOP_DEBUG) {
if (env->watchpoint_hit) {
switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) {
case BP_MEM_READ:
gdb_current_syscall_cb = cb;
s->state = RS_SYSCALL;
#ifndef CONFIG_USER_ONLY
- vm_stop(EXCP_DEBUG);
+ vm_stop(VMSTOP_DEBUG);
#endif
s->state = RS_IDLE;
va_start(va, fmt);
if (vm_running) {
/* when the CPU is running, we cannot do anything except stop
it when receiving a char */
- vm_stop(EXCP_INTERRUPT);
+ vm_stop(VMSTOP_USER);
} else
#endif
{
{
switch (event) {
case CHR_EVENT_OPENED:
- vm_stop(EXCP_INTERRUPT);
+ vm_stop(VMSTOP_USER);
gdb_has_xml = 0;
break;
default:
#ifndef _WIN32
static void gdb_sigterm_handler(int signal)
{
- if (vm_running)
- vm_stop(EXCP_INTERRUPT);
+ if (vm_running) {
+ vm_stop(VMSTOP_USER);
+ }
}
#endif
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
s->bus->dma->ops->add_status(s->bus->dma, op);
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
- vm_stop(0);
+ vm_stop(VMSTOP_DISKFULL);
} else {
if (op & BM_STATUS_DMA_RETRY) {
dma_buf_commit(s, 0);
r->status |= SCSI_REQ_STATUS_RETRY | type;
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
- vm_stop(0);
+ vm_stop(VMSTOP_DISKFULL);
} else {
if (type == SCSI_REQ_STATUS_RETRY_READ) {
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, 0);
req->next = s->rq;
s->rq = req;
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
- vm_stop(0);
+ vm_stop(VMSTOP_DISKFULL);
} else {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);
case WDT_PAUSE: /* same as 'stop' command in monitor */
watchdog_mon_event("pause");
- vm_stop(0);
+ vm_stop(VMSTOP_WATCHDOG);
break;
case WDT_DEBUG:
if (ret < 0) {
cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE);
- vm_stop(0);
+ vm_stop(VMSTOP_PANIC);
env->exit_request = 1;
}
if (env->exit_request) {
int old_vm_running = vm_running;
DPRINTF("done iterating\n");
- vm_stop(0);
+ vm_stop(VMSTOP_MIGRATE);
if ((qemu_savevm_state_complete(s->mon, s->file)) < 0) {
if (old_vm_running) {
*/
static int do_stop(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- vm_stop(EXCP_INTERRUPT);
+ vm_stop(VMSTOP_USER);
return 0;
}
int saved_vm_running = vm_running;
const char *name = qdict_get_str(qdict, "name");
- vm_stop(0);
+ vm_stop(VMSTOP_LOADVM);
if (load_vmstate(name) == 0 && saved_vm_running) {
vm_start();
int ret;
saved_vm_running = vm_running;
- vm_stop(0);
+ vm_stop(VMSTOP_SAVEVM);
if (qemu_savevm_state_blocked(mon)) {
ret = -EINVAL;
}
saved_vm_running = vm_running;
- vm_stop(0);
+ vm_stop(VMSTOP_SAVEVM);
memset(sn, 0, sizeof(*sn));
void *opaque);
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
+#define VMSTOP_USER 0
+#define VMSTOP_DEBUG 1
+#define VMSTOP_SHUTDOWN 2
+#define VMSTOP_DISKFULL 3
+#define VMSTOP_WATCHDOG 4
+#define VMSTOP_PANIC 5
+#define VMSTOP_SAVEVM 6
+#define VMSTOP_LOADVM 7
+#define VMSTOP_MIGRATE 8
+
void vm_start(void);
void vm_stop(int reason);
if (qemu_shutdown_requested()) {
monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
if (no_shutdown) {
- vm_stop(0);
+ vm_stop(VMSTOP_SHUTDOWN);
no_shutdown = 0;
} else
break;