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 */ 249d4c9946SPeter 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 static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) 31bf957284SPavel Butsykin { 32bf957284SPavel Butsykin monitor_printf(mon, " tlb%i:\t" 33bf957284SPavel Butsykin "asid=%hhu vpn=%x\tppn=%x\tsz=%hhu size=%u\t" 34bf957284SPavel Butsykin "v=%hhu shared=%hhu cached=%hhu prot=%hhu " 35bf957284SPavel Butsykin "dirty=%hhu writethrough=%hhu\n", 36bf957284SPavel Butsykin idx, 37bf957284SPavel Butsykin tlb->asid, tlb->vpn, tlb->ppn, tlb->sz, tlb->size, 38bf957284SPavel Butsykin tlb->v, tlb->sh, tlb->c, tlb->pr, 39bf957284SPavel Butsykin tlb->d, tlb->wt); 40bf957284SPavel Butsykin } 41bf957284SPavel Butsykin 42bf957284SPavel Butsykin void hmp_info_tlb(Monitor *mon, const QDict *qdict) 43bf957284SPavel Butsykin { 44bf957284SPavel Butsykin CPUArchState *env = mon_get_cpu_env(); 45bf957284SPavel Butsykin int i; 46bf957284SPavel Butsykin 47bf957284SPavel Butsykin monitor_printf (mon, "ITLB:\n"); 48bf957284SPavel Butsykin for (i = 0 ; i < ITLB_SIZE ; i++) 49bf957284SPavel Butsykin print_tlb (mon, i, &env->itlb[i]); 50bf957284SPavel Butsykin monitor_printf (mon, "UTLB:\n"); 51bf957284SPavel Butsykin for (i = 0 ; i < UTLB_SIZE ; i++) 52bf957284SPavel Butsykin print_tlb (mon, i, &env->utlb[i]); 53bf957284SPavel Butsykin } 54