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