xref: /qemu/target/sparc/monitor.c (revision d59f0c92141842bab95f26d6a7847b2523a604d4)
1bf957284SPavel Butsykin /*
2bf957284SPavel Butsykin  * QEMU monitor
3bf957284SPavel Butsykin  *
4bf957284SPavel Butsykin  * Copyright (c) 2003-2004 Fabrice Bellard
5bf957284SPavel Butsykin  *
6bf957284SPavel Butsykin  * Permission is hereby granted, free of charge, to any person obtaining a copy
7bf957284SPavel Butsykin  * of this software and associated documentation files (the "Software"), to deal
8bf957284SPavel Butsykin  * in the Software without restriction, including without limitation the rights
9bf957284SPavel Butsykin  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10bf957284SPavel Butsykin  * copies of the Software, and to permit persons to whom the Software is
11bf957284SPavel Butsykin  * furnished to do so, subject to the following conditions:
12bf957284SPavel Butsykin  *
13bf957284SPavel Butsykin  * The above copyright notice and this permission notice shall be included in
14bf957284SPavel Butsykin  * all copies or substantial portions of the Software.
15bf957284SPavel Butsykin  *
16bf957284SPavel Butsykin  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17bf957284SPavel Butsykin  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18bf957284SPavel Butsykin  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19bf957284SPavel Butsykin  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20bf957284SPavel Butsykin  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21bf957284SPavel Butsykin  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22bf957284SPavel Butsykin  * THE SOFTWARE.
23bf957284SPavel Butsykin  */
24db5ebe5fSPeter Maydell #include "qemu/osdep.h"
25bf957284SPavel Butsykin #include "cpu.h"
26bf957284SPavel Butsykin #include "monitor/monitor.h"
27bf957284SPavel Butsykin #include "monitor/hmp-target.h"
28275307aaSMarkus Armbruster #include "monitor/hmp.h"
29bf957284SPavel Butsykin 
30bf957284SPavel Butsykin 
hmp_info_tlb(Monitor * mon,const QDict * qdict)31bf957284SPavel Butsykin void hmp_info_tlb(Monitor *mon, const QDict *qdict)
32bf957284SPavel Butsykin {
33e7cff9c6SKevin Wolf     CPUArchState *env1 = mon_get_cpu_env(mon);
34bf957284SPavel Butsykin 
35854e67feSThomas Huth     if (!env1) {
36854e67feSThomas Huth         monitor_printf(mon, "No CPU available\n");
37854e67feSThomas Huth         return;
38854e67feSThomas Huth     }
39fad866daSMarkus Armbruster     dump_mmu(env1);
40bf957284SPavel Butsykin }
41bf957284SPavel Butsykin 
42bf957284SPavel Butsykin #ifndef TARGET_SPARC64
monitor_get_psr(Monitor * mon,const struct MonitorDef * md,int val)4343cf067fSKevin Wolf static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
4443cf067fSKevin Wolf                                    int val)
45bf957284SPavel Butsykin {
46e7cff9c6SKevin Wolf     CPUArchState *env = mon_get_cpu_env(mon);
47bf957284SPavel Butsykin 
48bf957284SPavel Butsykin     return cpu_get_psr(env);
49bf957284SPavel Butsykin }
50bf957284SPavel Butsykin #endif
51bf957284SPavel Butsykin 
monitor_get_reg(Monitor * mon,const struct MonitorDef * md,int val)5243cf067fSKevin Wolf static target_long monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
5343cf067fSKevin Wolf                                    int val)
54bf957284SPavel Butsykin {
55e7cff9c6SKevin Wolf     CPUArchState *env = mon_get_cpu_env(mon);
56bf957284SPavel Butsykin     return env->regwptr[val];
57bf957284SPavel Butsykin }
58bf957284SPavel Butsykin 
59bf957284SPavel Butsykin const MonitorDef monitor_defs[] = {
60bf957284SPavel Butsykin     { "g0", offsetof(CPUSPARCState, gregs[0]) },
61bf957284SPavel Butsykin     { "g1", offsetof(CPUSPARCState, gregs[1]) },
62bf957284SPavel Butsykin     { "g2", offsetof(CPUSPARCState, gregs[2]) },
63bf957284SPavel Butsykin     { "g3", offsetof(CPUSPARCState, gregs[3]) },
64bf957284SPavel Butsykin     { "g4", offsetof(CPUSPARCState, gregs[4]) },
65bf957284SPavel Butsykin     { "g5", offsetof(CPUSPARCState, gregs[5]) },
66bf957284SPavel Butsykin     { "g6", offsetof(CPUSPARCState, gregs[6]) },
67bf957284SPavel Butsykin     { "g7", offsetof(CPUSPARCState, gregs[7]) },
68bf957284SPavel Butsykin     { "o0", 0, monitor_get_reg },
69bf957284SPavel Butsykin     { "o1", 1, monitor_get_reg },
70bf957284SPavel Butsykin     { "o2", 2, monitor_get_reg },
71bf957284SPavel Butsykin     { "o3", 3, monitor_get_reg },
72bf957284SPavel Butsykin     { "o4", 4, monitor_get_reg },
73bf957284SPavel Butsykin     { "o5", 5, monitor_get_reg },
74bf957284SPavel Butsykin     { "o6", 6, monitor_get_reg },
75bf957284SPavel Butsykin     { "o7", 7, monitor_get_reg },
76bf957284SPavel Butsykin     { "l0", 8, monitor_get_reg },
77bf957284SPavel Butsykin     { "l1", 9, monitor_get_reg },
78bf957284SPavel Butsykin     { "l2", 10, monitor_get_reg },
79bf957284SPavel Butsykin     { "l3", 11, monitor_get_reg },
80bf957284SPavel Butsykin     { "l4", 12, monitor_get_reg },
81bf957284SPavel Butsykin     { "l5", 13, monitor_get_reg },
82bf957284SPavel Butsykin     { "l6", 14, monitor_get_reg },
83bf957284SPavel Butsykin     { "l7", 15, monitor_get_reg },
84bf957284SPavel Butsykin     { "i0", 16, monitor_get_reg },
85bf957284SPavel Butsykin     { "i1", 17, monitor_get_reg },
86bf957284SPavel Butsykin     { "i2", 18, monitor_get_reg },
87bf957284SPavel Butsykin     { "i3", 19, monitor_get_reg },
88bf957284SPavel Butsykin     { "i4", 20, monitor_get_reg },
89bf957284SPavel Butsykin     { "i5", 21, monitor_get_reg },
90bf957284SPavel Butsykin     { "i6", 22, monitor_get_reg },
91bf957284SPavel Butsykin     { "i7", 23, monitor_get_reg },
92bf957284SPavel Butsykin     { "pc", offsetof(CPUSPARCState, pc) },
93bf957284SPavel Butsykin     { "npc", offsetof(CPUSPARCState, npc) },
94bf957284SPavel Butsykin     { "y", offsetof(CPUSPARCState, y) },
95bf957284SPavel Butsykin #ifndef TARGET_SPARC64
96bf957284SPavel Butsykin     { "psr", 0, &monitor_get_psr, },
97bf957284SPavel Butsykin     { "wim", offsetof(CPUSPARCState, wim) },
98bf957284SPavel Butsykin #endif
99bf957284SPavel Butsykin     { "tbr", offsetof(CPUSPARCState, tbr) },
100bf957284SPavel Butsykin     { "fsr", offsetof(CPUSPARCState, fsr) },
101bf957284SPavel Butsykin     { "f0", offsetof(CPUSPARCState, fpr[0].l.upper) },
102bf957284SPavel Butsykin     { "f1", offsetof(CPUSPARCState, fpr[0].l.lower) },
103bf957284SPavel Butsykin     { "f2", offsetof(CPUSPARCState, fpr[1].l.upper) },
104bf957284SPavel Butsykin     { "f3", offsetof(CPUSPARCState, fpr[1].l.lower) },
105bf957284SPavel Butsykin     { "f4", offsetof(CPUSPARCState, fpr[2].l.upper) },
106bf957284SPavel Butsykin     { "f5", offsetof(CPUSPARCState, fpr[2].l.lower) },
107bf957284SPavel Butsykin     { "f6", offsetof(CPUSPARCState, fpr[3].l.upper) },
108bf957284SPavel Butsykin     { "f7", offsetof(CPUSPARCState, fpr[3].l.lower) },
109bf957284SPavel Butsykin     { "f8", offsetof(CPUSPARCState, fpr[4].l.upper) },
110bf957284SPavel Butsykin     { "f9", offsetof(CPUSPARCState, fpr[4].l.lower) },
111bf957284SPavel Butsykin     { "f10", offsetof(CPUSPARCState, fpr[5].l.upper) },
112bf957284SPavel Butsykin     { "f11", offsetof(CPUSPARCState, fpr[5].l.lower) },
113bf957284SPavel Butsykin     { "f12", offsetof(CPUSPARCState, fpr[6].l.upper) },
114bf957284SPavel Butsykin     { "f13", offsetof(CPUSPARCState, fpr[6].l.lower) },
115bf957284SPavel Butsykin     { "f14", offsetof(CPUSPARCState, fpr[7].l.upper) },
116bf957284SPavel Butsykin     { "f15", offsetof(CPUSPARCState, fpr[7].l.lower) },
117bf957284SPavel Butsykin     { "f16", offsetof(CPUSPARCState, fpr[8].l.upper) },
118bf957284SPavel Butsykin     { "f17", offsetof(CPUSPARCState, fpr[8].l.lower) },
119bf957284SPavel Butsykin     { "f18", offsetof(CPUSPARCState, fpr[9].l.upper) },
120bf957284SPavel Butsykin     { "f19", offsetof(CPUSPARCState, fpr[9].l.lower) },
121bf957284SPavel Butsykin     { "f20", offsetof(CPUSPARCState, fpr[10].l.upper) },
122bf957284SPavel Butsykin     { "f21", offsetof(CPUSPARCState, fpr[10].l.lower) },
123bf957284SPavel Butsykin     { "f22", offsetof(CPUSPARCState, fpr[11].l.upper) },
124bf957284SPavel Butsykin     { "f23", offsetof(CPUSPARCState, fpr[11].l.lower) },
125bf957284SPavel Butsykin     { "f24", offsetof(CPUSPARCState, fpr[12].l.upper) },
126bf957284SPavel Butsykin     { "f25", offsetof(CPUSPARCState, fpr[12].l.lower) },
127bf957284SPavel Butsykin     { "f26", offsetof(CPUSPARCState, fpr[13].l.upper) },
128bf957284SPavel Butsykin     { "f27", offsetof(CPUSPARCState, fpr[13].l.lower) },
129bf957284SPavel Butsykin     { "f28", offsetof(CPUSPARCState, fpr[14].l.upper) },
130bf957284SPavel Butsykin     { "f29", offsetof(CPUSPARCState, fpr[14].l.lower) },
131bf957284SPavel Butsykin     { "f30", offsetof(CPUSPARCState, fpr[15].l.upper) },
132bf957284SPavel Butsykin     { "f31", offsetof(CPUSPARCState, fpr[15].l.lower) },
133bf957284SPavel Butsykin #ifdef TARGET_SPARC64
134bf957284SPavel Butsykin     { "f32", offsetof(CPUSPARCState, fpr[16]) },
135bf957284SPavel Butsykin     { "f34", offsetof(CPUSPARCState, fpr[17]) },
136bf957284SPavel Butsykin     { "f36", offsetof(CPUSPARCState, fpr[18]) },
137bf957284SPavel Butsykin     { "f38", offsetof(CPUSPARCState, fpr[19]) },
138bf957284SPavel Butsykin     { "f40", offsetof(CPUSPARCState, fpr[20]) },
139bf957284SPavel Butsykin     { "f42", offsetof(CPUSPARCState, fpr[21]) },
140bf957284SPavel Butsykin     { "f44", offsetof(CPUSPARCState, fpr[22]) },
141bf957284SPavel Butsykin     { "f46", offsetof(CPUSPARCState, fpr[23]) },
142bf957284SPavel Butsykin     { "f48", offsetof(CPUSPARCState, fpr[24]) },
143bf957284SPavel Butsykin     { "f50", offsetof(CPUSPARCState, fpr[25]) },
144bf957284SPavel Butsykin     { "f52", offsetof(CPUSPARCState, fpr[26]) },
145bf957284SPavel Butsykin     { "f54", offsetof(CPUSPARCState, fpr[27]) },
146bf957284SPavel Butsykin     { "f56", offsetof(CPUSPARCState, fpr[28]) },
147bf957284SPavel Butsykin     { "f58", offsetof(CPUSPARCState, fpr[29]) },
148bf957284SPavel Butsykin     { "f60", offsetof(CPUSPARCState, fpr[30]) },
149bf957284SPavel Butsykin     { "f62", offsetof(CPUSPARCState, fpr[31]) },
150bf957284SPavel Butsykin     { "asi", offsetof(CPUSPARCState, asi) },
151bf957284SPavel Butsykin     { "pstate", offsetof(CPUSPARCState, pstate) },
152bf957284SPavel Butsykin     { "cansave", offsetof(CPUSPARCState, cansave) },
153bf957284SPavel Butsykin     { "canrestore", offsetof(CPUSPARCState, canrestore) },
154bf957284SPavel Butsykin     { "otherwin", offsetof(CPUSPARCState, otherwin) },
155bf957284SPavel Butsykin     { "wstate", offsetof(CPUSPARCState, wstate) },
156bf957284SPavel Butsykin     { "cleanwin", offsetof(CPUSPARCState, cleanwin) },
157*ca4d5d86SPeter Maydell     { "fprs", offsetof(CPUSPARCState, fprs), NULL, MD_I32 },
158bf957284SPavel Butsykin #endif
159bf957284SPavel Butsykin     { NULL },
160bf957284SPavel Butsykin };
161bf957284SPavel Butsykin 
target_monitor_defs(void)162bf957284SPavel Butsykin const MonitorDef *target_monitor_defs(void)
163bf957284SPavel Butsykin {
164bf957284SPavel Butsykin     return monitor_defs;
165bf957284SPavel Butsykin }
166