10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/machparam.h> 310Sstevel@tonic-gate #include <vm/as.h> 320Sstevel@tonic-gate #include <vm/hat_sfmmu.h> 330Sstevel@tonic-gate 340Sstevel@tonic-gate #include <mdb/mdb_modapi.h> 350Sstevel@tonic-gate #include <mdb/mdb_target.h> 360Sstevel@tonic-gate #include <mdb/mdb_ctf.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* 390Sstevel@tonic-gate * sfmmu mdb support 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate 420Sstevel@tonic-gate #define SFMMU_VTOP_DBG_SYMBOL 1 430Sstevel@tonic-gate #define SFMMU_VTOP_DBG_VERBOSE 2 440Sstevel@tonic-gate #define SFMMU_VTOP_DBG_DEBUG 4 450Sstevel@tonic-gate #define SFMMU_VTOP_DBG_ALL (SFMMU_VTOP_DBG_SYMBOL|SFMMU_VTOP_DBG_VERBOSE|\ 460Sstevel@tonic-gate SFMMU_VTOP_DBG_DEBUG) 470Sstevel@tonic-gate 480Sstevel@tonic-gate #define SFMMU_VTOP_DBG_SYM if (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_SYMBOL) \ 490Sstevel@tonic-gate mdb_printf 500Sstevel@tonic-gate #define SFMMU_VTOP_DBG_VRB if (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_VERBOSE) \ 510Sstevel@tonic-gate mdb_printf 520Sstevel@tonic-gate #define SFMMU_VTOP_DBG_DBG if (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_DEBUG) \ 530Sstevel@tonic-gate mdb_printf 540Sstevel@tonic-gate 550Sstevel@tonic-gate #define SFMMU_VTOP_READSYM(dest, synm, where) \ 560Sstevel@tonic-gate if (mdb_readsym(&(dest), sizeof (dest), (synm)) == -1) \ 570Sstevel@tonic-gate mdb_warn("%s: couldn't find or read '%s'\n", (where), (synm)); 580Sstevel@tonic-gate 590Sstevel@tonic-gate struct hme_blks_max { 600Sstevel@tonic-gate struct hme_blk hmx_hmeblk; 610Sstevel@tonic-gate struct sf_hment hmx_hmes[NHMENTS - 1]; 620Sstevel@tonic-gate }; 630Sstevel@tonic-gate 640Sstevel@tonic-gate int sfmmu_vtop(uintptr_t, uint_t, int, const mdb_arg_t *); 650Sstevel@tonic-gate static int sfmmu_vtop_common(struct as *, uintptr_t, physaddr_t *); 660Sstevel@tonic-gate static int sfmmu_vtop_impl(uintptr_t, sfmmu_t *, sfmmu_t *, physaddr_t *); 670Sstevel@tonic-gate static void sfmmu_vtop_print_hmeblk(struct hme_blk *); 680Sstevel@tonic-gate static struct sf_hment *mdb_sfmmu_hblktohme(struct hme_blk *, caddr_t, int *); 690Sstevel@tonic-gate 700Sstevel@tonic-gate int sfmmu_vtop_dbg_wanted = 0; /* set this as desired */ 710Sstevel@tonic-gate int sfmmu_vtop_dbg = 0; 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* 740Sstevel@tonic-gate * ::sfmmu_vtop [[-v] -a as] 750Sstevel@tonic-gate * Extended version of the vtop builtin. The optional <as> argument is 760Sstevel@tonic-gate * used as base address space for translating a virtual address into a 770Sstevel@tonic-gate * physical address. The verbose option ("-v") shows intermediate 780Sstevel@tonic-gate * translation steps. If <as> or kas is ommitted, the builtin ::vtop 790Sstevel@tonic-gate * dcmd is called. 800Sstevel@tonic-gate */ 810Sstevel@tonic-gate int 820Sstevel@tonic-gate sfmmu_vtop(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 830Sstevel@tonic-gate { 840Sstevel@tonic-gate int ret; 850Sstevel@tonic-gate struct as *asp = NULL; 860Sstevel@tonic-gate char *asnmp = NULL; 870Sstevel@tonic-gate int verbose = 0; 880Sstevel@tonic-gate physaddr_t paddr; 890Sstevel@tonic-gate 900Sstevel@tonic-gate sfmmu_vtop_dbg = sfmmu_vtop_dbg_wanted; 910Sstevel@tonic-gate 920Sstevel@tonic-gate if (mdb_getopts(argc, argv, 930Sstevel@tonic-gate 'v', MDB_OPT_SETBITS, TRUE, &verbose, 940Sstevel@tonic-gate 'a', MDB_OPT_STR, &asnmp, 950Sstevel@tonic-gate NULL) != argc) 960Sstevel@tonic-gate return (DCMD_USAGE); 970Sstevel@tonic-gate 980Sstevel@tonic-gate if (verbose != 0 && asnmp == NULL) { 990Sstevel@tonic-gate mdb_warn("-v requires -a option\n"); 1000Sstevel@tonic-gate return (DCMD_USAGE); 1010Sstevel@tonic-gate } 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate if (verbose != 0 && (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_VERBOSE) == 0) { 1040Sstevel@tonic-gate sfmmu_vtop_dbg |= SFMMU_VTOP_DBG_VERBOSE; 1050Sstevel@tonic-gate } 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate if (asnmp != NULL) { 1080Sstevel@tonic-gate GElf_Sym sym; 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("asnmp=%p asnm=%s\n", asnmp, asnmp); 1110Sstevel@tonic-gate if (strcmp(asnmp, "kas") == 0) { 1120Sstevel@tonic-gate if (mdb_lookup_by_name("kas", &sym) == -1) { 1130Sstevel@tonic-gate mdb_warn("couldn't find 'kas'\n"); 1140Sstevel@tonic-gate return (DCMD_ERR); 1150Sstevel@tonic-gate } else { 1160Sstevel@tonic-gate asp = (struct as *)sym.st_value; 1170Sstevel@tonic-gate SFMMU_VTOP_DBG_SYM("kas &sym=%p\n", &sym); 1180Sstevel@tonic-gate } 1190Sstevel@tonic-gate } else { 1200Sstevel@tonic-gate asp = (struct as *)mdb_strtoull(asnmp); 1210Sstevel@tonic-gate } 1220Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("asp=0x%p\n", asp); 1230Sstevel@tonic-gate } 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate if (asp == 0) { 1260Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("sfmmu_vtop: call standard vtop\n"); 1270Sstevel@tonic-gate return (mdb_call_dcmd("vtop", addr, flags, argc, argv)); 1280Sstevel@tonic-gate } 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate if ((ret = sfmmu_vtop_common(asp, addr, &paddr)) == -1L) { 1310Sstevel@tonic-gate mdb_printf("no mapping found for addr=%p\n", addr); 1320Sstevel@tonic-gate return (DCMD_ERR); 1330Sstevel@tonic-gate } 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate if (ret == 0) { 1360Sstevel@tonic-gate mdb_printf("address space %p: virtual %lr mapped to physical " 1370Sstevel@tonic-gate "%llr", asp, addr, paddr); 1380Sstevel@tonic-gate } else { 1390Sstevel@tonic-gate return (DCMD_ERR); 1400Sstevel@tonic-gate } 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate return (DCMD_OK); 1430Sstevel@tonic-gate } 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate static int 1460Sstevel@tonic-gate sfmmu_vtop_common(struct as *asp, uintptr_t addr, physaddr_t *pap) 1470Sstevel@tonic-gate { 1480Sstevel@tonic-gate struct as mas; 1490Sstevel@tonic-gate struct as *masp = &mas; 1500Sstevel@tonic-gate sfmmu_t *hatp; 1510Sstevel@tonic-gate sfmmu_t mhat; 1520Sstevel@tonic-gate sfmmu_t *mhatp = &mhat; 1530Sstevel@tonic-gate int ret; 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate if (mdb_vread(masp, sizeof (mas), (uintptr_t)asp) == -1) { 1560Sstevel@tonic-gate mdb_warn("couldn't read as at %p\n", asp); 1570Sstevel@tonic-gate return (DCMD_ERR); 1580Sstevel@tonic-gate } 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate hatp = masp->a_hat; 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("hatp=%p addr=%p masp=%p\n", hatp, addr, masp); 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate if (mdb_vread(mhatp, sizeof (mhat), (uintptr_t)hatp) == -1) { 1650Sstevel@tonic-gate mdb_warn("couldn't read hat at %p\n", hatp); 1660Sstevel@tonic-gate return (DCMD_ERR); 1670Sstevel@tonic-gate } 1680Sstevel@tonic-gate if (mhatp->sfmmu_as != asp) { 1690Sstevel@tonic-gate mdb_warn("%p is not a valid address space\n", asp); 1700Sstevel@tonic-gate return (DCMD_ERR); 1710Sstevel@tonic-gate } 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate ret = sfmmu_vtop_impl(addr, hatp, mhatp, pap); 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate return (ret); 1760Sstevel@tonic-gate } 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate static int 1790Sstevel@tonic-gate sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup, 1800Sstevel@tonic-gate physaddr_t *pap) 1810Sstevel@tonic-gate { 1820Sstevel@tonic-gate struct hmehash_bucket *uhme_hash; 1830Sstevel@tonic-gate struct hmehash_bucket *khme_hash; 1840Sstevel@tonic-gate int uhmehash_num; 1850Sstevel@tonic-gate int khmehash_num; 1860Sstevel@tonic-gate sfmmu_t *ksfmmup; 1870Sstevel@tonic-gate struct hmehash_bucket mbucket; 1880Sstevel@tonic-gate struct hmehash_bucket *hmebp; 1890Sstevel@tonic-gate struct hmehash_bucket *shmebp; 1900Sstevel@tonic-gate hmeblk_tag hblktag; 1910Sstevel@tonic-gate int hmeshift; 1920Sstevel@tonic-gate int hashno = 1; 1930Sstevel@tonic-gate struct hme_blk *hmeblkp = NULL; 1940Sstevel@tonic-gate struct hme_blks_max mhmeblkmax; 1950Sstevel@tonic-gate intptr_t thmeblkp; 1960Sstevel@tonic-gate struct sf_hment *sfhmep; 1970Sstevel@tonic-gate int i; 1980Sstevel@tonic-gate ism_blk_t mism_blk; 1990Sstevel@tonic-gate ism_map_t *ism_map; 2000Sstevel@tonic-gate ism_blk_t *ism_blkp; 2010Sstevel@tonic-gate ism_blk_t *sism_blkp; 2020Sstevel@tonic-gate sfmmu_t *ism_hatid = NULL; 2030Sstevel@tonic-gate int sfhmeinx = 0; 2040Sstevel@tonic-gate tte_t tte; 2050Sstevel@tonic-gate pfn_t pfn; 2060Sstevel@tonic-gate pfn_t start_pfn; 2070Sstevel@tonic-gate page_t *pp; 2080Sstevel@tonic-gate int ret = -1; 2090Sstevel@tonic-gate 2100Sstevel@tonic-gate SFMMU_VTOP_READSYM(uhme_hash, "uhme_hash", "sfmmu_vtop_impl"); 2110Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("uhme_hash=%p\t", uhme_hash); 2120Sstevel@tonic-gate SFMMU_VTOP_READSYM(uhmehash_num, "uhmehash_num", "sfmmu_vtop_impl"); 2130Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("uhmehash_num=%lx\n", uhmehash_num); 2140Sstevel@tonic-gate SFMMU_VTOP_READSYM(khme_hash, "khme_hash", "sfmmu_vtop_impl"); 2150Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("khme_hash=%p\t", khme_hash); 2160Sstevel@tonic-gate SFMMU_VTOP_READSYM(khmehash_num, "khmehash_num", "sfmmu_vtop_impl"); 2170Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("khmehash_num=%lx\n", khmehash_num); 2180Sstevel@tonic-gate SFMMU_VTOP_READSYM(ksfmmup, "ksfmmup", "sfmmu_vtop_impl"); 2190Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("ksfmmup=%p\n", ksfmmup); 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate ism_blkp = sism_blkp = msfmmup->sfmmu_iblk; 2220Sstevel@tonic-gate while (ism_blkp != NULL && ism_hatid == NULL) { 2230Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("ism_blkp=%p\n", ism_blkp); 2240Sstevel@tonic-gate if (mdb_vread(&mism_blk, sizeof (mism_blk), 2250Sstevel@tonic-gate (uintptr_t)ism_blkp) == -1) { 2260Sstevel@tonic-gate mdb_warn("couldn't read ism_blk at %p\n", ism_blkp); 2270Sstevel@tonic-gate return (DCMD_ERR); 2280Sstevel@tonic-gate } 2290Sstevel@tonic-gate ism_blkp = &mism_blk; 2300Sstevel@tonic-gate ism_map = ism_blkp->iblk_maps; 2310Sstevel@tonic-gate for (i = 0; ism_map[i].imap_ismhat && i < ISM_MAP_SLOTS; i++) { 2320Sstevel@tonic-gate if ((caddr_t)addr >= ism_start(ism_map[i]) && 2330Sstevel@tonic-gate (caddr_t)addr < ism_end(ism_map[i])) { 2340Sstevel@tonic-gate sfmmup = ism_hatid = ism_map[i].imap_ismhat; 2350Sstevel@tonic-gate addr = (caddr_t)addr - ism_start(ism_map[i]); 2360Sstevel@tonic-gate SFMMU_VTOP_DBG_VRB("ism_blkp=%p inx=%d\n", 2370Sstevel@tonic-gate sism_blkp, i); 2380Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("ism map=%p ism hat=%p " 2390Sstevel@tonic-gate "addr=%llx\n", 2400Sstevel@tonic-gate (caddr_t)&ism_map[i] - (caddr_t)ism_blkp 2410Sstevel@tonic-gate + (caddr_t)sism_blkp, sfmmup, addr); 2420Sstevel@tonic-gate break; 2430Sstevel@tonic-gate } 2440Sstevel@tonic-gate } 2450Sstevel@tonic-gate ism_blkp = sism_blkp = ism_blkp->iblk_next; 2460Sstevel@tonic-gate } 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate hblktag.htag_id = sfmmup; 2490Sstevel@tonic-gate do { 2500Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("-hashno=%d-\n", hashno); 2510Sstevel@tonic-gate hmeshift = HME_HASH_SHIFT(hashno); 2520Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("hmeshift=%d\n", hmeshift); 2530Sstevel@tonic-gate hblktag.htag_bspage = HME_HASH_BSPAGE(addr, hmeshift); 2540Sstevel@tonic-gate hblktag.htag_rehash = hashno; 2550Sstevel@tonic-gate 2560Sstevel@tonic-gate #ifdef __sparcv9 2570Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("hblktag=%lx %lx\n", 2580Sstevel@tonic-gate (uint64_t)hblktag.htag_tag[0], 2590Sstevel@tonic-gate (uint64_t)hblktag.htag_tag[1]); 2600Sstevel@tonic-gate #else 2610Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("hblktag=%llx\n", 2620Sstevel@tonic-gate (uint64_t)hblktag.htag_tag); 2630Sstevel@tonic-gate #endif 2640Sstevel@tonic-gate 2650Sstevel@tonic-gate hmebp = shmebp = HME_HASH_FUNCTION(sfmmup, addr, hmeshift); 2660Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("hmebp=%p\n", hmebp); 2670Sstevel@tonic-gate 2680Sstevel@tonic-gate if (mdb_vread(&mbucket, sizeof (mbucket), 2690Sstevel@tonic-gate (uintptr_t)hmebp) == -1) { 2700Sstevel@tonic-gate mdb_warn("couldn't read mbucket at %p\n", hmebp); 2710Sstevel@tonic-gate return (DCMD_ERR); 2720Sstevel@tonic-gate } 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate hmebp = &mbucket; 2750Sstevel@tonic-gate 2760Sstevel@tonic-gate for (hmeblkp = hmebp->hmeblkp; hmeblkp; 2770Sstevel@tonic-gate hmeblkp = hmeblkp->hblk_next) { 2780Sstevel@tonic-gate 2790Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("hmeblkp=%p\n", hmeblkp); 2800Sstevel@tonic-gate 2810Sstevel@tonic-gate if (hmeblkp == NULL) 2820Sstevel@tonic-gate break; 2830Sstevel@tonic-gate 2840Sstevel@tonic-gate if (mdb_vread(&mhmeblkmax, sizeof (struct hme_blk), 2850Sstevel@tonic-gate (uintptr_t)hmeblkp) == -1) { 2860Sstevel@tonic-gate mdb_warn("couldn't read hme_blk at %p\n", 2870Sstevel@tonic-gate hmeblkp); 2880Sstevel@tonic-gate return (DCMD_ERR); 2890Sstevel@tonic-gate } 2900Sstevel@tonic-gate 2910Sstevel@tonic-gate thmeblkp = (uintptr_t)hmeblkp; 2920Sstevel@tonic-gate hmeblkp = &mhmeblkmax.hmx_hmeblk; 2930Sstevel@tonic-gate 2940Sstevel@tonic-gate if (HTAGS_EQ(hmeblkp->hblk_tag, hblktag)) { 2950Sstevel@tonic-gate /* found hme_blk */ 2960Sstevel@tonic-gate break; 2970Sstevel@tonic-gate } 2980Sstevel@tonic-gate } 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate if (hmeblkp != NULL) { 3010Sstevel@tonic-gate sfmmu_vtop_print_hmeblk(hmeblkp); 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate sfhmep = mdb_sfmmu_hblktohme(hmeblkp, (caddr_t)addr, 3040Sstevel@tonic-gate &sfhmeinx); 3050Sstevel@tonic-gate 3060Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("sfhmeinx=%d ", sfhmeinx); 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate if (sfhmeinx > 0) { 3090Sstevel@tonic-gate thmeblkp += sizeof (struct hme_blk) + 3100Sstevel@tonic-gate sizeof (struct sf_hment) * (sfhmeinx - 1); 3110Sstevel@tonic-gate 3120Sstevel@tonic-gate if (mdb_vread(sfhmep, sizeof (struct sf_hment), 3130Sstevel@tonic-gate thmeblkp) == -1) { 3140Sstevel@tonic-gate mdb_warn("couldn't read msfhme at %p\n", 3150Sstevel@tonic-gate sfhmep); 3160Sstevel@tonic-gate return (DCMD_ERR); 3170Sstevel@tonic-gate } 3180Sstevel@tonic-gate } 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate SFMMU_VTOP_DBG_VRB("sfmmup=%p hmebp=%p hmeblkp=%p\n", 3210Sstevel@tonic-gate sfmmup, shmebp, thmeblkp); 3220Sstevel@tonic-gate 3230Sstevel@tonic-gate tte = sfhmep->hme_tte; 3240Sstevel@tonic-gate SFMMU_VTOP_DBG_VRB("tte=%llx ", tte.ll); 3250Sstevel@tonic-gate if (TTE_IS_VALID(&tte)) { 3260Sstevel@tonic-gate start_pfn = TTE_TO_TTEPFN(&tte); 3270Sstevel@tonic-gate *pap = (start_pfn << MMU_PAGESHIFT) + 3280Sstevel@tonic-gate (addr & TTE_PAGE_OFFSET(tte.tte_size)); 3290Sstevel@tonic-gate pfn = *pap >> MMU_PAGESHIFT; 3300Sstevel@tonic-gate pp = (sfhmep->hme_page != 0) ? 3310Sstevel@tonic-gate sfhmep->hme_page + (pfn - start_pfn) : 3320Sstevel@tonic-gate 0; 3330Sstevel@tonic-gate SFMMU_VTOP_DBG_VRB("pfn=%lx pp=%p\n", 3340Sstevel@tonic-gate pfn, pp); 3350Sstevel@tonic-gate ret = 0; 3360Sstevel@tonic-gate } 3370Sstevel@tonic-gate break; 3380Sstevel@tonic-gate } 3390Sstevel@tonic-gate 3400Sstevel@tonic-gate hashno++; 3410Sstevel@tonic-gate 3420Sstevel@tonic-gate } while (HME_REHASH(msfmmup) && (hashno <= MAX_HASHCNT)); 3430Sstevel@tonic-gate 3440Sstevel@tonic-gate return (ret); 3450Sstevel@tonic-gate } 3460Sstevel@tonic-gate 3470Sstevel@tonic-gate static void 3480Sstevel@tonic-gate sfmmu_vtop_print_hmeblk(struct hme_blk *hmeblkp) 3490Sstevel@tonic-gate { 3500Sstevel@tonic-gate 3510Sstevel@tonic-gate if ((sfmmu_vtop_dbg & SFMMU_VTOP_DBG_DEBUG) == NULL) 3520Sstevel@tonic-gate return; 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate mdb_printf(" hblk_nextpa=%llx\n", hmeblkp->hblk_nextpa); 3550Sstevel@tonic-gate #ifdef __sparcv9 3560Sstevel@tonic-gate mdb_printf(" hblktag=%lx %lx\n", hmeblkp->hblk_tag.htag_tag[0], 3570Sstevel@tonic-gate hmeblkp->hblk_tag.htag_tag[1]); 3580Sstevel@tonic-gate #else 3590Sstevel@tonic-gate mdb_printf(" hblktag=%llx\n", hmeblkp->hblk_tag.htag_tag); 3600Sstevel@tonic-gate #endif 3610Sstevel@tonic-gate mdb_printf(" hblk_next=%p\n", hmeblkp->hblk_next); 3620Sstevel@tonic-gate mdb_printf(" hblk_shadow=%p\n", hmeblkp->hblk_shadow); 3630Sstevel@tonic-gate mdb_printf(" hblk_span=%d\n", hmeblkp->hblk_span); 3640Sstevel@tonic-gate mdb_printf(" hblk_ttesz=%d\n", hmeblkp->hblk_ttesz); 3650Sstevel@tonic-gate if (hmeblkp->hblk_shw_bit == 0) { 3660Sstevel@tonic-gate mdb_printf(" hblk_hmecnt=%d\n", hmeblkp->hblk_hmecnt); 3670Sstevel@tonic-gate mdb_printf(" hblk_vcnt=%d\n", hmeblkp->hblk_vcnt); 3680Sstevel@tonic-gate } else { 3690Sstevel@tonic-gate mdb_printf(" hblk_shw_mask=%x\n", hmeblkp->hblk_shw_mask); 3700Sstevel@tonic-gate } 3710Sstevel@tonic-gate } 3720Sstevel@tonic-gate 3730Sstevel@tonic-gate static struct sf_hment * 3740Sstevel@tonic-gate mdb_sfmmu_hblktohme(struct hme_blk *hmeblkp, caddr_t addr, int *hmenump) 3750Sstevel@tonic-gate { 3760Sstevel@tonic-gate int index = 0; 3770Sstevel@tonic-gate 3780Sstevel@tonic-gate if (get_hblk_ttesz(hmeblkp) == TTE8K) { 3790Sstevel@tonic-gate index = (((uintptr_t)addr >> MMU_PAGESHIFT) & (NHMENTS-1)); 3800Sstevel@tonic-gate } 3810Sstevel@tonic-gate 3820Sstevel@tonic-gate if (hmenump) { 3830Sstevel@tonic-gate *hmenump = index; 3840Sstevel@tonic-gate } 3850Sstevel@tonic-gate 3860Sstevel@tonic-gate return (&hmeblkp->hblk_hme[index]); 3870Sstevel@tonic-gate } 3880Sstevel@tonic-gate 3890Sstevel@tonic-gate /* 3900Sstevel@tonic-gate * memseg walker based callback function: used internal and for ::page_num2pp 3910Sstevel@tonic-gate */ 3920Sstevel@tonic-gate 3930Sstevel@tonic-gate struct pfn2pp { 3940Sstevel@tonic-gate pfn_t pfn; 3950Sstevel@tonic-gate page_t *pp; 3960Sstevel@tonic-gate }; 3970Sstevel@tonic-gate 3980Sstevel@tonic-gate /*ARGSUSED*/ 3990Sstevel@tonic-gate int 4000Sstevel@tonic-gate page_num2pp_cb(uintptr_t addr, void *ignored, uintptr_t *data) 4010Sstevel@tonic-gate { 4020Sstevel@tonic-gate struct memseg ms, *msp = &ms; 4030Sstevel@tonic-gate struct pfn2pp *p = (struct pfn2pp *)data; 4040Sstevel@tonic-gate 4050Sstevel@tonic-gate if (mdb_vread(msp, sizeof (struct memseg), addr) == -1) { 4060Sstevel@tonic-gate mdb_warn("can't read memseg at %#lx", addr); 4070Sstevel@tonic-gate return (DCMD_ERR); 4080Sstevel@tonic-gate } 4090Sstevel@tonic-gate 4100Sstevel@tonic-gate if (p->pfn >= msp->pages_base && p->pfn < msp->pages_end) { 4110Sstevel@tonic-gate p->pp = msp->pages + (p->pfn - msp->pages_base); 4120Sstevel@tonic-gate return (WALK_DONE); 4130Sstevel@tonic-gate } 4140Sstevel@tonic-gate 4150Sstevel@tonic-gate return (WALK_NEXT); 4160Sstevel@tonic-gate } 4170Sstevel@tonic-gate 4180Sstevel@tonic-gate /* 4190Sstevel@tonic-gate * ::page_num2pp dcmd 4200Sstevel@tonic-gate */ 4210Sstevel@tonic-gate /*ARGSUSED*/ 4220Sstevel@tonic-gate int 4230Sstevel@tonic-gate page_num2pp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 4240Sstevel@tonic-gate { 4250Sstevel@tonic-gate struct pfn2pp pfn2pp; 4260Sstevel@tonic-gate page_t page; 4270Sstevel@tonic-gate 4280Sstevel@tonic-gate if ((flags & DCMD_ADDRSPEC) == 0) { 4290Sstevel@tonic-gate mdb_warn("page frame number missing\n"); 4300Sstevel@tonic-gate return (DCMD_USAGE); 4310Sstevel@tonic-gate } 4320Sstevel@tonic-gate 4330Sstevel@tonic-gate pfn2pp.pfn = (pfn_t)addr; 4340Sstevel@tonic-gate pfn2pp.pp = NULL; 4350Sstevel@tonic-gate 4360Sstevel@tonic-gate if (mdb_walk("memseg", (mdb_walk_cb_t)page_num2pp_cb, 4370Sstevel@tonic-gate (void *)&pfn2pp) == -1) { 4380Sstevel@tonic-gate mdb_warn("can't walk memseg"); 4390Sstevel@tonic-gate return (DCMD_ERR); 4400Sstevel@tonic-gate } 4410Sstevel@tonic-gate 4420Sstevel@tonic-gate if (pfn2pp.pp == NULL) 4430Sstevel@tonic-gate return (DCMD_ERR); 4440Sstevel@tonic-gate 4450Sstevel@tonic-gate mdb_printf("%lx has mpage at %p\n", pfn2pp.pfn, pfn2pp.pp); 4460Sstevel@tonic-gate 4470Sstevel@tonic-gate if (mdb_vread(&page, sizeof (page_t), 4480Sstevel@tonic-gate (uintptr_t)pfn2pp.pp) == -1) { 4490Sstevel@tonic-gate mdb_warn("can't read page at %p", &page); 4500Sstevel@tonic-gate return (DCMD_ERR); 4510Sstevel@tonic-gate } 4520Sstevel@tonic-gate 4530Sstevel@tonic-gate if (page.p_pagenum != pfn2pp.pfn) { 4540Sstevel@tonic-gate mdb_warn("WARNING! Found page structure contains " 4550Sstevel@tonic-gate "different pagenumber %x\n", page.p_pagenum); 4560Sstevel@tonic-gate } 4570Sstevel@tonic-gate 4580Sstevel@tonic-gate return (DCMD_OK); 4590Sstevel@tonic-gate } 4600Sstevel@tonic-gate 4610Sstevel@tonic-gate /* 4620Sstevel@tonic-gate * ::memseg_list dcmd 4630Sstevel@tonic-gate */ 4640Sstevel@tonic-gate /*ARGSUSED*/ 4650Sstevel@tonic-gate int 4660Sstevel@tonic-gate memseg_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 4670Sstevel@tonic-gate { 4680Sstevel@tonic-gate struct memseg ms; 4690Sstevel@tonic-gate 4700Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC)) { 4710Sstevel@tonic-gate if (mdb_pwalk_dcmd("memseg", "memseg_list", 4720Sstevel@tonic-gate 0, NULL, 0) == -1) { 4730Sstevel@tonic-gate mdb_warn("can't walk memseg"); 4740Sstevel@tonic-gate return (DCMD_ERR); 4750Sstevel@tonic-gate } 4760Sstevel@tonic-gate return (DCMD_OK); 4770Sstevel@tonic-gate } 4780Sstevel@tonic-gate 4790Sstevel@tonic-gate if (DCMD_HDRSPEC(flags)) 4800Sstevel@tonic-gate mdb_printf("%<u>%?s %?s %?s %?s %?s%</u>\n", "ADDR", 4810Sstevel@tonic-gate "PAGES", "EPAGES", "BASE", "END"); 4820Sstevel@tonic-gate 4830Sstevel@tonic-gate if (mdb_vread(&ms, sizeof (struct memseg), addr) == -1) { 4840Sstevel@tonic-gate mdb_warn("can't read memseg at %#lx", addr); 4850Sstevel@tonic-gate return (DCMD_ERR); 4860Sstevel@tonic-gate } 4870Sstevel@tonic-gate 4880Sstevel@tonic-gate mdb_printf("%0?lx %0?lx %0?lx %0?lx %0?lx\n", addr, 4890Sstevel@tonic-gate ms.pages, ms.epages, ms.pages_base, ms.pages_end); 4900Sstevel@tonic-gate 4910Sstevel@tonic-gate return (DCMD_OK); 4920Sstevel@tonic-gate } 4930Sstevel@tonic-gate 4940Sstevel@tonic-gate /* 4950Sstevel@tonic-gate * walk the memseg structures 4960Sstevel@tonic-gate */ 4970Sstevel@tonic-gate int 4980Sstevel@tonic-gate memseg_walk_init(mdb_walk_state_t *wsp) 4990Sstevel@tonic-gate { 5000Sstevel@tonic-gate if (wsp->walk_addr != NULL) { 5010Sstevel@tonic-gate mdb_warn("memseg only supports global walks\n"); 5020Sstevel@tonic-gate return (WALK_ERR); 5030Sstevel@tonic-gate } 5040Sstevel@tonic-gate 5050Sstevel@tonic-gate if (mdb_readvar(&wsp->walk_addr, "memsegs") == -1) { 5060Sstevel@tonic-gate mdb_warn("symbol 'memsegs' not found"); 5070Sstevel@tonic-gate return (WALK_ERR); 5080Sstevel@tonic-gate } 5090Sstevel@tonic-gate 5100Sstevel@tonic-gate wsp->walk_data = mdb_alloc(sizeof (struct memseg), UM_SLEEP); 5110Sstevel@tonic-gate return (WALK_NEXT); 5120Sstevel@tonic-gate 5130Sstevel@tonic-gate } 5140Sstevel@tonic-gate 5150Sstevel@tonic-gate int 5160Sstevel@tonic-gate memseg_walk_step(mdb_walk_state_t *wsp) 5170Sstevel@tonic-gate { 5180Sstevel@tonic-gate int status; 5190Sstevel@tonic-gate 5200Sstevel@tonic-gate if (wsp->walk_addr == 0) { 5210Sstevel@tonic-gate return (WALK_DONE); 5220Sstevel@tonic-gate } 5230Sstevel@tonic-gate 5240Sstevel@tonic-gate if (mdb_vread(wsp->walk_data, sizeof (struct memseg), 5250Sstevel@tonic-gate wsp->walk_addr) == -1) { 5260Sstevel@tonic-gate mdb_warn("failed to read struct memseg at %p", wsp->walk_addr); 5270Sstevel@tonic-gate return (WALK_DONE); 5280Sstevel@tonic-gate } 5290Sstevel@tonic-gate 5300Sstevel@tonic-gate status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, 5310Sstevel@tonic-gate wsp->walk_cbdata); 5320Sstevel@tonic-gate 5330Sstevel@tonic-gate wsp->walk_addr = (uintptr_t)(((struct memseg *)wsp->walk_data)->next); 5340Sstevel@tonic-gate 5350Sstevel@tonic-gate return (status); 5360Sstevel@tonic-gate } 5370Sstevel@tonic-gate 5380Sstevel@tonic-gate void 5390Sstevel@tonic-gate memseg_walk_fini(mdb_walk_state_t *wsp) 5400Sstevel@tonic-gate { 5410Sstevel@tonic-gate mdb_free(wsp->walk_data, sizeof (struct memseg)); 5420Sstevel@tonic-gate } 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate int 5450Sstevel@tonic-gate platform_vtop(uintptr_t addr, struct as *asp, physaddr_t *pap) 5460Sstevel@tonic-gate { 5470Sstevel@tonic-gate int rv; 5480Sstevel@tonic-gate 5490Sstevel@tonic-gate sfmmu_vtop_dbg = sfmmu_vtop_dbg_wanted; 5500Sstevel@tonic-gate 5510Sstevel@tonic-gate SFMMU_VTOP_DBG_DBG("platform_vtop: called.\n"); 5520Sstevel@tonic-gate 5530Sstevel@tonic-gate if (asp == NULL) { 5540Sstevel@tonic-gate return (DCMD_ERR); 5550Sstevel@tonic-gate } 5560Sstevel@tonic-gate 5570Sstevel@tonic-gate if ((rv = sfmmu_vtop_common(asp, addr, pap)) == 0) { 5580Sstevel@tonic-gate mdb_printf("address space %p: ", asp); 5590Sstevel@tonic-gate } 5600Sstevel@tonic-gate 5610Sstevel@tonic-gate return (rv); 5620Sstevel@tonic-gate } 5630Sstevel@tonic-gate 5640Sstevel@tonic-gate /* 5650Sstevel@tonic-gate * ::tsbinfo help 5660Sstevel@tonic-gate */ 5670Sstevel@tonic-gate void 5680Sstevel@tonic-gate tsbinfo_help(void) 5690Sstevel@tonic-gate { 5700Sstevel@tonic-gate mdb_printf("-l\tlist valid TSB entries.\n" 5710Sstevel@tonic-gate "-a\tlist all TSB entries. Can only be used with -l.\n"); 5720Sstevel@tonic-gate } 5730Sstevel@tonic-gate 5740Sstevel@tonic-gate /* 5750Sstevel@tonic-gate * ::tsbinfo dcmd 5760Sstevel@tonic-gate */ 5770Sstevel@tonic-gate int 5780Sstevel@tonic-gate tsbinfo_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 5790Sstevel@tonic-gate { 5800Sstevel@tonic-gate uint_t lflag = 0, aflag = 0; 5810Sstevel@tonic-gate struct tsb_info tsbinfo; 5820Sstevel@tonic-gate unsigned int entries = 0; 5830Sstevel@tonic-gate struct tsbe *tsbp, *tsbend, *tsbstart; 5840Sstevel@tonic-gate caddr_t va; 5850Sstevel@tonic-gate uintptr_t pa; 5860Sstevel@tonic-gate uint_t tsbbytes; 5870Sstevel@tonic-gate char tsbsize[16]; 5880Sstevel@tonic-gate #define FLAGS_SIZE sizeof ("RELOC,FLUSH,SWAPPED") 5890Sstevel@tonic-gate char tsbflags[FLAGS_SIZE + 1]; 5900Sstevel@tonic-gate 5910Sstevel@tonic-gate static const mdb_bitmask_t ttesz_mask_bits[] = { 5920Sstevel@tonic-gate { "8K", TSB8K, TSB8K }, 5930Sstevel@tonic-gate { "64K", TSB64K, TSB64K }, 5940Sstevel@tonic-gate { "512K", TSB512K, TSB512K }, 5950Sstevel@tonic-gate { "4M", TSB4M, TSB4M }, 596*490Ssusans { "32M", TSB32M, TSB32M }, 597*490Ssusans { "256M", TSB256M, TSB256M }, 5980Sstevel@tonic-gate { NULL, 0, 0 } 5990Sstevel@tonic-gate }; 6000Sstevel@tonic-gate 6010Sstevel@tonic-gate static const mdb_bitmask_t flags_bits[] = { 6020Sstevel@tonic-gate { "RELOC", TSB_RELOC_FLAG, TSB_RELOC_FLAG }, 6030Sstevel@tonic-gate { "FLUSH", TSB_FLUSH_NEEDED, TSB_FLUSH_NEEDED }, 6040Sstevel@tonic-gate { "SWAPPED", TSB_SWAPPED, TSB_SWAPPED }, 6050Sstevel@tonic-gate { NULL, 0, 0 } 6060Sstevel@tonic-gate }; 6070Sstevel@tonic-gate 6080Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC)) { 6090Sstevel@tonic-gate return (DCMD_USAGE); 6100Sstevel@tonic-gate } 6110Sstevel@tonic-gate 6120Sstevel@tonic-gate if (mdb_getopts(argc, argv, 6130Sstevel@tonic-gate 'l', MDB_OPT_SETBITS, TRUE, &lflag, 6140Sstevel@tonic-gate 'a', MDB_OPT_SETBITS, TRUE, &aflag, 6150Sstevel@tonic-gate NULL) != argc) { 6160Sstevel@tonic-gate return (DCMD_USAGE); 6170Sstevel@tonic-gate } 6180Sstevel@tonic-gate 6190Sstevel@tonic-gate /* -a only valid with -l */ 6200Sstevel@tonic-gate if (aflag && !lflag) { 6210Sstevel@tonic-gate return (DCMD_USAGE); 6220Sstevel@tonic-gate } 6230Sstevel@tonic-gate 6240Sstevel@tonic-gate /* Print header? */ 6250Sstevel@tonic-gate if (DCMD_HDRSPEC(flags) || lflag) { 6260Sstevel@tonic-gate mdb_printf("%<u>%-?s %-?s %-8s %-*s %s%</u>\n", "TSBINFO", 6270Sstevel@tonic-gate "TSB", "SIZE", FLAGS_SIZE, "FLAGS", "TTE SIZES"); 6280Sstevel@tonic-gate } 6290Sstevel@tonic-gate 6300Sstevel@tonic-gate if (mdb_vread(&tsbinfo, sizeof (struct tsb_info), addr) == -1) { 6310Sstevel@tonic-gate mdb_warn("failed to read struct tsb_info at %p", addr); 6320Sstevel@tonic-gate return (DCMD_ERR); 6330Sstevel@tonic-gate } 6340Sstevel@tonic-gate 6350Sstevel@tonic-gate mdb_printf("%0?lx ", addr); 6360Sstevel@tonic-gate 6370Sstevel@tonic-gate /* Print a "-" if the TSB is swapped out. */ 6380Sstevel@tonic-gate if ((tsbinfo.tsb_flags & TSB_SWAPPED) == 0) { 6390Sstevel@tonic-gate mdb_printf("%0?lx ", tsbinfo.tsb_va); 6400Sstevel@tonic-gate } else { 6410Sstevel@tonic-gate mdb_printf("%0?-s ", "-"); 6420Sstevel@tonic-gate } 6430Sstevel@tonic-gate 6440Sstevel@tonic-gate tsbbytes = TSB_BYTES(tsbinfo.tsb_szc); 6450Sstevel@tonic-gate 6460Sstevel@tonic-gate #define KB 1024 6470Sstevel@tonic-gate #define MB (KB*KB) 6480Sstevel@tonic-gate if (tsbbytes >= MB) { 6490Sstevel@tonic-gate mdb_snprintf(tsbsize, sizeof (tsbsize), "%dM", tsbbytes / MB); 6500Sstevel@tonic-gate } else { 6510Sstevel@tonic-gate mdb_snprintf(tsbsize, sizeof (tsbsize), "%dK", tsbbytes / KB); 6520Sstevel@tonic-gate } 6530Sstevel@tonic-gate #undef MB 6540Sstevel@tonic-gate #undef KB 6550Sstevel@tonic-gate mdb_printf("%-8s ", tsbsize); 6560Sstevel@tonic-gate 6570Sstevel@tonic-gate if (tsbinfo.tsb_flags == 0) { 6580Sstevel@tonic-gate mdb_printf("%-*s ", FLAGS_SIZE, "-"); 6590Sstevel@tonic-gate } else { 6600Sstevel@tonic-gate mdb_snprintf(tsbflags, sizeof (tsbflags), "%b", 6610Sstevel@tonic-gate tsbinfo.tsb_flags, flags_bits); 6620Sstevel@tonic-gate mdb_printf("%-*s ", FLAGS_SIZE, tsbflags); 6630Sstevel@tonic-gate } 6640Sstevel@tonic-gate 6650Sstevel@tonic-gate mdb_printf("%b\n", tsbinfo.tsb_ttesz_mask, ttesz_mask_bits); 6660Sstevel@tonic-gate 6670Sstevel@tonic-gate /* Print TSB entries? */ 6680Sstevel@tonic-gate if (lflag) { 6690Sstevel@tonic-gate 6700Sstevel@tonic-gate if ((tsbinfo.tsb_flags & TSB_SWAPPED) == 0) { 6710Sstevel@tonic-gate 6720Sstevel@tonic-gate entries = TSB_ENTRIES(tsbinfo.tsb_szc); 6730Sstevel@tonic-gate 6740Sstevel@tonic-gate tsbp = mdb_alloc(sizeof (struct tsbe) * entries, 6750Sstevel@tonic-gate UM_SLEEP); 6760Sstevel@tonic-gate 6770Sstevel@tonic-gate if (mdb_vread(tsbp, sizeof (struct tsbe) * entries, 6780Sstevel@tonic-gate (uintptr_t)tsbinfo.tsb_va) == -1) { 6790Sstevel@tonic-gate mdb_warn("failed to read TSB at %p", 6800Sstevel@tonic-gate tsbinfo.tsb_va); 6810Sstevel@tonic-gate return (DCMD_ERR); 6820Sstevel@tonic-gate } 6830Sstevel@tonic-gate 6840Sstevel@tonic-gate mdb_printf( 6850Sstevel@tonic-gate "TSB @ %lx (%d entries)\n" 6860Sstevel@tonic-gate "%-?s %-17s %s\n" 687*490Ssusans "%<u>%-?s %1s %1s %-11s " 688*490Ssusans "%1s %1s %1s %1s %1s %1s %8s " 689*490Ssusans "%1s %1s %1s %1s %1s %1s %1s " 690*490Ssusans "%1s %1s %1s %1s %1s %1s%</u>\n", 691*490Ssusans tsbinfo.tsb_va, entries, "", "TAG", "TTE", 692*490Ssusans "ADDR", "I", "L", "VA 63:22", 693*490Ssusans "V", "S", "N", "I", "H", "S", "PA 42:13", 694*490Ssusans "N", "U", "R", "W", "E", "X", "L", 695*490Ssusans "P", "V", "E", "P", "W", "G"); 6960Sstevel@tonic-gate 6970Sstevel@tonic-gate tsbend = tsbp + entries; 6980Sstevel@tonic-gate for (tsbstart = tsbp; tsbp < tsbend; tsbp++) { 6990Sstevel@tonic-gate if (aflag || 7000Sstevel@tonic-gate (tsbp->tte_tag.tag_invalid == 0)) { 7010Sstevel@tonic-gate 7020Sstevel@tonic-gate va = (caddr_t) 7030Sstevel@tonic-gate (((uint64_t)tsbp->tte_tag.tag_vahi 7040Sstevel@tonic-gate << 32) + 7050Sstevel@tonic-gate tsbp->tte_tag.tag_valo); 7060Sstevel@tonic-gate pa = (tsbp->tte_data.tte_pahi << 19) + 7070Sstevel@tonic-gate tsbp->tte_data.tte_palo; 708*490Ssusans mdb_printf("%0?lx %-1u %-1u %011lx " 709*490Ssusans "%1u %-1u %-1u %-1u %-1u %1u %08x " 710*490Ssusans "%1u %1u %1u %1u %1u %1u %1u " 7110Sstevel@tonic-gate "%1u %1u %1u %1u %1u %1u\n", 7120Sstevel@tonic-gate tsbinfo.tsb_va + (tsbp - tsbstart) 7130Sstevel@tonic-gate * sizeof (struct tsbe), 7140Sstevel@tonic-gate tsbp->tte_tag.tag_invalid, 7150Sstevel@tonic-gate tsbp->tte_tag.tag_locked, va, 7160Sstevel@tonic-gate tsbp->tte_data.tte_val, 7170Sstevel@tonic-gate tsbp->tte_data.tte_size, 7180Sstevel@tonic-gate tsbp->tte_data.tte_nfo, 7190Sstevel@tonic-gate tsbp->tte_data.tte_ie, 7200Sstevel@tonic-gate tsbp->tte_data.tte_hmenum, 7210Sstevel@tonic-gate #ifdef sun4v 7220Sstevel@tonic-gate 0, 7230Sstevel@tonic-gate #else 724*490Ssusans tsbp->tte_data.tte_size2, 7250Sstevel@tonic-gate #endif 7260Sstevel@tonic-gate pa, 727*490Ssusans tsbp->tte_data.tte_no_sync, 728*490Ssusans tsbp->tte_data.tte_suspend, 7290Sstevel@tonic-gate tsbp->tte_data.tte_ref, 7300Sstevel@tonic-gate tsbp->tte_data.tte_wr_perm, 731*490Ssusans #ifdef sun4v 732*490Ssusans 0, 733*490Ssusans #else 734*490Ssusans tsbp->tte_data.tte_exec_synth, 735*490Ssusans #endif 7360Sstevel@tonic-gate tsbp->tte_data.tte_exec_perm, 7370Sstevel@tonic-gate tsbp->tte_data.tte_lock, 7380Sstevel@tonic-gate tsbp->tte_data.tte_cp, 7390Sstevel@tonic-gate tsbp->tte_data.tte_cv, 7400Sstevel@tonic-gate tsbp->tte_data.tte_se, 7410Sstevel@tonic-gate tsbp->tte_data.tte_priv, 7420Sstevel@tonic-gate tsbp->tte_data.tte_hwwr, 7430Sstevel@tonic-gate #ifdef sun4v 7440Sstevel@tonic-gate 0 7450Sstevel@tonic-gate #else 7460Sstevel@tonic-gate tsbp->tte_data.tte_glb 7470Sstevel@tonic-gate #endif 7480Sstevel@tonic-gate /*CSTYLED*/ 7490Sstevel@tonic-gate ); 7500Sstevel@tonic-gate } 7510Sstevel@tonic-gate } 7520Sstevel@tonic-gate 7530Sstevel@tonic-gate mdb_printf("\n"); /* blank line for readability */ 7540Sstevel@tonic-gate 7550Sstevel@tonic-gate mdb_free(tsbstart, sizeof (struct tsbe) * entries); 7560Sstevel@tonic-gate 7570Sstevel@tonic-gate } else { 7580Sstevel@tonic-gate 7590Sstevel@tonic-gate mdb_printf("TSB swapped out\n"); 7600Sstevel@tonic-gate } 7610Sstevel@tonic-gate } 7620Sstevel@tonic-gate 7630Sstevel@tonic-gate return (DCMD_OK); 7640Sstevel@tonic-gate } 765