Make monitor command tables const
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5399 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/monitor.c b/monitor.c
index ee48984..038b2f9 100644
--- a/monitor.c
+++ b/monitor.c
@@ -66,8 +66,8 @@
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 @@
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 @@
} 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_info(const char *item)
{
- term_cmd_t *cmd;
+ const term_cmd_t *cmd;
void (*handler)(void);
if (!item)
@@ -1378,7 +1378,7 @@
}
#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 @@
{ 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 @@
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 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
#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 @@
}
#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 @@
}
#endif
-static MonitorDef monitor_defs[] = {
+static const MonitorDef monitor_defs[] = {
#ifdef TARGET_I386
#define SEG(name, seg) \
@@ -1876,7 +1876,7 @@
/* 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 @@
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 @@
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);