xref: /qemu/target/sparc/monitor.c (revision db5ebe5f411833b0ce4b6fa86ee00366e32d3968)
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"
28bf957284SPavel Butsykin #include "hmp.h"
29bf957284SPavel Butsykin 
30bf957284SPavel Butsykin 
31bf957284SPavel Butsykin void hmp_info_tlb(Monitor *mon, const QDict *qdict)
32bf957284SPavel Butsykin {
33bf957284SPavel Butsykin     CPUArchState *env1 = mon_get_cpu_env();
34bf957284SPavel Butsykin 
35bf957284SPavel Butsykin     dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
36bf957284SPavel Butsykin }
37bf957284SPavel Butsykin 
38bf957284SPavel Butsykin #ifndef TARGET_SPARC64
39bf957284SPavel Butsykin static target_long monitor_get_psr (const struct MonitorDef *md, int val)
40bf957284SPavel Butsykin {
41bf957284SPavel Butsykin     CPUArchState *env = mon_get_cpu_env();
42bf957284SPavel Butsykin 
43bf957284SPavel Butsykin     return cpu_get_psr(env);
44bf957284SPavel Butsykin }
45bf957284SPavel Butsykin #endif
46bf957284SPavel Butsykin 
47bf957284SPavel Butsykin static target_long monitor_get_reg(const struct MonitorDef *md, int val)
48bf957284SPavel Butsykin {
49bf957284SPavel Butsykin     CPUArchState *env = mon_get_cpu_env();
50bf957284SPavel Butsykin     return env->regwptr[val];
51bf957284SPavel Butsykin }
52bf957284SPavel Butsykin 
53bf957284SPavel Butsykin const MonitorDef monitor_defs[] = {
54bf957284SPavel Butsykin     { "g0", offsetof(CPUSPARCState, gregs[0]) },
55bf957284SPavel Butsykin     { "g1", offsetof(CPUSPARCState, gregs[1]) },
56bf957284SPavel Butsykin     { "g2", offsetof(CPUSPARCState, gregs[2]) },
57bf957284SPavel Butsykin     { "g3", offsetof(CPUSPARCState, gregs[3]) },
58bf957284SPavel Butsykin     { "g4", offsetof(CPUSPARCState, gregs[4]) },
59bf957284SPavel Butsykin     { "g5", offsetof(CPUSPARCState, gregs[5]) },
60bf957284SPavel Butsykin     { "g6", offsetof(CPUSPARCState, gregs[6]) },
61bf957284SPavel Butsykin     { "g7", offsetof(CPUSPARCState, gregs[7]) },
62bf957284SPavel Butsykin     { "o0", 0, monitor_get_reg },
63bf957284SPavel Butsykin     { "o1", 1, monitor_get_reg },
64bf957284SPavel Butsykin     { "o2", 2, monitor_get_reg },
65bf957284SPavel Butsykin     { "o3", 3, monitor_get_reg },
66bf957284SPavel Butsykin     { "o4", 4, monitor_get_reg },
67bf957284SPavel Butsykin     { "o5", 5, monitor_get_reg },
68bf957284SPavel Butsykin     { "o6", 6, monitor_get_reg },
69bf957284SPavel Butsykin     { "o7", 7, monitor_get_reg },
70bf957284SPavel Butsykin     { "l0", 8, monitor_get_reg },
71bf957284SPavel Butsykin     { "l1", 9, monitor_get_reg },
72bf957284SPavel Butsykin     { "l2", 10, monitor_get_reg },
73bf957284SPavel Butsykin     { "l3", 11, monitor_get_reg },
74bf957284SPavel Butsykin     { "l4", 12, monitor_get_reg },
75bf957284SPavel Butsykin     { "l5", 13, monitor_get_reg },
76bf957284SPavel Butsykin     { "l6", 14, monitor_get_reg },
77bf957284SPavel Butsykin     { "l7", 15, monitor_get_reg },
78bf957284SPavel Butsykin     { "i0", 16, monitor_get_reg },
79bf957284SPavel Butsykin     { "i1", 17, monitor_get_reg },
80bf957284SPavel Butsykin     { "i2", 18, monitor_get_reg },
81bf957284SPavel Butsykin     { "i3", 19, monitor_get_reg },
82bf957284SPavel Butsykin     { "i4", 20, monitor_get_reg },
83bf957284SPavel Butsykin     { "i5", 21, monitor_get_reg },
84bf957284SPavel Butsykin     { "i6", 22, monitor_get_reg },
85bf957284SPavel Butsykin     { "i7", 23, monitor_get_reg },
86bf957284SPavel Butsykin     { "pc", offsetof(CPUSPARCState, pc) },
87bf957284SPavel Butsykin     { "npc", offsetof(CPUSPARCState, npc) },
88bf957284SPavel Butsykin     { "y", offsetof(CPUSPARCState, y) },
89bf957284SPavel Butsykin #ifndef TARGET_SPARC64
90bf957284SPavel Butsykin     { "psr", 0, &monitor_get_psr, },
91bf957284SPavel Butsykin     { "wim", offsetof(CPUSPARCState, wim) },
92bf957284SPavel Butsykin #endif
93bf957284SPavel Butsykin     { "tbr", offsetof(CPUSPARCState, tbr) },
94bf957284SPavel Butsykin     { "fsr", offsetof(CPUSPARCState, fsr) },
95bf957284SPavel Butsykin     { "f0", offsetof(CPUSPARCState, fpr[0].l.upper) },
96bf957284SPavel Butsykin     { "f1", offsetof(CPUSPARCState, fpr[0].l.lower) },
97bf957284SPavel Butsykin     { "f2", offsetof(CPUSPARCState, fpr[1].l.upper) },
98bf957284SPavel Butsykin     { "f3", offsetof(CPUSPARCState, fpr[1].l.lower) },
99bf957284SPavel Butsykin     { "f4", offsetof(CPUSPARCState, fpr[2].l.upper) },
100bf957284SPavel Butsykin     { "f5", offsetof(CPUSPARCState, fpr[2].l.lower) },
101bf957284SPavel Butsykin     { "f6", offsetof(CPUSPARCState, fpr[3].l.upper) },
102bf957284SPavel Butsykin     { "f7", offsetof(CPUSPARCState, fpr[3].l.lower) },
103bf957284SPavel Butsykin     { "f8", offsetof(CPUSPARCState, fpr[4].l.upper) },
104bf957284SPavel Butsykin     { "f9", offsetof(CPUSPARCState, fpr[4].l.lower) },
105bf957284SPavel Butsykin     { "f10", offsetof(CPUSPARCState, fpr[5].l.upper) },
106bf957284SPavel Butsykin     { "f11", offsetof(CPUSPARCState, fpr[5].l.lower) },
107bf957284SPavel Butsykin     { "f12", offsetof(CPUSPARCState, fpr[6].l.upper) },
108bf957284SPavel Butsykin     { "f13", offsetof(CPUSPARCState, fpr[6].l.lower) },
109bf957284SPavel Butsykin     { "f14", offsetof(CPUSPARCState, fpr[7].l.upper) },
110bf957284SPavel Butsykin     { "f15", offsetof(CPUSPARCState, fpr[7].l.lower) },
111bf957284SPavel Butsykin     { "f16", offsetof(CPUSPARCState, fpr[8].l.upper) },
112bf957284SPavel Butsykin     { "f17", offsetof(CPUSPARCState, fpr[8].l.lower) },
113bf957284SPavel Butsykin     { "f18", offsetof(CPUSPARCState, fpr[9].l.upper) },
114bf957284SPavel Butsykin     { "f19", offsetof(CPUSPARCState, fpr[9].l.lower) },
115bf957284SPavel Butsykin     { "f20", offsetof(CPUSPARCState, fpr[10].l.upper) },
116bf957284SPavel Butsykin     { "f21", offsetof(CPUSPARCState, fpr[10].l.lower) },
117bf957284SPavel Butsykin     { "f22", offsetof(CPUSPARCState, fpr[11].l.upper) },
118bf957284SPavel Butsykin     { "f23", offsetof(CPUSPARCState, fpr[11].l.lower) },
119bf957284SPavel Butsykin     { "f24", offsetof(CPUSPARCState, fpr[12].l.upper) },
120bf957284SPavel Butsykin     { "f25", offsetof(CPUSPARCState, fpr[12].l.lower) },
121bf957284SPavel Butsykin     { "f26", offsetof(CPUSPARCState, fpr[13].l.upper) },
122bf957284SPavel Butsykin     { "f27", offsetof(CPUSPARCState, fpr[13].l.lower) },
123bf957284SPavel Butsykin     { "f28", offsetof(CPUSPARCState, fpr[14].l.upper) },
124bf957284SPavel Butsykin     { "f29", offsetof(CPUSPARCState, fpr[14].l.lower) },
125bf957284SPavel Butsykin     { "f30", offsetof(CPUSPARCState, fpr[15].l.upper) },
126bf957284SPavel Butsykin     { "f31", offsetof(CPUSPARCState, fpr[15].l.lower) },
127bf957284SPavel Butsykin #ifdef TARGET_SPARC64
128bf957284SPavel Butsykin     { "f32", offsetof(CPUSPARCState, fpr[16]) },
129bf957284SPavel Butsykin     { "f34", offsetof(CPUSPARCState, fpr[17]) },
130bf957284SPavel Butsykin     { "f36", offsetof(CPUSPARCState, fpr[18]) },
131bf957284SPavel Butsykin     { "f38", offsetof(CPUSPARCState, fpr[19]) },
132bf957284SPavel Butsykin     { "f40", offsetof(CPUSPARCState, fpr[20]) },
133bf957284SPavel Butsykin     { "f42", offsetof(CPUSPARCState, fpr[21]) },
134bf957284SPavel Butsykin     { "f44", offsetof(CPUSPARCState, fpr[22]) },
135bf957284SPavel Butsykin     { "f46", offsetof(CPUSPARCState, fpr[23]) },
136bf957284SPavel Butsykin     { "f48", offsetof(CPUSPARCState, fpr[24]) },
137bf957284SPavel Butsykin     { "f50", offsetof(CPUSPARCState, fpr[25]) },
138bf957284SPavel Butsykin     { "f52", offsetof(CPUSPARCState, fpr[26]) },
139bf957284SPavel Butsykin     { "f54", offsetof(CPUSPARCState, fpr[27]) },
140bf957284SPavel Butsykin     { "f56", offsetof(CPUSPARCState, fpr[28]) },
141bf957284SPavel Butsykin     { "f58", offsetof(CPUSPARCState, fpr[29]) },
142bf957284SPavel Butsykin     { "f60", offsetof(CPUSPARCState, fpr[30]) },
143bf957284SPavel Butsykin     { "f62", offsetof(CPUSPARCState, fpr[31]) },
144bf957284SPavel Butsykin     { "asi", offsetof(CPUSPARCState, asi) },
145bf957284SPavel Butsykin     { "pstate", offsetof(CPUSPARCState, pstate) },
146bf957284SPavel Butsykin     { "cansave", offsetof(CPUSPARCState, cansave) },
147bf957284SPavel Butsykin     { "canrestore", offsetof(CPUSPARCState, canrestore) },
148bf957284SPavel Butsykin     { "otherwin", offsetof(CPUSPARCState, otherwin) },
149bf957284SPavel Butsykin     { "wstate", offsetof(CPUSPARCState, wstate) },
150bf957284SPavel Butsykin     { "cleanwin", offsetof(CPUSPARCState, cleanwin) },
151bf957284SPavel Butsykin     { "fprs", offsetof(CPUSPARCState, fprs) },
152bf957284SPavel Butsykin #endif
153bf957284SPavel Butsykin     { NULL },
154bf957284SPavel Butsykin };
155bf957284SPavel Butsykin 
156bf957284SPavel Butsykin const MonitorDef *target_monitor_defs(void)
157bf957284SPavel Butsykin {
158bf957284SPavel Butsykin     return monitor_defs;
159bf957284SPavel Butsykin }
160