xref: /titanic_44/usr/src/uts/sun4u/os/mach_trap.c (revision d6c90996e9f85ae712e669bf3b6efd3ba5fafde2)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*d6c90996SAbhinandan Ekande  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #include <sys/trap.h>
277c478bd9Sstevel@tonic-gate #include <sys/machtrap.h>
287c478bd9Sstevel@tonic-gate #include <sys/machsystm.h>
297c478bd9Sstevel@tonic-gate #include <sys/cpu_module.h>
307c478bd9Sstevel@tonic-gate #include <sys/panic.h>
317c478bd9Sstevel@tonic-gate #include <sys/uadmin.h>
327c478bd9Sstevel@tonic-gate #include <sys/kobj.h>
337c478bd9Sstevel@tonic-gate #include <vm/hat_sfmmu.h>
347c478bd9Sstevel@tonic-gate #include <sys/reboot.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef  TRAPTRACE
377c478bd9Sstevel@tonic-gate #include <sys/traptrace.h>
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate void showregs(unsigned, struct regs *, caddr_t, uint_t);
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate extern int tudebug;
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate void
mmu_print_sfsr(uint_t sfsr)457c478bd9Sstevel@tonic-gate mmu_print_sfsr(uint_t sfsr)
467c478bd9Sstevel@tonic-gate {
477c478bd9Sstevel@tonic-gate 	printf("MMU sfsr=%x:", sfsr);
487c478bd9Sstevel@tonic-gate 	switch (X_FAULT_TYPE(sfsr)) {
497c478bd9Sstevel@tonic-gate 	case FT_NONE:
507c478bd9Sstevel@tonic-gate 		printf(" No error");
517c478bd9Sstevel@tonic-gate 		break;
527c478bd9Sstevel@tonic-gate 	case FT_PRIV:
537c478bd9Sstevel@tonic-gate 		printf(" Privilege violation");
547c478bd9Sstevel@tonic-gate 		break;
557c478bd9Sstevel@tonic-gate 	case FT_SPEC_LD:
567c478bd9Sstevel@tonic-gate 		printf(" Speculative load on E-bit page");
577c478bd9Sstevel@tonic-gate 		break;
587c478bd9Sstevel@tonic-gate 	case FT_ATOMIC_NC:
597c478bd9Sstevel@tonic-gate 		printf(" Atomic to uncacheable page");
607c478bd9Sstevel@tonic-gate 		break;
617c478bd9Sstevel@tonic-gate 	case FT_ILL_ALT:
627c478bd9Sstevel@tonic-gate 		printf(" Illegal lda or sta");
637c478bd9Sstevel@tonic-gate 		break;
647c478bd9Sstevel@tonic-gate 	case FT_NFO:
657c478bd9Sstevel@tonic-gate 		printf(" Normal access to NFO page");
667c478bd9Sstevel@tonic-gate 		break;
677c478bd9Sstevel@tonic-gate 	case FT_RANGE:
687c478bd9Sstevel@tonic-gate 		printf(" Data or instruction address out of range");
697c478bd9Sstevel@tonic-gate 		break;
707c478bd9Sstevel@tonic-gate 	case FT_RANGE_REG:
717c478bd9Sstevel@tonic-gate 		printf(" Jump to register out of range");
727c478bd9Sstevel@tonic-gate 		break;
737c478bd9Sstevel@tonic-gate 	default:
747c478bd9Sstevel@tonic-gate 		printf(" Unknown error");
757c478bd9Sstevel@tonic-gate 		break;
767c478bd9Sstevel@tonic-gate 	}
777c478bd9Sstevel@tonic-gate 	if (sfsr) {
787c478bd9Sstevel@tonic-gate 		printf(" on ASI 0x%x E %d CID %d PRIV %d W %d OW %d FV %d",
797c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_ASI) >> SFSR_ASI_SHIFT,
807c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_E) != 0,
817c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_CTX) >> SFSR_CT_SHIFT,
827c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_PR) != 0,
837c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_W) != 0,
847c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_OW) != 0,
857c478bd9Sstevel@tonic-gate 		    (sfsr & SFSR_FV) != 0);
867c478bd9Sstevel@tonic-gate 	}
877c478bd9Sstevel@tonic-gate 	printf("\n");
887c478bd9Sstevel@tonic-gate }
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #ifdef TRAPWINDOW
917c478bd9Sstevel@tonic-gate long trap_window[25];
927c478bd9Sstevel@tonic-gate #endif /* TRAPWINDOW */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate  * Print out debugging info.
967c478bd9Sstevel@tonic-gate  */
977c478bd9Sstevel@tonic-gate /*ARGSUSED*/
987c478bd9Sstevel@tonic-gate void
showregs(uint_t type,struct regs * rp,caddr_t addr,uint_t mmu_fsr)997c478bd9Sstevel@tonic-gate showregs(uint_t type, struct regs *rp, caddr_t addr, uint_t mmu_fsr)
1007c478bd9Sstevel@tonic-gate {
1017c478bd9Sstevel@tonic-gate 	int s;
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate 	s = spl7();
1047c478bd9Sstevel@tonic-gate 	type &= ~T_USER;
105ae115bc7Smrj 	printf("%s: ", PTOU(curproc)->u_comm);
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate 	switch (type) {
1087c478bd9Sstevel@tonic-gate 	case T_SYS_RTT_ALIGN:
1097c478bd9Sstevel@tonic-gate 	case T_ALIGNMENT:
1107c478bd9Sstevel@tonic-gate 		printf("alignment error:\n");
1117c478bd9Sstevel@tonic-gate 		break;
1127c478bd9Sstevel@tonic-gate 	case T_INSTR_EXCEPTION:
1137c478bd9Sstevel@tonic-gate 		printf("text access exception:\n");
1147c478bd9Sstevel@tonic-gate 		break;
1157c478bd9Sstevel@tonic-gate 	case T_DATA_EXCEPTION:
1167c478bd9Sstevel@tonic-gate 		printf("data access exception:\n");
1177c478bd9Sstevel@tonic-gate 		break;
1187c478bd9Sstevel@tonic-gate 	case T_PRIV_INSTR:
1197c478bd9Sstevel@tonic-gate 		printf("privileged instruction fault:\n");
1207c478bd9Sstevel@tonic-gate 		break;
1217c478bd9Sstevel@tonic-gate 	case T_UNIMP_INSTR:
1227c478bd9Sstevel@tonic-gate 		printf("illegal instruction fault:\n");
1237c478bd9Sstevel@tonic-gate 		break;
1247c478bd9Sstevel@tonic-gate 	case T_IDIV0:
1257c478bd9Sstevel@tonic-gate 		printf("integer divide zero trap:\n");
1267c478bd9Sstevel@tonic-gate 		break;
1277c478bd9Sstevel@tonic-gate 	case T_DIV0:
1287c478bd9Sstevel@tonic-gate 		printf("zero divide trap:\n");
1297c478bd9Sstevel@tonic-gate 		break;
1307c478bd9Sstevel@tonic-gate 	case T_INT_OVERFLOW:
1317c478bd9Sstevel@tonic-gate 		printf("integer overflow:\n");
1327c478bd9Sstevel@tonic-gate 		break;
1337c478bd9Sstevel@tonic-gate 	case T_BREAKPOINT:
1347c478bd9Sstevel@tonic-gate 		printf("breakpoint trap:\n");
1357c478bd9Sstevel@tonic-gate 		break;
1367c478bd9Sstevel@tonic-gate 	case T_TAG_OVERFLOW:
1377c478bd9Sstevel@tonic-gate 		printf("tag overflow:\n");
1387c478bd9Sstevel@tonic-gate 		break;
1397c478bd9Sstevel@tonic-gate 	default:
1407c478bd9Sstevel@tonic-gate 		if (type >= T_SOFTWARE_TRAP && type <= T_ESOFTWARE_TRAP)
1417c478bd9Sstevel@tonic-gate 			printf("software trap 0x%x\n", type - T_SOFTWARE_TRAP);
1427c478bd9Sstevel@tonic-gate 		else
1437c478bd9Sstevel@tonic-gate 			printf("trap type = 0x%x\n", type);
1447c478bd9Sstevel@tonic-gate 		break;
1457c478bd9Sstevel@tonic-gate 	}
1467c478bd9Sstevel@tonic-gate 	if (type == T_DATA_EXCEPTION || type == T_INSTR_EXCEPTION) {
1477c478bd9Sstevel@tonic-gate 		mmu_print_sfsr(mmu_fsr);
1487c478bd9Sstevel@tonic-gate 	} else if (addr) {
1497c478bd9Sstevel@tonic-gate 		printf("addr=0x%p\n", (void *)addr);
1507c478bd9Sstevel@tonic-gate 	}
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate 	printf("pid=%d, pc=0x%lx, sp=0x%llx, tstate=0x%llx, context=0x%x\n",
1537c478bd9Sstevel@tonic-gate 	    (ttoproc(curthread) && ttoproc(curthread)->p_pidp) ?
1547c478bd9Sstevel@tonic-gate 	    (ttoproc(curthread)->p_pid) : 0, rp->r_pc, rp->r_sp,
1557c478bd9Sstevel@tonic-gate 	    rp->r_tstate, sfmmu_getctx_sec());
1567c478bd9Sstevel@tonic-gate 	if (USERMODE(rp->r_tstate)) {
1577c478bd9Sstevel@tonic-gate 		printf("o0-o7: %llx, %llx, %llx, %llx, %llx, %llx, "
1587c478bd9Sstevel@tonic-gate 		    "%llx, %llx\n", rp->r_o0, rp->r_o1, rp->r_o2, rp->r_o3,
1597c478bd9Sstevel@tonic-gate 		    rp->r_o4, rp->r_o5, rp->r_o6, rp->r_o7);
1607c478bd9Sstevel@tonic-gate 	}
1617c478bd9Sstevel@tonic-gate 	printf("g1-g7: %llx, %llx, %llx, %llx, %llx, %llx, %llx\n",
1627c478bd9Sstevel@tonic-gate 	    rp->r_g1, rp->r_g2, rp->r_g3,
1637c478bd9Sstevel@tonic-gate 	    rp->r_g4, rp->r_g5, rp->r_g6, rp->r_g7);
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #ifdef TRAPWINDOW
1667c478bd9Sstevel@tonic-gate 	printf("trap_window: wim=%x\n", trap_window[24]);
1677c478bd9Sstevel@tonic-gate 	printf("o0-o7: %x, %x, %x, %x, %x, %x, %x, %x\n",
1687c478bd9Sstevel@tonic-gate 	    trap_window[0], trap_window[1], trap_window[2], trap_window[3],
1697c478bd9Sstevel@tonic-gate 	    trap_window[4], trap_window[5], trap_window[6], trap_window[7]);
1707c478bd9Sstevel@tonic-gate 	printf("l0-l7: %x, %x, %x, %x, %x, %x, %x, %x\n",
1717c478bd9Sstevel@tonic-gate 	    trap_window[8], trap_window[9], trap_window[10], trap_window[11],
1727c478bd9Sstevel@tonic-gate 	    trap_window[12], trap_window[13], trap_window[14], trap_window[15]);
1737c478bd9Sstevel@tonic-gate 	printf("i0-i7: %x, %x, %x, %x, %x, %x, %x, %x\n",
1747c478bd9Sstevel@tonic-gate 	    trap_window[16], trap_window[17], trap_window[18], trap_window[19],
1757c478bd9Sstevel@tonic-gate 	    trap_window[20], trap_window[21], trap_window[22], trap_window[23]);
1767c478bd9Sstevel@tonic-gate #endif /* TRAPWINDOW */
1777c478bd9Sstevel@tonic-gate 	if (tudebug > 1 && (boothowto & RB_DEBUG)) {
1787c478bd9Sstevel@tonic-gate 		debug_enter((char *)NULL);
1797c478bd9Sstevel@tonic-gate 	}
1807c478bd9Sstevel@tonic-gate 	splx(s);
1817c478bd9Sstevel@tonic-gate }
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate static void
ptl1_showtrap(ptl1_state_t * pstate)1847c478bd9Sstevel@tonic-gate ptl1_showtrap(ptl1_state_t *pstate)
1857c478bd9Sstevel@tonic-gate {
1867c478bd9Sstevel@tonic-gate 	ptl1_regs_t *rp = &pstate->ptl1_regs;
1877c478bd9Sstevel@tonic-gate 	short i, j, maxtl = rp->ptl1_trap_regs[0].ptl1_tl;
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate 	printf("%%tl %%tpc              %%tnpc             %%tstate"
1907c478bd9Sstevel@tonic-gate 	    "           %%tt\n");
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate 	for (i = maxtl - 1; i >= 0; i--) {
1937c478bd9Sstevel@tonic-gate 		ptl1_trapregs_t *ptp = &rp->ptl1_trap_regs[i];
1947c478bd9Sstevel@tonic-gate 		uint64_t tstate = ptp->ptl1_tstate;
1957c478bd9Sstevel@tonic-gate 		uint32_t ccr, asi, cwp, pstate;
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate 		cwp = (tstate >> TSTATE_CWP_SHIFT) & TSTATE_CWP_MASK;
1987c478bd9Sstevel@tonic-gate 		pstate = (tstate >> TSTATE_PSTATE_SHIFT) & TSTATE_PSTATE_MASK;
1997c478bd9Sstevel@tonic-gate 		asi = (tstate >> TSTATE_ASI_SHIFT) & TSTATE_ASI_MASK;
2007c478bd9Sstevel@tonic-gate 		ccr = (tstate >> TSTATE_CCR_SHIFT) & TSTATE_CCR_MASK;
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate 		printf(" %d  %016" PRIx64 "  %016" PRIx64 "  %010" PRIx64
2037c478bd9Sstevel@tonic-gate 		    "        %03x\n", ptp->ptl1_tl, ptp->ptl1_tpc,
2047c478bd9Sstevel@tonic-gate 		    ptp->ptl1_tnpc, tstate, ptp->ptl1_tt);
2057c478bd9Sstevel@tonic-gate 		printf("    %%ccr: %02x  %%asi: %02x  %%cwp: %x  "
2067c478bd9Sstevel@tonic-gate 		    "%%pstate: %b\n", ccr, asi, cwp, pstate, PSTATE_BITS);
2077c478bd9Sstevel@tonic-gate 	}
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate 	printf("%%g0-3: %016x %016" PRIx64 " %016" PRIx64 " %016"
2107c478bd9Sstevel@tonic-gate 	    PRIx64 "\n", 0, rp->ptl1_g1, rp->ptl1_g2, rp->ptl1_g3);
2117c478bd9Sstevel@tonic-gate 	printf("%%g4-7: %016" PRIx64 " %016" PRIx64 " %016" PRIx64 " %016"
2127c478bd9Sstevel@tonic-gate 	    PRIx64 "\n", rp->ptl1_g4, rp->ptl1_g5, rp->ptl1_g6, rp->ptl1_g7);
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate 	i = rp->ptl1_cwp;
2157c478bd9Sstevel@tonic-gate 	j = rp->ptl1_canrestore;
2167c478bd9Sstevel@tonic-gate 	for (; j >= 0; i--, j--) {
2177c478bd9Sstevel@tonic-gate 		struct rwindow *wp;
2187c478bd9Sstevel@tonic-gate 		ulong_t off;
2197c478bd9Sstevel@tonic-gate 		char *sym;
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate 		if (i < 0)
2227c478bd9Sstevel@tonic-gate 			i += MAXWIN;
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate 		wp = &rp->ptl1_rwindow[i];
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate 		if ((sym = kobj_getsymname(wp->rw_in[7], &off)) != NULL) {
2277c478bd9Sstevel@tonic-gate 			printf("Register window %d, caller %s+%lx\n",
2287c478bd9Sstevel@tonic-gate 			    i, sym, off);
2297c478bd9Sstevel@tonic-gate 		} else {
2307c478bd9Sstevel@tonic-gate 			printf("Register window %d, caller %lx\n",
2317c478bd9Sstevel@tonic-gate 			    i, wp->rw_in[7]);
2327c478bd9Sstevel@tonic-gate 		}
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate 		if (i == rp->ptl1_cwp) {
2357c478bd9Sstevel@tonic-gate 			struct rwindow *nwp;
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate 			if (i == MAXWIN - 1)
2387c478bd9Sstevel@tonic-gate 				nwp = &rp->ptl1_rwindow[0];
2397c478bd9Sstevel@tonic-gate 			else
2407c478bd9Sstevel@tonic-gate 				nwp = &rp->ptl1_rwindow[i+1];
2417c478bd9Sstevel@tonic-gate 			printf("%%o0-3: %016lx %016lx %016lx %016lx\n"
2427c478bd9Sstevel@tonic-gate 			    "%%o4-7: %016lx %016lx %016lx %016lx\n",
2437c478bd9Sstevel@tonic-gate 			    nwp->rw_in[0], nwp->rw_in[1], nwp->rw_in[2],
2447c478bd9Sstevel@tonic-gate 			    nwp->rw_in[3], nwp->rw_in[4], nwp->rw_in[5],
2457c478bd9Sstevel@tonic-gate 			    nwp->rw_in[6], nwp->rw_in[7]);
2467c478bd9Sstevel@tonic-gate 		}
2477c478bd9Sstevel@tonic-gate 		printf("%%l0-3: %016lx %016lx %016lx %016lx\n"
2487c478bd9Sstevel@tonic-gate 		    "%%l4-7: %016lx %016lx %016lx %016lx\n",
2497c478bd9Sstevel@tonic-gate 		    wp->rw_local[0], wp->rw_local[1], wp->rw_local[2],
2507c478bd9Sstevel@tonic-gate 		    wp->rw_local[3], wp->rw_local[4], wp->rw_local[5],
2517c478bd9Sstevel@tonic-gate 		    wp->rw_local[6], wp->rw_local[7]);
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate 		printf("%%i0-3: %016lx %016lx %016lx %016lx\n"
2547c478bd9Sstevel@tonic-gate 		    "%%i4-7: %016lx %016lx %016lx %016lx\n",
2557c478bd9Sstevel@tonic-gate 		    wp->rw_in[0], wp->rw_in[1], wp->rw_in[2], wp->rw_in[3],
2567c478bd9Sstevel@tonic-gate 		    wp->rw_in[4], wp->rw_in[5], wp->rw_in[6], wp->rw_in[7]);
2577c478bd9Sstevel@tonic-gate 	}
2587c478bd9Sstevel@tonic-gate }
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate void
panic_showtrap(struct panic_trap_info * tip)261843e1988Sjohnlev panic_showtrap(struct panic_trap_info *tip)
2627c478bd9Sstevel@tonic-gate {
2637c478bd9Sstevel@tonic-gate 	ptl1_state_t *pstate = &CPU->cpu_m.ptl1_state;
2647c478bd9Sstevel@tonic-gate 	/*
2657c478bd9Sstevel@tonic-gate 	 * If ptl1_panic() was called, print out the information
2667c478bd9Sstevel@tonic-gate 	 * saved in the ptl1_state struture.
2677c478bd9Sstevel@tonic-gate 	 */
2687c478bd9Sstevel@tonic-gate 	if (pstate->ptl1_entry_count) {
2697c478bd9Sstevel@tonic-gate 		ptl1_showtrap(pstate);
2707c478bd9Sstevel@tonic-gate 		return;
2717c478bd9Sstevel@tonic-gate 	}
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate 	showregs(tip->trap_type, tip->trap_regs, tip->trap_addr,
2747c478bd9Sstevel@tonic-gate 	    tip->trap_mmu_fsr);
2757c478bd9Sstevel@tonic-gate }
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate static void
ptl1_savetrap(panic_data_t * pdp,ptl1_state_t * pstate)2787c478bd9Sstevel@tonic-gate ptl1_savetrap(panic_data_t *pdp, ptl1_state_t *pstate)
2797c478bd9Sstevel@tonic-gate {
2807c478bd9Sstevel@tonic-gate 	ptl1_regs_t *rp = &pstate->ptl1_regs;
2817c478bd9Sstevel@tonic-gate 	short i, maxtl = rp->ptl1_trap_regs[0].ptl1_tl;
2827c478bd9Sstevel@tonic-gate 	panic_nv_t *pnv = PANICNVGET(pdp);
2837c478bd9Sstevel@tonic-gate 	char name[PANICNVNAMELEN];
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate 	for (i = maxtl - 1; i >= 0; i--) {
2867c478bd9Sstevel@tonic-gate 		ptl1_trapregs_t *ptp = &rp->ptl1_trap_regs[i];
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tl[%d]", i);
2897c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tl);
2907c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tt[%d]", i);
2917c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tt);
2927c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tpc[%d]", i);
2937c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tpc);
2947c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tnpc[%d]", i);
2957c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tnpc);
2967c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tstate[%d]", i);
2977c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tstate);
2987c478bd9Sstevel@tonic-gate 	}
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate 	PANICNVSET(pdp, pnv);
3017c478bd9Sstevel@tonic-gate }
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate void
panic_savetrap(panic_data_t * pdp,struct panic_trap_info * tip)304843e1988Sjohnlev panic_savetrap(panic_data_t *pdp, struct panic_trap_info *tip)
3057c478bd9Sstevel@tonic-gate {
3067c478bd9Sstevel@tonic-gate 	panic_nv_t *pnv;
3077c478bd9Sstevel@tonic-gate 	ptl1_state_t *pstate = &CPU->cpu_m.ptl1_state;
3087c478bd9Sstevel@tonic-gate 	/*
3097c478bd9Sstevel@tonic-gate 	 * If ptl1_panic() was called, save the trap registers
3107c478bd9Sstevel@tonic-gate 	 * stored in the ptl1_state struture.
3117c478bd9Sstevel@tonic-gate 	 */
3127c478bd9Sstevel@tonic-gate 	if (pstate->ptl1_entry_count) {
3137c478bd9Sstevel@tonic-gate 		ptl1_savetrap(pdp, pstate);
3147c478bd9Sstevel@tonic-gate 		return;
3157c478bd9Sstevel@tonic-gate 	}
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate 	panic_saveregs(pdp, tip->trap_regs);
3187c478bd9Sstevel@tonic-gate 	pnv = PANICNVGET(pdp);
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate 	PANICNVADD(pnv, "sfsr", tip->trap_mmu_fsr);
3217c478bd9Sstevel@tonic-gate 	PANICNVADD(pnv, "sfar", tip->trap_addr);
3227c478bd9Sstevel@tonic-gate 	PANICNVADD(pnv, "tt", tip->trap_type);
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate 	PANICNVSET(pdp, pnv);
3257c478bd9Sstevel@tonic-gate }
326