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 */ 24bf957284SPavel Butsykin #include "cpu.h" 25bf957284SPavel Butsykin #include "monitor/monitor.h" 26bf957284SPavel Butsykin #include "monitor/hmp-target.h" 27bf957284SPavel Butsykin #include "hmp.h" 28bf957284SPavel Butsykin 29bf957284SPavel Butsykin static target_long monitor_get_ccr (const struct MonitorDef *md, int val) 30bf957284SPavel Butsykin { 31bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 32bf957284SPavel Butsykin unsigned int u; 33bf957284SPavel Butsykin int i; 34bf957284SPavel Butsykin 35bf957284SPavel Butsykin u = 0; 36bf957284SPavel Butsykin for (i = 0; i < 8; i++) 37bf957284SPavel Butsykin u |= env->crf[i] << (32 - (4 * (i + 1))); 38bf957284SPavel Butsykin 39bf957284SPavel Butsykin return u; 40bf957284SPavel Butsykin } 41bf957284SPavel Butsykin 42bf957284SPavel Butsykin static target_long monitor_get_msr (const struct MonitorDef *md, int val) 43bf957284SPavel Butsykin { 44bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 45bf957284SPavel Butsykin return env->msr; 46bf957284SPavel Butsykin } 47bf957284SPavel Butsykin 48bf957284SPavel Butsykin static target_long monitor_get_xer (const struct MonitorDef *md, int val) 49bf957284SPavel Butsykin { 50bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 51bf957284SPavel Butsykin return env->xer; 52bf957284SPavel Butsykin } 53bf957284SPavel Butsykin 54bf957284SPavel Butsykin static target_long monitor_get_decr (const struct MonitorDef *md, int val) 55bf957284SPavel Butsykin { 56bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 57bf957284SPavel Butsykin return cpu_ppc_load_decr(env); 58bf957284SPavel Butsykin } 59bf957284SPavel Butsykin 60bf957284SPavel Butsykin static target_long monitor_get_tbu (const struct MonitorDef *md, int val) 61bf957284SPavel Butsykin { 62bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 63bf957284SPavel Butsykin return cpu_ppc_load_tbu(env); 64bf957284SPavel Butsykin } 65bf957284SPavel Butsykin 66bf957284SPavel Butsykin static target_long monitor_get_tbl (const struct MonitorDef *md, int val) 67bf957284SPavel Butsykin { 68bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 69bf957284SPavel Butsykin return cpu_ppc_load_tbl(env); 70bf957284SPavel Butsykin } 71bf957284SPavel Butsykin 72bf957284SPavel Butsykin void hmp_info_tlb(Monitor *mon, const QDict *qdict) 73bf957284SPavel Butsykin { 74bf957284SPavel Butsykin CPUArchState *env1 = mon_get_cpu_env(); 75bf957284SPavel Butsykin 76bf957284SPavel Butsykin dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1); 77bf957284SPavel Butsykin } 78bf957284SPavel Butsykin 79bf957284SPavel Butsykin 80bf957284SPavel Butsykin const MonitorDef monitor_defs[] = { 81bf957284SPavel Butsykin /* General purpose registers */ 82bf957284SPavel Butsykin { "r0", offsetof(CPUPPCState, gpr[0]) }, 83bf957284SPavel Butsykin { "r1", offsetof(CPUPPCState, gpr[1]) }, 84bf957284SPavel Butsykin { "r2", offsetof(CPUPPCState, gpr[2]) }, 85bf957284SPavel Butsykin { "r3", offsetof(CPUPPCState, gpr[3]) }, 86bf957284SPavel Butsykin { "r4", offsetof(CPUPPCState, gpr[4]) }, 87bf957284SPavel Butsykin { "r5", offsetof(CPUPPCState, gpr[5]) }, 88bf957284SPavel Butsykin { "r6", offsetof(CPUPPCState, gpr[6]) }, 89bf957284SPavel Butsykin { "r7", offsetof(CPUPPCState, gpr[7]) }, 90bf957284SPavel Butsykin { "r8", offsetof(CPUPPCState, gpr[8]) }, 91bf957284SPavel Butsykin { "r9", offsetof(CPUPPCState, gpr[9]) }, 92bf957284SPavel Butsykin { "r10", offsetof(CPUPPCState, gpr[10]) }, 93bf957284SPavel Butsykin { "r11", offsetof(CPUPPCState, gpr[11]) }, 94bf957284SPavel Butsykin { "r12", offsetof(CPUPPCState, gpr[12]) }, 95bf957284SPavel Butsykin { "r13", offsetof(CPUPPCState, gpr[13]) }, 96bf957284SPavel Butsykin { "r14", offsetof(CPUPPCState, gpr[14]) }, 97bf957284SPavel Butsykin { "r15", offsetof(CPUPPCState, gpr[15]) }, 98bf957284SPavel Butsykin { "r16", offsetof(CPUPPCState, gpr[16]) }, 99bf957284SPavel Butsykin { "r17", offsetof(CPUPPCState, gpr[17]) }, 100bf957284SPavel Butsykin { "r18", offsetof(CPUPPCState, gpr[18]) }, 101bf957284SPavel Butsykin { "r19", offsetof(CPUPPCState, gpr[19]) }, 102bf957284SPavel Butsykin { "r20", offsetof(CPUPPCState, gpr[20]) }, 103bf957284SPavel Butsykin { "r21", offsetof(CPUPPCState, gpr[21]) }, 104bf957284SPavel Butsykin { "r22", offsetof(CPUPPCState, gpr[22]) }, 105bf957284SPavel Butsykin { "r23", offsetof(CPUPPCState, gpr[23]) }, 106bf957284SPavel Butsykin { "r24", offsetof(CPUPPCState, gpr[24]) }, 107bf957284SPavel Butsykin { "r25", offsetof(CPUPPCState, gpr[25]) }, 108bf957284SPavel Butsykin { "r26", offsetof(CPUPPCState, gpr[26]) }, 109bf957284SPavel Butsykin { "r27", offsetof(CPUPPCState, gpr[27]) }, 110bf957284SPavel Butsykin { "r28", offsetof(CPUPPCState, gpr[28]) }, 111bf957284SPavel Butsykin { "r29", offsetof(CPUPPCState, gpr[29]) }, 112bf957284SPavel Butsykin { "r30", offsetof(CPUPPCState, gpr[30]) }, 113bf957284SPavel Butsykin { "r31", offsetof(CPUPPCState, gpr[31]) }, 114bf957284SPavel Butsykin /* Floating point registers */ 115bf957284SPavel Butsykin { "f0", offsetof(CPUPPCState, fpr[0]) }, 116bf957284SPavel Butsykin { "f1", offsetof(CPUPPCState, fpr[1]) }, 117bf957284SPavel Butsykin { "f2", offsetof(CPUPPCState, fpr[2]) }, 118bf957284SPavel Butsykin { "f3", offsetof(CPUPPCState, fpr[3]) }, 119bf957284SPavel Butsykin { "f4", offsetof(CPUPPCState, fpr[4]) }, 120bf957284SPavel Butsykin { "f5", offsetof(CPUPPCState, fpr[5]) }, 121bf957284SPavel Butsykin { "f6", offsetof(CPUPPCState, fpr[6]) }, 122bf957284SPavel Butsykin { "f7", offsetof(CPUPPCState, fpr[7]) }, 123bf957284SPavel Butsykin { "f8", offsetof(CPUPPCState, fpr[8]) }, 124bf957284SPavel Butsykin { "f9", offsetof(CPUPPCState, fpr[9]) }, 125bf957284SPavel Butsykin { "f10", offsetof(CPUPPCState, fpr[10]) }, 126bf957284SPavel Butsykin { "f11", offsetof(CPUPPCState, fpr[11]) }, 127bf957284SPavel Butsykin { "f12", offsetof(CPUPPCState, fpr[12]) }, 128bf957284SPavel Butsykin { "f13", offsetof(CPUPPCState, fpr[13]) }, 129bf957284SPavel Butsykin { "f14", offsetof(CPUPPCState, fpr[14]) }, 130bf957284SPavel Butsykin { "f15", offsetof(CPUPPCState, fpr[15]) }, 131bf957284SPavel Butsykin { "f16", offsetof(CPUPPCState, fpr[16]) }, 132bf957284SPavel Butsykin { "f17", offsetof(CPUPPCState, fpr[17]) }, 133bf957284SPavel Butsykin { "f18", offsetof(CPUPPCState, fpr[18]) }, 134bf957284SPavel Butsykin { "f19", offsetof(CPUPPCState, fpr[19]) }, 135bf957284SPavel Butsykin { "f20", offsetof(CPUPPCState, fpr[20]) }, 136bf957284SPavel Butsykin { "f21", offsetof(CPUPPCState, fpr[21]) }, 137bf957284SPavel Butsykin { "f22", offsetof(CPUPPCState, fpr[22]) }, 138bf957284SPavel Butsykin { "f23", offsetof(CPUPPCState, fpr[23]) }, 139bf957284SPavel Butsykin { "f24", offsetof(CPUPPCState, fpr[24]) }, 140bf957284SPavel Butsykin { "f25", offsetof(CPUPPCState, fpr[25]) }, 141bf957284SPavel Butsykin { "f26", offsetof(CPUPPCState, fpr[26]) }, 142bf957284SPavel Butsykin { "f27", offsetof(CPUPPCState, fpr[27]) }, 143bf957284SPavel Butsykin { "f28", offsetof(CPUPPCState, fpr[28]) }, 144bf957284SPavel Butsykin { "f29", offsetof(CPUPPCState, fpr[29]) }, 145bf957284SPavel Butsykin { "f30", offsetof(CPUPPCState, fpr[30]) }, 146bf957284SPavel Butsykin { "f31", offsetof(CPUPPCState, fpr[31]) }, 147bf957284SPavel Butsykin { "fpscr", offsetof(CPUPPCState, fpscr) }, 148bf957284SPavel Butsykin /* Next instruction pointer */ 149bf957284SPavel Butsykin { "nip|pc", offsetof(CPUPPCState, nip) }, 150bf957284SPavel Butsykin { "lr", offsetof(CPUPPCState, lr) }, 151bf957284SPavel Butsykin { "ctr", offsetof(CPUPPCState, ctr) }, 152bf957284SPavel Butsykin { "decr", 0, &monitor_get_decr, }, 153bf957284SPavel Butsykin { "ccr", 0, &monitor_get_ccr, }, 154bf957284SPavel Butsykin /* Machine state register */ 155bf957284SPavel Butsykin { "msr", 0, &monitor_get_msr, }, 156bf957284SPavel Butsykin { "xer", 0, &monitor_get_xer, }, 157bf957284SPavel Butsykin { "tbu", 0, &monitor_get_tbu, }, 158bf957284SPavel Butsykin { "tbl", 0, &monitor_get_tbl, }, 159bf957284SPavel Butsykin /* Segment registers */ 160bf957284SPavel Butsykin { "sdr1", offsetof(CPUPPCState, spr[SPR_SDR1]) }, 161bf957284SPavel Butsykin { "sr0", offsetof(CPUPPCState, sr[0]) }, 162bf957284SPavel Butsykin { "sr1", offsetof(CPUPPCState, sr[1]) }, 163bf957284SPavel Butsykin { "sr2", offsetof(CPUPPCState, sr[2]) }, 164bf957284SPavel Butsykin { "sr3", offsetof(CPUPPCState, sr[3]) }, 165bf957284SPavel Butsykin { "sr4", offsetof(CPUPPCState, sr[4]) }, 166bf957284SPavel Butsykin { "sr5", offsetof(CPUPPCState, sr[5]) }, 167bf957284SPavel Butsykin { "sr6", offsetof(CPUPPCState, sr[6]) }, 168bf957284SPavel Butsykin { "sr7", offsetof(CPUPPCState, sr[7]) }, 169bf957284SPavel Butsykin { "sr8", offsetof(CPUPPCState, sr[8]) }, 170bf957284SPavel Butsykin { "sr9", offsetof(CPUPPCState, sr[9]) }, 171bf957284SPavel Butsykin { "sr10", offsetof(CPUPPCState, sr[10]) }, 172bf957284SPavel Butsykin { "sr11", offsetof(CPUPPCState, sr[11]) }, 173bf957284SPavel Butsykin { "sr12", offsetof(CPUPPCState, sr[12]) }, 174bf957284SPavel Butsykin { "sr13", offsetof(CPUPPCState, sr[13]) }, 175bf957284SPavel Butsykin { "sr14", offsetof(CPUPPCState, sr[14]) }, 176bf957284SPavel Butsykin { "sr15", offsetof(CPUPPCState, sr[15]) }, 177bf957284SPavel Butsykin /* Too lazy to put BATs... */ 178bf957284SPavel Butsykin { "pvr", offsetof(CPUPPCState, spr[SPR_PVR]) }, 179bf957284SPavel Butsykin 180bf957284SPavel Butsykin { "srr0", offsetof(CPUPPCState, spr[SPR_SRR0]) }, 181bf957284SPavel Butsykin { "srr1", offsetof(CPUPPCState, spr[SPR_SRR1]) }, 182bf957284SPavel Butsykin { "dar", offsetof(CPUPPCState, spr[SPR_DAR]) }, 183bf957284SPavel Butsykin { "dsisr", offsetof(CPUPPCState, spr[SPR_DSISR]) }, 184bf957284SPavel Butsykin { "cfar", offsetof(CPUPPCState, spr[SPR_CFAR]) }, 185bf957284SPavel Butsykin { "sprg0", offsetof(CPUPPCState, spr[SPR_SPRG0]) }, 186bf957284SPavel Butsykin { "sprg1", offsetof(CPUPPCState, spr[SPR_SPRG1]) }, 187bf957284SPavel Butsykin { "sprg2", offsetof(CPUPPCState, spr[SPR_SPRG2]) }, 188bf957284SPavel Butsykin { "sprg3", offsetof(CPUPPCState, spr[SPR_SPRG3]) }, 189bf957284SPavel Butsykin { "sprg4", offsetof(CPUPPCState, spr[SPR_SPRG4]) }, 190bf957284SPavel Butsykin { "sprg5", offsetof(CPUPPCState, spr[SPR_SPRG5]) }, 191bf957284SPavel Butsykin { "sprg6", offsetof(CPUPPCState, spr[SPR_SPRG6]) }, 192bf957284SPavel Butsykin { "sprg7", offsetof(CPUPPCState, spr[SPR_SPRG7]) }, 193bf957284SPavel Butsykin { "pid", offsetof(CPUPPCState, spr[SPR_BOOKE_PID]) }, 194bf957284SPavel Butsykin { "csrr0", offsetof(CPUPPCState, spr[SPR_BOOKE_CSRR0]) }, 195bf957284SPavel Butsykin { "csrr1", offsetof(CPUPPCState, spr[SPR_BOOKE_CSRR1]) }, 196bf957284SPavel Butsykin { "esr", offsetof(CPUPPCState, spr[SPR_BOOKE_ESR]) }, 197bf957284SPavel Butsykin { "dear", offsetof(CPUPPCState, spr[SPR_BOOKE_DEAR]) }, 198bf957284SPavel Butsykin { "mcsr", offsetof(CPUPPCState, spr[SPR_BOOKE_MCSR]) }, 199bf957284SPavel Butsykin { "tsr", offsetof(CPUPPCState, spr[SPR_BOOKE_TSR]) }, 200bf957284SPavel Butsykin { "tcr", offsetof(CPUPPCState, spr[SPR_BOOKE_TCR]) }, 201bf957284SPavel Butsykin { "vrsave", offsetof(CPUPPCState, spr[SPR_VRSAVE]) }, 202bf957284SPavel Butsykin { "pir", offsetof(CPUPPCState, spr[SPR_BOOKE_PIR]) }, 203bf957284SPavel Butsykin { "mcsrr0", offsetof(CPUPPCState, spr[SPR_BOOKE_MCSRR0]) }, 204bf957284SPavel Butsykin { "mcsrr1", offsetof(CPUPPCState, spr[SPR_BOOKE_MCSRR1]) }, 205bf957284SPavel Butsykin { "decar", offsetof(CPUPPCState, spr[SPR_BOOKE_DECAR]) }, 206bf957284SPavel Butsykin { "ivpr", offsetof(CPUPPCState, spr[SPR_BOOKE_IVPR]) }, 207bf957284SPavel Butsykin { "epcr", offsetof(CPUPPCState, spr[SPR_BOOKE_EPCR]) }, 208bf957284SPavel Butsykin { "sprg8", offsetof(CPUPPCState, spr[SPR_BOOKE_SPRG8]) }, 209bf957284SPavel Butsykin { "ivor0", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR0]) }, 210bf957284SPavel Butsykin { "ivor1", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR1]) }, 211bf957284SPavel Butsykin { "ivor2", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR2]) }, 212bf957284SPavel Butsykin { "ivor3", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR3]) }, 213bf957284SPavel Butsykin { "ivor4", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR4]) }, 214bf957284SPavel Butsykin { "ivor5", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR5]) }, 215bf957284SPavel Butsykin { "ivor6", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR6]) }, 216bf957284SPavel Butsykin { "ivor7", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR7]) }, 217bf957284SPavel Butsykin { "ivor8", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR8]) }, 218bf957284SPavel Butsykin { "ivor9", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR9]) }, 219bf957284SPavel Butsykin { "ivor10", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR10]) }, 220bf957284SPavel Butsykin { "ivor11", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR11]) }, 221bf957284SPavel Butsykin { "ivor12", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR12]) }, 222bf957284SPavel Butsykin { "ivor13", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR13]) }, 223bf957284SPavel Butsykin { "ivor14", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR14]) }, 224bf957284SPavel Butsykin { "ivor15", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR15]) }, 225bf957284SPavel Butsykin { "ivor32", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR32]) }, 226bf957284SPavel Butsykin { "ivor33", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR33]) }, 227bf957284SPavel Butsykin { "ivor34", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR34]) }, 228bf957284SPavel Butsykin { "ivor35", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR35]) }, 229bf957284SPavel Butsykin { "ivor36", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR36]) }, 230bf957284SPavel Butsykin { "ivor37", offsetof(CPUPPCState, spr[SPR_BOOKE_IVOR37]) }, 231bf957284SPavel Butsykin { "mas0", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS0]) }, 232bf957284SPavel Butsykin { "mas1", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS1]) }, 233bf957284SPavel Butsykin { "mas2", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS2]) }, 234bf957284SPavel Butsykin { "mas3", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS3]) }, 235bf957284SPavel Butsykin { "mas4", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS4]) }, 236bf957284SPavel Butsykin { "mas6", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS6]) }, 237bf957284SPavel Butsykin { "mas7", offsetof(CPUPPCState, spr[SPR_BOOKE_MAS7]) }, 238bf957284SPavel Butsykin { "mmucfg", offsetof(CPUPPCState, spr[SPR_MMUCFG]) }, 239bf957284SPavel Butsykin { "tlb0cfg", offsetof(CPUPPCState, spr[SPR_BOOKE_TLB0CFG]) }, 240bf957284SPavel Butsykin { "tlb1cfg", offsetof(CPUPPCState, spr[SPR_BOOKE_TLB1CFG]) }, 241bf957284SPavel Butsykin { "epr", offsetof(CPUPPCState, spr[SPR_BOOKE_EPR]) }, 242bf957284SPavel Butsykin { "eplc", offsetof(CPUPPCState, spr[SPR_BOOKE_EPLC]) }, 243bf957284SPavel Butsykin { "epsc", offsetof(CPUPPCState, spr[SPR_BOOKE_EPSC]) }, 244bf957284SPavel Butsykin { "svr", offsetof(CPUPPCState, spr[SPR_E500_SVR]) }, 245bf957284SPavel Butsykin { "mcar", offsetof(CPUPPCState, spr[SPR_Exxx_MCAR]) }, 246bf957284SPavel Butsykin { "pid1", offsetof(CPUPPCState, spr[SPR_BOOKE_PID1]) }, 247bf957284SPavel Butsykin { "pid2", offsetof(CPUPPCState, spr[SPR_BOOKE_PID2]) }, 248bf957284SPavel Butsykin { "hid0", offsetof(CPUPPCState, spr[SPR_HID0]) }, 249bf957284SPavel Butsykin { NULL }, 250bf957284SPavel Butsykin }; 251bf957284SPavel Butsykin 252bf957284SPavel Butsykin const MonitorDef *target_monitor_defs(void) 253bf957284SPavel Butsykin { 254bf957284SPavel Butsykin return monitor_defs; 255bf957284SPavel Butsykin } 256