xref: /titanic_44/usr/src/uts/sun4v/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 	default:
717c478bd9Sstevel@tonic-gate 		printf(" Unknown error");
727c478bd9Sstevel@tonic-gate 		break;
737c478bd9Sstevel@tonic-gate 	}
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate 	printf(" context 0x%x", X_FAULT_CTX(sfsr));
767c478bd9Sstevel@tonic-gate 	printf("\n");
777c478bd9Sstevel@tonic-gate }
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Print out debugging info.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate /*ARGSUSED*/
837c478bd9Sstevel@tonic-gate void
showregs(uint_t type,struct regs * rp,caddr_t addr,uint_t mmu_fsr)847c478bd9Sstevel@tonic-gate showregs(uint_t type, struct regs *rp, caddr_t addr, uint_t mmu_fsr)
857c478bd9Sstevel@tonic-gate {
867c478bd9Sstevel@tonic-gate 	int s;
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate 	s = spl7();
897c478bd9Sstevel@tonic-gate 	type &= ~T_USER;
90ae115bc7Smrj 	printf("%s: ", PTOU(curproc)->u_comm);
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate 	switch (type) {
937c478bd9Sstevel@tonic-gate 	case T_SYS_RTT_ALIGN:
947c478bd9Sstevel@tonic-gate 	case T_ALIGNMENT:
957c478bd9Sstevel@tonic-gate 		printf("alignment error:\n");
967c478bd9Sstevel@tonic-gate 		break;
977c478bd9Sstevel@tonic-gate 	case T_INSTR_EXCEPTION:
987c478bd9Sstevel@tonic-gate 		printf("text access exception:\n");
997c478bd9Sstevel@tonic-gate 		break;
1007c478bd9Sstevel@tonic-gate 	case T_DATA_EXCEPTION:
1017c478bd9Sstevel@tonic-gate 		printf("data access exception:\n");
1027c478bd9Sstevel@tonic-gate 		break;
1037c478bd9Sstevel@tonic-gate 	case T_PRIV_INSTR:
1047c478bd9Sstevel@tonic-gate 		printf("privileged instruction fault:\n");
1057c478bd9Sstevel@tonic-gate 		break;
1067c478bd9Sstevel@tonic-gate 	case T_UNIMP_INSTR:
1077c478bd9Sstevel@tonic-gate 		printf("illegal instruction fault:\n");
1087c478bd9Sstevel@tonic-gate 		break;
1097c478bd9Sstevel@tonic-gate 	case T_IDIV0:
1107c478bd9Sstevel@tonic-gate 		printf("integer divide zero trap:\n");
1117c478bd9Sstevel@tonic-gate 		break;
1127c478bd9Sstevel@tonic-gate 	case T_DIV0:
1137c478bd9Sstevel@tonic-gate 		printf("zero divide trap:\n");
1147c478bd9Sstevel@tonic-gate 		break;
1157c478bd9Sstevel@tonic-gate 	case T_INT_OVERFLOW:
1167c478bd9Sstevel@tonic-gate 		printf("integer overflow:\n");
1177c478bd9Sstevel@tonic-gate 		break;
1187c478bd9Sstevel@tonic-gate 	case T_BREAKPOINT:
1197c478bd9Sstevel@tonic-gate 		printf("breakpoint trap:\n");
1207c478bd9Sstevel@tonic-gate 		break;
1217c478bd9Sstevel@tonic-gate 	case T_TAG_OVERFLOW:
1227c478bd9Sstevel@tonic-gate 		printf("tag overflow:\n");
1237c478bd9Sstevel@tonic-gate 		break;
1247c478bd9Sstevel@tonic-gate 	default:
1257c478bd9Sstevel@tonic-gate 		if (type >= T_SOFTWARE_TRAP && type <= T_ESOFTWARE_TRAP)
1267c478bd9Sstevel@tonic-gate 			printf("software trap 0x%x\n", type - T_SOFTWARE_TRAP);
1277c478bd9Sstevel@tonic-gate 		else
1287c478bd9Sstevel@tonic-gate 			printf("trap type = 0x%x\n", type);
1297c478bd9Sstevel@tonic-gate 		break;
1307c478bd9Sstevel@tonic-gate 	}
1317c478bd9Sstevel@tonic-gate 	if (type == T_DATA_EXCEPTION || type == T_INSTR_EXCEPTION) {
1327c478bd9Sstevel@tonic-gate 		mmu_print_sfsr(mmu_fsr);
1337c478bd9Sstevel@tonic-gate 	} else if (addr) {
1347c478bd9Sstevel@tonic-gate 		printf("addr=0x%p\n", (void *)addr);
1357c478bd9Sstevel@tonic-gate 	}
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate 	printf("pid=%d, pc=0x%lx, sp=0x%llx, tstate=0x%llx, context=0x%x\n",
1387c478bd9Sstevel@tonic-gate 	    (ttoproc(curthread) && ttoproc(curthread)->p_pidp) ?
1397c478bd9Sstevel@tonic-gate 	    (ttoproc(curthread)->p_pid) : 0, rp->r_pc, rp->r_sp,
1407c478bd9Sstevel@tonic-gate 	    rp->r_tstate, sfmmu_getctx_sec());
1417c478bd9Sstevel@tonic-gate 	if (USERMODE(rp->r_tstate)) {
1427c478bd9Sstevel@tonic-gate 		printf("o0-o7: %llx, %llx, %llx, %llx, %llx, %llx, "
1437c478bd9Sstevel@tonic-gate 		    "%llx, %llx\n", rp->r_o0, rp->r_o1, rp->r_o2, rp->r_o3,
1447c478bd9Sstevel@tonic-gate 		    rp->r_o4, rp->r_o5, rp->r_o6, rp->r_o7);
1457c478bd9Sstevel@tonic-gate 	}
1467c478bd9Sstevel@tonic-gate 	printf("g1-g7: %llx, %llx, %llx, %llx, %llx, %llx, %llx\n",
1477c478bd9Sstevel@tonic-gate 	    rp->r_g1, rp->r_g2, rp->r_g3,
1487c478bd9Sstevel@tonic-gate 	    rp->r_g4, rp->r_g5, rp->r_g6, rp->r_g7);
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate 	if (tudebug > 1 && (boothowto & RB_DEBUG)) {
1517c478bd9Sstevel@tonic-gate 		debug_enter((char *)NULL);
1527c478bd9Sstevel@tonic-gate 	}
1537c478bd9Sstevel@tonic-gate 	splx(s);
1547c478bd9Sstevel@tonic-gate }
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate static void
ptl1_showtrap(ptl1_state_t * pstate)1577c478bd9Sstevel@tonic-gate ptl1_showtrap(ptl1_state_t *pstate)
1587c478bd9Sstevel@tonic-gate {
1597c478bd9Sstevel@tonic-gate 	ptl1_regs_t *rp = &pstate->ptl1_regs;
1607c478bd9Sstevel@tonic-gate 	short i, j, maxtl = rp->ptl1_trap_regs[0].ptl1_tl;
16149a230e1Ssvemuri 	short curgl = rp->ptl1_gregs[0].ptl1_gl;
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate 	printf("%%tl %%tpc              %%tnpc             %%tstate"
1647c478bd9Sstevel@tonic-gate 	    "           %%tt\n");
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate 	for (i = maxtl - 1; i >= 0; i--) {
1677c478bd9Sstevel@tonic-gate 		ptl1_trapregs_t *ptp = &rp->ptl1_trap_regs[i];
1687c478bd9Sstevel@tonic-gate 		uint64_t tstate = ptp->ptl1_tstate;
16949a230e1Ssvemuri 		uint32_t gl, ccr, asi, cwp, pstate;
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate 		cwp = (tstate >> TSTATE_CWP_SHIFT) & TSTATE_CWP_MASK;
1727c478bd9Sstevel@tonic-gate 		pstate = (tstate >> TSTATE_PSTATE_SHIFT) & TSTATE_PSTATE_MASK;
1737c478bd9Sstevel@tonic-gate 		asi = (tstate >> TSTATE_ASI_SHIFT) & TSTATE_ASI_MASK;
1747c478bd9Sstevel@tonic-gate 		ccr = (tstate >> TSTATE_CCR_SHIFT) & TSTATE_CCR_MASK;
17549a230e1Ssvemuri 		gl = (tstate >> TSTATE_GL_SHIFT) & TSTATE_GL_MASK;
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate 		printf(" %d  %016" PRIx64 "  %016" PRIx64 "  %010" PRIx64
1787c478bd9Sstevel@tonic-gate 		    "        %03x\n", ptp->ptl1_tl, ptp->ptl1_tpc,
1797c478bd9Sstevel@tonic-gate 		    ptp->ptl1_tnpc, tstate, ptp->ptl1_tt);
18049a230e1Ssvemuri 		printf("    %%gl: %02x  %%ccr: %02x  %%asi: %02x  %%cwp: %x  "
18149a230e1Ssvemuri 		    "%%pstate: %b\n", gl, ccr, asi, cwp, pstate, PSTATE_BITS);
1827c478bd9Sstevel@tonic-gate 	}
1837c478bd9Sstevel@tonic-gate 
18449a230e1Ssvemuri 	/*
18549a230e1Ssvemuri 	 * ptl1_gregs[] array holds global registers for GL 0 through
18649a230e1Ssvemuri 	 * current GL. Note that the current GL global registers are
18749a230e1Ssvemuri 	 * always stored at index 0 in the ptl1_gregs[] array.
18849a230e1Ssvemuri 	 */
18949a230e1Ssvemuri 	for (i = 0; i <= curgl; i++) {
19049a230e1Ssvemuri 		ptl1_gregs_t *pgp = &rp->ptl1_gregs[i];
19149a230e1Ssvemuri 
19249a230e1Ssvemuri 		printf("    %%gl: %02" PRIx64 "\n", pgp->ptl1_gl);
1937c478bd9Sstevel@tonic-gate 		printf("%%g0-3: %016x %016" PRIx64 " %016" PRIx64 " %016"
19449a230e1Ssvemuri 		    PRIx64 "\n", 0, pgp->ptl1_g1, pgp->ptl1_g2, pgp->ptl1_g3);
19549a230e1Ssvemuri 		printf("%%g4-7: %016" PRIx64 " %016" PRIx64 " %016"
19649a230e1Ssvemuri 		    PRIx64 " %016" PRIx64 "\n", pgp->ptl1_g4, pgp->ptl1_g5,
19749a230e1Ssvemuri 		    pgp->ptl1_g6, pgp->ptl1_g7);
19849a230e1Ssvemuri 	}
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 	i = rp->ptl1_cwp;
2017c478bd9Sstevel@tonic-gate 	j = rp->ptl1_canrestore;
2027c478bd9Sstevel@tonic-gate 	for (; j >= 0; i--, j--) {
2037c478bd9Sstevel@tonic-gate 		struct rwindow *wp;
2047c478bd9Sstevel@tonic-gate 		ulong_t off;
2057c478bd9Sstevel@tonic-gate 		char *sym;
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate 		if (i < 0)
2087c478bd9Sstevel@tonic-gate 			i += MAXWIN;
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate 		wp = &rp->ptl1_rwindow[i];
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate 		if ((sym = kobj_getsymname(wp->rw_in[7], &off)) != NULL) {
2137c478bd9Sstevel@tonic-gate 			printf("Register window %d, caller %s+%lx\n",
2147c478bd9Sstevel@tonic-gate 			    i, sym, off);
2157c478bd9Sstevel@tonic-gate 		} else {
2167c478bd9Sstevel@tonic-gate 			printf("Register window %d, caller %lx\n",
2177c478bd9Sstevel@tonic-gate 			    i, wp->rw_in[7]);
2187c478bd9Sstevel@tonic-gate 		}
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate 		if (i == rp->ptl1_cwp) {
2217c478bd9Sstevel@tonic-gate 			struct rwindow *nwp;
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate 			if (i == MAXWIN - 1)
2247c478bd9Sstevel@tonic-gate 				nwp = &rp->ptl1_rwindow[0];
2257c478bd9Sstevel@tonic-gate 			else
2267c478bd9Sstevel@tonic-gate 				nwp = &rp->ptl1_rwindow[i+1];
2277c478bd9Sstevel@tonic-gate 			printf("%%o0-3: %016lx %016lx %016lx %016lx\n"
2287c478bd9Sstevel@tonic-gate 			    "%%o4-7: %016lx %016lx %016lx %016lx\n",
2297c478bd9Sstevel@tonic-gate 			    nwp->rw_in[0], nwp->rw_in[1], nwp->rw_in[2],
2307c478bd9Sstevel@tonic-gate 			    nwp->rw_in[3], nwp->rw_in[4], nwp->rw_in[5],
2317c478bd9Sstevel@tonic-gate 			    nwp->rw_in[6], nwp->rw_in[7]);
2327c478bd9Sstevel@tonic-gate 		}
2337c478bd9Sstevel@tonic-gate 		printf("%%l0-3: %016lx %016lx %016lx %016lx\n"
2347c478bd9Sstevel@tonic-gate 		    "%%l4-7: %016lx %016lx %016lx %016lx\n",
2357c478bd9Sstevel@tonic-gate 		    wp->rw_local[0], wp->rw_local[1], wp->rw_local[2],
2367c478bd9Sstevel@tonic-gate 		    wp->rw_local[3], wp->rw_local[4], wp->rw_local[5],
2377c478bd9Sstevel@tonic-gate 		    wp->rw_local[6], wp->rw_local[7]);
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate 		printf("%%i0-3: %016lx %016lx %016lx %016lx\n"
2407c478bd9Sstevel@tonic-gate 		    "%%i4-7: %016lx %016lx %016lx %016lx\n",
2417c478bd9Sstevel@tonic-gate 		    wp->rw_in[0], wp->rw_in[1], wp->rw_in[2], wp->rw_in[3],
2427c478bd9Sstevel@tonic-gate 		    wp->rw_in[4], wp->rw_in[5], wp->rw_in[6], wp->rw_in[7]);
2437c478bd9Sstevel@tonic-gate 	}
2447c478bd9Sstevel@tonic-gate }
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate void
panic_showtrap(struct panic_trap_info * tip)247843e1988Sjohnlev panic_showtrap(struct panic_trap_info *tip)
2487c478bd9Sstevel@tonic-gate {
2497c478bd9Sstevel@tonic-gate 	ptl1_state_t *pstate = &CPU->cpu_m.ptl1_state;
2507c478bd9Sstevel@tonic-gate 	/*
2517c478bd9Sstevel@tonic-gate 	 * If ptl1_panic() was called, print out the information
2527c478bd9Sstevel@tonic-gate 	 * saved in the ptl1_state struture.
2537c478bd9Sstevel@tonic-gate 	 */
2547c478bd9Sstevel@tonic-gate 	if (pstate->ptl1_entry_count) {
2557c478bd9Sstevel@tonic-gate 		ptl1_showtrap(pstate);
2567c478bd9Sstevel@tonic-gate 		return;
2577c478bd9Sstevel@tonic-gate 	}
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate 	showregs(tip->trap_type, tip->trap_regs, tip->trap_addr,
2607c478bd9Sstevel@tonic-gate 	    tip->trap_mmu_fsr);
2617c478bd9Sstevel@tonic-gate }
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate static void
ptl1_savetrap(panic_data_t * pdp,ptl1_state_t * pstate)2647c478bd9Sstevel@tonic-gate ptl1_savetrap(panic_data_t *pdp, ptl1_state_t *pstate)
2657c478bd9Sstevel@tonic-gate {
2667c478bd9Sstevel@tonic-gate 	ptl1_regs_t *rp = &pstate->ptl1_regs;
2677c478bd9Sstevel@tonic-gate 	short i, maxtl = rp->ptl1_trap_regs[0].ptl1_tl;
2687c478bd9Sstevel@tonic-gate 	panic_nv_t *pnv = PANICNVGET(pdp);
2697c478bd9Sstevel@tonic-gate 	char name[PANICNVNAMELEN];
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate 	for (i = maxtl - 1; i >= 0; i--) {
2727c478bd9Sstevel@tonic-gate 		ptl1_trapregs_t *ptp = &rp->ptl1_trap_regs[i];
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tl[%d]", i);
2757c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tl);
2767c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tt[%d]", i);
2777c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tt);
2787c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tpc[%d]", i);
2797c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tpc);
2807c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tnpc[%d]", i);
2817c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tnpc);
2827c478bd9Sstevel@tonic-gate 		(void) snprintf(name, sizeof (name), "tstate[%d]", i);
2837c478bd9Sstevel@tonic-gate 		PANICNVADD(pnv, name, ptp->ptl1_tstate);
2847c478bd9Sstevel@tonic-gate 	}
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate 	PANICNVSET(pdp, pnv);
2877c478bd9Sstevel@tonic-gate }
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate void
panic_savetrap(panic_data_t * pdp,struct panic_trap_info * tip)290843e1988Sjohnlev panic_savetrap(panic_data_t *pdp, struct panic_trap_info *tip)
2917c478bd9Sstevel@tonic-gate {
2927c478bd9Sstevel@tonic-gate 	panic_nv_t *pnv;
2937c478bd9Sstevel@tonic-gate 	ptl1_state_t *pstate = &CPU->cpu_m.ptl1_state;
2947c478bd9Sstevel@tonic-gate 	/*
2957c478bd9Sstevel@tonic-gate 	 * If ptl1_panic() was called, save the trap registers
2967c478bd9Sstevel@tonic-gate 	 * stored in the ptl1_state struture.
2977c478bd9Sstevel@tonic-gate 	 */
2987c478bd9Sstevel@tonic-gate 	if (pstate->ptl1_entry_count) {
2997c478bd9Sstevel@tonic-gate 		ptl1_savetrap(pdp, pstate);
3007c478bd9Sstevel@tonic-gate 		return;
3017c478bd9Sstevel@tonic-gate 	}
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate 	panic_saveregs(pdp, tip->trap_regs);
3047c478bd9Sstevel@tonic-gate 	pnv = PANICNVGET(pdp);
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate 	PANICNVADD(pnv, "sfsr", tip->trap_mmu_fsr);
3077c478bd9Sstevel@tonic-gate 	PANICNVADD(pnv, "sfar", tip->trap_addr);
3087c478bd9Sstevel@tonic-gate 	PANICNVADD(pnv, "tt", tip->trap_type);
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate 	PANICNVSET(pdp, pnv);
3117c478bd9Sstevel@tonic-gate }
312