va_end(ap);
}
+static int monitor_fprintf(FILE *stream, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ term_vprintf(fmt, ap);
+ va_end(ap);
+ return 0;
+}
+
static int compare_cmd(const char *name, const char *list)
{
const char *p, *pstart;
cmd->handler();
}
+static void do_info_version(void)
+{
+ term_printf("%s\n", QEMU_VERSION);
+}
+
static void do_info_network(void)
{
int i, j;
static void do_info_registers(void)
{
#ifdef TARGET_I386
- cpu_dump_state(cpu_single_env, stdout, X86_DUMP_FPU | X86_DUMP_CCOP);
+ cpu_dump_state(cpu_single_env, stdout, monitor_fprintf,
+ X86_DUMP_FPU | X86_DUMP_CCOP);
#else
- cpu_dump_state(cpu_single_env, stdout, 0);
+ cpu_dump_state(cpu_single_env, stdout, monitor_fprintf,
+ 0);
#endif
}
if (!str)
break;
term_printf("%d: '%s'\n", i, str);
+ i++;
}
}
static void mem_print(uint32_t *pstart, int *plast_prot,
uint32_t end, int prot)
{
- if (prot != *plast_prot) {
+ int prot1;
+ prot1 = *plast_prot;
+ if (prot != prot1) {
if (*pstart != -1) {
term_printf("%08x-%08x %08x %c%c%c\n",
*pstart, end, end - *pstart,
- prot & PG_USER_MASK ? 'u' : '-',
+ prot1 & PG_USER_MASK ? 'u' : '-',
'r',
- prot & PG_RW_MASK ? 'w' : '-');
+ prot1 & PG_RW_MASK ? 'w' : '-');
}
if (prot != 0)
*pstart = end;
};
static term_cmd_t info_cmds[] = {
+ { "version", "", do_info_version,
+ "", "show the version of qemu" },
{ "network", "", do_info_network,
"", "show the network state" },
{ "block", "", do_info_block,
#if defined(TARGET_SPARC)
static int monitor_get_psr (struct MonitorDef *md, int val)
{
- return (0<<28) | (4<<24) | cpu_single_env->psr \
- | (cpu_single_env->psrs? PSR_S : 0) \
- | (cpu_single_env->psrs? PSR_PS : 0) \
- | (cpu_single_env->psret? PSR_ET : 0) \
- | cpu_single_env->cwp;
+ return GET_PSR(cpu_single_env);
}
static int monitor_get_reg(struct MonitorDef *md, int val)
completion_index = strlen(str);
bdrv_iterate(block_completion_it, (void *)str);
break;
+ case 's':
+ /* XXX: more generic ? */
+ if (!strcmp(cmd->name, "info")) {
+ completion_index = strlen(str);
+ for(cmd = info_cmds; cmd->name != NULL; cmd++) {
+ cmd_completion(str, cmd->name);
+ }
+ }
+ break;
default:
break;
}