mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
Make monitor command tables const
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5399 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
7a786a46b0
commit
8662d656ea
1 changed files with 22 additions and 22 deletions
44
monitor.c
44
monitor.c
|
@ -66,8 +66,8 @@ typedef struct term_cmd_t {
|
|||
static CharDriverState *monitor_hd[MAX_MON];
|
||||
static int hide_banner;
|
||||
|
||||
static term_cmd_t term_cmds[];
|
||||
static term_cmd_t info_cmds[];
|
||||
static const term_cmd_t term_cmds[];
|
||||
static const term_cmd_t info_cmds[];
|
||||
|
||||
static uint8_t term_outbuf[1024];
|
||||
static int term_outbuf_index;
|
||||
|
@ -175,9 +175,9 @@ static int compare_cmd(const char *name, const char *list)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void help_cmd1(term_cmd_t *cmds, const char *prefix, const char *name)
|
||||
static void help_cmd1(const term_cmd_t *cmds, const char *prefix, const char *name)
|
||||
{
|
||||
term_cmd_t *cmd;
|
||||
const term_cmd_t *cmd;
|
||||
|
||||
for(cmd = cmds; cmd->name != NULL; cmd++) {
|
||||
if (!name || !strcmp(name, cmd->name))
|
||||
|
@ -192,7 +192,7 @@ static void help_cmd(const char *name)
|
|||
} else {
|
||||
help_cmd1(term_cmds, "", name);
|
||||
if (name && !strcmp(name, "log")) {
|
||||
CPULogItem *item;
|
||||
const CPULogItem *item;
|
||||
term_printf("Log items (comma separated):\n");
|
||||
term_printf("%-10s %s\n", "none", "remove all logs");
|
||||
for(item = cpu_log_items; item->mask != 0; item++) {
|
||||
|
@ -221,7 +221,7 @@ static void do_commit(const char *device)
|
|||
|
||||
static void do_info(const char *item)
|
||||
{
|
||||
term_cmd_t *cmd;
|
||||
const term_cmd_t *cmd;
|
||||
void (*handler)(void);
|
||||
|
||||
if (!item)
|
||||
|
@ -1378,7 +1378,7 @@ static void do_inject_nmi(int cpu_index)
|
|||
}
|
||||
#endif
|
||||
|
||||
static term_cmd_t term_cmds[] = {
|
||||
static const term_cmd_t term_cmds[] = {
|
||||
{ "help|?", "s?", do_help,
|
||||
"[cmd]", "show the help" },
|
||||
{ "commit", "s", do_commit,
|
||||
|
@ -1460,7 +1460,7 @@ static term_cmd_t term_cmds[] = {
|
|||
{ NULL, NULL, },
|
||||
};
|
||||
|
||||
static term_cmd_t info_cmds[] = {
|
||||
static const term_cmd_t info_cmds[] = {
|
||||
{ "version", "", do_info_version,
|
||||
"", "show the version of qemu" },
|
||||
{ "network", "", do_info_network,
|
||||
|
@ -1533,12 +1533,12 @@ static jmp_buf expr_env;
|
|||
typedef struct MonitorDef {
|
||||
const char *name;
|
||||
int offset;
|
||||
target_long (*get_value)(struct MonitorDef *md, int val);
|
||||
target_long (*get_value)(const struct MonitorDef *md, int val);
|
||||
int type;
|
||||
} MonitorDef;
|
||||
|
||||
#if defined(TARGET_I386)
|
||||
static target_long monitor_get_pc (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_pc (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1548,7 +1548,7 @@ static target_long monitor_get_pc (struct MonitorDef *md, int val)
|
|||
#endif
|
||||
|
||||
#if defined(TARGET_PPC)
|
||||
static target_long monitor_get_ccr (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_ccr (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
unsigned int u;
|
||||
|
@ -1564,7 +1564,7 @@ static target_long monitor_get_ccr (struct MonitorDef *md, int val)
|
|||
return u;
|
||||
}
|
||||
|
||||
static target_long monitor_get_msr (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_msr (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1572,7 +1572,7 @@ static target_long monitor_get_msr (struct MonitorDef *md, int val)
|
|||
return env->msr;
|
||||
}
|
||||
|
||||
static target_long monitor_get_xer (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_xer (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1580,7 +1580,7 @@ static target_long monitor_get_xer (struct MonitorDef *md, int val)
|
|||
return ppc_load_xer(env);
|
||||
}
|
||||
|
||||
static target_long monitor_get_decr (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_decr (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1588,7 +1588,7 @@ static target_long monitor_get_decr (struct MonitorDef *md, int val)
|
|||
return cpu_ppc_load_decr(env);
|
||||
}
|
||||
|
||||
static target_long monitor_get_tbu (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_tbu (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1596,7 +1596,7 @@ static target_long monitor_get_tbu (struct MonitorDef *md, int val)
|
|||
return cpu_ppc_load_tbu(env);
|
||||
}
|
||||
|
||||
static target_long monitor_get_tbl (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_tbl (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1607,7 +1607,7 @@ static target_long monitor_get_tbl (struct MonitorDef *md, int val)
|
|||
|
||||
#if defined(TARGET_SPARC)
|
||||
#ifndef TARGET_SPARC64
|
||||
static target_long monitor_get_psr (struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_psr (const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1616,7 +1616,7 @@ static target_long monitor_get_psr (struct MonitorDef *md, int val)
|
|||
}
|
||||
#endif
|
||||
|
||||
static target_long monitor_get_reg(struct MonitorDef *md, int val)
|
||||
static target_long monitor_get_reg(const struct MonitorDef *md, int val)
|
||||
{
|
||||
CPUState *env = mon_get_cpu();
|
||||
if (!env)
|
||||
|
@ -1625,7 +1625,7 @@ static target_long monitor_get_reg(struct MonitorDef *md, int val)
|
|||
}
|
||||
#endif
|
||||
|
||||
static MonitorDef monitor_defs[] = {
|
||||
static const MonitorDef monitor_defs[] = {
|
||||
#ifdef TARGET_I386
|
||||
|
||||
#define SEG(name, seg) \
|
||||
|
@ -1876,7 +1876,7 @@ static void expr_error(const char *fmt)
|
|||
/* return 0 if OK, -1 if not found, -2 if no CPU defined */
|
||||
static int get_monitor_def(target_long *pval, const char *name)
|
||||
{
|
||||
MonitorDef *md;
|
||||
const MonitorDef *md;
|
||||
void *ptr;
|
||||
|
||||
for(md = monitor_defs; md->name != NULL; md++) {
|
||||
|
@ -2170,7 +2170,7 @@ static void monitor_handle_command(const char *cmdline)
|
|||
const char *p, *pstart, *typestr;
|
||||
char *q;
|
||||
int c, nb_args, len, i, has_arg;
|
||||
term_cmd_t *cmd;
|
||||
const term_cmd_t *cmd;
|
||||
char cmdname[256];
|
||||
char buf[1024];
|
||||
void *str_allocated[MAX_ARGS];
|
||||
|
@ -2607,7 +2607,7 @@ void readline_find_completion(const char *cmdline)
|
|||
char *args[MAX_ARGS];
|
||||
int nb_args, i, len;
|
||||
const char *ptype, *str;
|
||||
term_cmd_t *cmd;
|
||||
const term_cmd_t *cmd;
|
||||
const KeyDef *key;
|
||||
|
||||
parse_cmdline(cmdline, &nb_args, args);
|
||||
|
|
Loading…
Reference in a new issue