Revision 0268d97c monitor.c
b/monitor.c | ||
---|---|---|
491 | 491 |
return 0; |
492 | 492 |
} |
493 | 493 |
|
494 |
static int mon_set_cpu(int cpu_index); |
|
495 |
static void handle_user_command(Monitor *mon, const char *cmdline); |
|
496 |
|
|
497 |
static int do_hmp_passthrough(Monitor *mon, const QDict *params, |
|
498 |
QObject **ret_data) |
|
499 |
{ |
|
500 |
int ret = 0; |
|
501 |
Monitor *old_mon, hmp; |
|
502 |
CharDriverState mchar; |
|
503 |
|
|
504 |
memset(&hmp, 0, sizeof(hmp)); |
|
505 |
qemu_chr_init_mem(&mchar); |
|
506 |
hmp.chr = &mchar; |
|
507 |
|
|
508 |
old_mon = cur_mon; |
|
509 |
cur_mon = &hmp; |
|
510 |
|
|
511 |
if (qdict_haskey(params, "cpu-index")) { |
|
512 |
ret = mon_set_cpu(qdict_get_int(params, "cpu-index")); |
|
513 |
if (ret < 0) { |
|
514 |
cur_mon = old_mon; |
|
515 |
qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number"); |
|
516 |
goto out; |
|
517 |
} |
|
518 |
} |
|
519 |
|
|
520 |
handle_user_command(&hmp, qdict_get_str(params, "command-line")); |
|
521 |
cur_mon = old_mon; |
|
522 |
|
|
523 |
if (qemu_chr_mem_osize(hmp.chr) > 0) { |
|
524 |
*ret_data = QOBJECT(qemu_chr_mem_to_qs(hmp.chr)); |
|
525 |
} |
|
526 |
|
|
527 |
out: |
|
528 |
qemu_chr_close_mem(hmp.chr); |
|
529 |
return ret; |
|
530 |
} |
|
531 |
|
|
494 | 532 |
static int compare_cmd(const char *name, const char *list) |
495 | 533 |
{ |
496 | 534 |
const char *p, *pstart; |
Also available in: Unified diff