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