@samitouri / QOSamiQemu / commits / 53e6619ee0

target/ppc: Remove MonitorDef register entries available via gdbstub

All these registers are already provided by via gdbstub parsed XML and handler by the gdb_get_register() helper in the monitor/hmp.c file. Remove as now unreachable code. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260219191955.83815-21-philmd@linaro.org>

Philippe Mathieu-Daudé committed Feb 15, 2026 at 13:34 UTC 53e6619ee0d668d1d19cef7e456e9467905af6d4
1 file changed -132
target/ppc/ppc-qmp-cmds.c
-132
@@ -33,54 +33,6 @@
33 #include "cpu-models.h"
34 #include "cpu-qom.h"
35
36 -static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
37 - int val)
38 -{
39 - CPUArchState *env = mon_get_cpu_env(mon);
40 - unsigned int u;
41 -
42 - u = ppc_get_cr(env);
43 -
44 - return u;
45 -}
46 -
47 -static target_long monitor_get_xer(Monitor *mon, const struct MonitorDef *md,
48 - int val)
49 -{
50 - CPUArchState *env = mon_get_cpu_env(mon);
51 - return cpu_read_xer(env);
52 -}
53 -
54 -static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
55 - int val)
56 -{
57 - CPUArchState *env = mon_get_cpu_env(mon);
58 - if (!env->tb_env) {
59 - return 0;
60 - }
61 - return cpu_ppc_load_decr(env);
62 -}
63 -
64 -static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
65 - int val)
66 -{
67 - CPUArchState *env = mon_get_cpu_env(mon);
68 - if (!env->tb_env) {
69 - return 0;
70 - }
71 - return cpu_ppc_load_tbu(env);
72 -}
73 -
74 -static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
75 - int val)
76 -{
77 - CPUArchState *env = mon_get_cpu_env(mon);
78 - if (!env->tb_env) {
79 - return 0;
80 - }
81 - return cpu_ppc_load_tbl(env);
82 -}
83 -
36 void hmp_info_tlb(Monitor *mon, const QDict *qdict)
37 {
38 CPUArchState *env1 = mon_get_cpu_env(mon);
@@ -92,90 +44,6 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
44 dump_mmu(env1);
45 }
46
95 -const MonitorDef monitor_defs[] = {
96 - { "fpscr", offsetof(CPUPPCState, fpscr) },
97 - /* Next instruction pointer */
98 - { "nip|pc", offsetof(CPUPPCState, nip) },
99 - { "lr", offsetof(CPUPPCState, lr) },
100 - { "ctr", offsetof(CPUPPCState, ctr) },
101 - { "decr", 0, &monitor_get_decr, },
102 - { "ccr|cr", 0, &monitor_get_ccr, },
103 - /* Machine state register */
104 - { "xer", 0, &monitor_get_xer },
105 - { "msr", offsetof(CPUPPCState, msr) },
106 - { "tbu", 0, &monitor_get_tbu, },
107 -#if defined(TARGET_PPC64)
108 - { "tb", 0, &monitor_get_tbl, },
109 -#else
110 - { "tbl", 0, &monitor_get_tbl, },
111 -#endif
112 - { NULL },
113 -};
114 -
115 -const MonitorDef *target_monitor_defs(void)
116 -{
117 - return monitor_defs;
118 -}
119 -
120 -static int ppc_cpu_get_reg_num(const char *numstr, int maxnum, int *pregnum)
121 -{
122 - int regnum;
123 - char *endptr = NULL;
124 -
125 - if (!*numstr) {
126 - return false;
127 - }
128 -
129 - regnum = strtoul(numstr, &endptr, 10);
130 - if (*endptr || (regnum >= maxnum)) {
131 - return false;
132 - }
133 - *pregnum = regnum;
134 -
135 - return true;
136 -}
137 -
138 -int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
139 -{
140 - int i, regnum;
141 - CPUPPCState *env = cpu_env(cs);
142 -
143 - /* General purpose registers */
144 - if ((qemu_tolower(name[0]) == 'r') &&
145 - ppc_cpu_get_reg_num(name + 1, ARRAY_SIZE(env->gpr), &regnum)) {
146 - *pval = env->gpr[regnum];
147 - return 0;
148 - }
149 -
150 - /* Floating point registers */
151 - if ((qemu_tolower(name[0]) == 'f') &&
152 - ppc_cpu_get_reg_num(name + 1, 32, &regnum)) {
153 - *pval = *cpu_fpr_ptr(env, regnum);
154 - return 0;
155 - }
156 -
157 - /* Special purpose registers */
158 - for (i = 0; i < ARRAY_SIZE(env->spr_cb); ++i) {
159 - ppc_spr_t *spr = &env->spr_cb[i];
160 -
161 - if (spr->name && (strcasecmp(name, spr->name) == 0)) {
162 - *pval = env->spr[i];
163 - return 0;
164 - }
165 - }
166 -
167 - /* Segment registers */
168 -#if !defined(CONFIG_USER_ONLY)
169 - if ((strncasecmp(name, "sr", 2) == 0) &&
170 - ppc_cpu_get_reg_num(name + 2, ARRAY_SIZE(env->sr), &regnum)) {
171 - *pval = env->sr[regnum];
172 - return 0;
173 - }
174 -#endif
175 -
176 - return -EINVAL;
177 -}
178 -
47 CpuModelExpansionInfo *
48 qmp_query_cpu_model_expansion(CpuModelExpansionType type,
49 CpuModelInfo *model,