xref: /titanic_50/usr/src/uts/sun4u/ml/mach_interrupt.s (revision 023e71de9e5670cebc23dd51162833661d3d2d3b)
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
517e9c21cShyw * Common Development and Distribution License (the "License").
617e9c21cShyw * 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*023e71deSHaik Aftandilian * 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#if defined(lint)
277c478bd9Sstevel@tonic-gate#include <sys/types.h>
287c478bd9Sstevel@tonic-gate#include <sys/thread.h>
297c478bd9Sstevel@tonic-gate#else	/* lint */
307c478bd9Sstevel@tonic-gate#include "assym.h"
317c478bd9Sstevel@tonic-gate#endif	/* lint */
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h>
347c478bd9Sstevel@tonic-gate#include <sys/machthread.h>
357c478bd9Sstevel@tonic-gate#include <sys/machcpuvar.h>
367c478bd9Sstevel@tonic-gate#include <sys/mmu.h>
377c478bd9Sstevel@tonic-gate#include <sys/intreg.h>
387c478bd9Sstevel@tonic-gate#include <sys/dmv.h>
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate#ifdef TRAPTRACE
417c478bd9Sstevel@tonic-gate#include <sys/traptrace.h>
427c478bd9Sstevel@tonic-gate#endif /* TRAPTRACE */
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate#if defined(lint)
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gatevoid
487c478bd9Sstevel@tonic-gatevec_interrupt(void)
497c478bd9Sstevel@tonic-gate{}
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate#else	/* lint */
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gatevec_uiii_irdr_tab:
547c478bd9Sstevel@tonic-gate        .byte   UIII_IRDR_0, UIII_IRDR_1, UIII_IRDR_2, UIII_IRDR_3
557c478bd9Sstevel@tonic-gate        .byte   UIII_IRDR_4, UIII_IRDR_5, UIII_IRDR_6, UIII_IRDR_7
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate/*
587c478bd9Sstevel@tonic-gate * (TT 0x60, TL>0) Interrupt Vector Handler
597c478bd9Sstevel@tonic-gate *	Globals are the Interrupt Globals.
607c478bd9Sstevel@tonic-gate */
617c478bd9Sstevel@tonic-gate	ENTRY_NP(vec_interrupt)
627c478bd9Sstevel@tonic-gate	!
637c478bd9Sstevel@tonic-gate	! Load the interrupt receive data register 0.
647c478bd9Sstevel@tonic-gate	! It could be a fast trap handler address (pc > KERNELBASE) at TL>0
657c478bd9Sstevel@tonic-gate	! or an interrupt number.
667c478bd9Sstevel@tonic-gate	!
677c478bd9Sstevel@tonic-gate	mov	IRDR_0, %g2
687c478bd9Sstevel@tonic-gate	ldxa	[%g2]ASI_INTR_RECEIVE, %g5	! %g5 = PC or Interrupt Number
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate	! If the high bit of IRDR_0 is set, then this is a
717c478bd9Sstevel@tonic-gate	! data bearing mondo vector.
727c478bd9Sstevel@tonic-gate	brlz,pt %g5, dmv_vector
737c478bd9Sstevel@tonic-gate	.empty
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gatevec_interrupt_resume:
777c478bd9Sstevel@tonic-gate	set	KERNELBASE, %g4
787c478bd9Sstevel@tonic-gate	cmp	%g5, %g4
797c478bd9Sstevel@tonic-gate	bl,a,pt	%xcc, 0f			! an interrupt number found
807c478bd9Sstevel@tonic-gate	  nop
817c478bd9Sstevel@tonic-gate	!
827c478bd9Sstevel@tonic-gate	! intercept OBP xcalls and set PCONTEXT=0
837c478bd9Sstevel@tonic-gate	!
847c478bd9Sstevel@tonic-gate	set	_end, %g4		! _end is highest kernel address
857c478bd9Sstevel@tonic-gate	cmp	%g5, %g4
867c478bd9Sstevel@tonic-gate	bl,a,pt	%xcc, 7f
877c478bd9Sstevel@tonic-gate	  nop
88febcc4a5Sjimand
89febcc4a5Sjimand#ifndef _OPL
907c478bd9Sstevel@tonic-gate	mov	MMU_PCONTEXT, %g1
917c478bd9Sstevel@tonic-gate	ldxa	[%g1]ASI_DMMU, %g1
927c478bd9Sstevel@tonic-gate	srlx	%g1, CTXREG_NEXT_SHIFT, %g3
937c478bd9Sstevel@tonic-gate	brz,pt	%g3, 7f			! nucleus pgsz is 0, no problem
947c478bd9Sstevel@tonic-gate	  sllx	%g3, CTXREG_NEXT_SHIFT, %g3
957c478bd9Sstevel@tonic-gate	set	CTXREG_CTX_MASK, %g4	! check Pcontext
967c478bd9Sstevel@tonic-gate	btst	%g4, %g1
977c478bd9Sstevel@tonic-gate	bz,a,pt	%xcc, 6f
987c478bd9Sstevel@tonic-gate	  clr	%g3			! kernel:  PCONTEXT=0
997c478bd9Sstevel@tonic-gate	xor	%g3, %g1, %g3		! user:	clr N_pgsz0/1 bits
1007c478bd9Sstevel@tonic-gate6:
1017c478bd9Sstevel@tonic-gate	set	DEMAP_ALL_TYPE, %g1
1027c478bd9Sstevel@tonic-gate	stxa	%g0, [%g1]ASI_DTLB_DEMAP
1037c478bd9Sstevel@tonic-gate	stxa	%g0, [%g1]ASI_ITLB_DEMAP
1047c478bd9Sstevel@tonic-gate	mov	MMU_PCONTEXT, %g1
1057c478bd9Sstevel@tonic-gate	stxa	%g3, [%g1]ASI_DMMU
1067c478bd9Sstevel@tonic-gate        membar  #Sync
1077c478bd9Sstevel@tonic-gate	sethi	%hi(FLUSH_ADDR), %g1
1087c478bd9Sstevel@tonic-gate	flush	%g1			! flush required by immu
109febcc4a5Sjimand#endif /* _OPL */
110febcc4a5Sjimand
1117c478bd9Sstevel@tonic-gate7:
1127c478bd9Sstevel@tonic-gate	!
1137c478bd9Sstevel@tonic-gate	!  Cross-trap request case
1147c478bd9Sstevel@tonic-gate	!
1157c478bd9Sstevel@tonic-gate	! Load interrupt receive data registers 1 and 2 to fetch
1167c478bd9Sstevel@tonic-gate	! the arguments for the fast trap handler.
1177c478bd9Sstevel@tonic-gate	!
1187c478bd9Sstevel@tonic-gate	! Register usage:
1197c478bd9Sstevel@tonic-gate	!	g5: TL>0 handler
1207c478bd9Sstevel@tonic-gate	!	g1: arg1
1217c478bd9Sstevel@tonic-gate	!	g2: arg2
1227c478bd9Sstevel@tonic-gate	!	g3: arg3
1237c478bd9Sstevel@tonic-gate	!	g4: arg4
1247c478bd9Sstevel@tonic-gate	!
1257c478bd9Sstevel@tonic-gate	mov	IRDR_1, %g2
1267c478bd9Sstevel@tonic-gate	ldxa	[%g2]ASI_INTR_RECEIVE, %g1
1277c478bd9Sstevel@tonic-gate	mov	IRDR_2, %g2
1287c478bd9Sstevel@tonic-gate	ldxa	[%g2]ASI_INTR_RECEIVE, %g2
1297c478bd9Sstevel@tonic-gate#ifdef TRAPTRACE
1307c478bd9Sstevel@tonic-gate	TRACE_PTR(%g4, %g6)
131*023e71deSHaik Aftandilian	GET_TRACE_TICK(%g6, %g3)
1327c478bd9Sstevel@tonic-gate	stxa	%g6, [%g4 + TRAP_ENT_TICK]%asi
1337c478bd9Sstevel@tonic-gate	rdpr	%tl, %g6
1347c478bd9Sstevel@tonic-gate	stha	%g6, [%g4 + TRAP_ENT_TL]%asi
1357c478bd9Sstevel@tonic-gate	rdpr	%tt, %g6
1367c478bd9Sstevel@tonic-gate	stha	%g6, [%g4 + TRAP_ENT_TT]%asi
1377c478bd9Sstevel@tonic-gate	rdpr	%tpc, %g6
1387c478bd9Sstevel@tonic-gate	stna	%g6, [%g4 + TRAP_ENT_TPC]%asi
1397c478bd9Sstevel@tonic-gate	rdpr	%tstate, %g6
1407c478bd9Sstevel@tonic-gate	stxa	%g6, [%g4 + TRAP_ENT_TSTATE]%asi
1417c478bd9Sstevel@tonic-gate	stna	%sp, [%g4 + TRAP_ENT_SP]%asi
1427c478bd9Sstevel@tonic-gate	stna	%g5, [%g4 + TRAP_ENT_TR]%asi	! pc of the TL>0 handler
1437c478bd9Sstevel@tonic-gate	stxa	%g1, [%g4 + TRAP_ENT_F1]%asi
1447c478bd9Sstevel@tonic-gate	stxa	%g2, [%g4 + TRAP_ENT_F3]%asi
1457c478bd9Sstevel@tonic-gate	stxa	%g0, [%g4 + TRAP_ENT_F2]%asi
1467c478bd9Sstevel@tonic-gate	stxa	%g0, [%g4 + TRAP_ENT_F4]%asi
1477c478bd9Sstevel@tonic-gate	TRACE_NEXT(%g4, %g6, %g3)
1487c478bd9Sstevel@tonic-gate#endif /* TRAPTRACE */
1497c478bd9Sstevel@tonic-gate	stxa	%g0, [%g0]ASI_INTR_RECEIVE_STATUS	! clear the BUSY bit
1507c478bd9Sstevel@tonic-gate	membar	#Sync
1517c478bd9Sstevel@tonic-gate#ifdef SF_ERRATA_51
1527c478bd9Sstevel@tonic-gate	ba,pt	%icc, 1f
1537c478bd9Sstevel@tonic-gate	nop
1547c478bd9Sstevel@tonic-gate	.align 32
1557c478bd9Sstevel@tonic-gate1:	jmp	%g5				! call the fast trap handler
1567c478bd9Sstevel@tonic-gate	nop
1577c478bd9Sstevel@tonic-gate#else
1587c478bd9Sstevel@tonic-gate	jmp	%g5
1597c478bd9Sstevel@tonic-gate	nop
1607c478bd9Sstevel@tonic-gate#endif /* SF_ERRATA_51 */
1617c478bd9Sstevel@tonic-gate	/* Never Reached */
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate0:
1647c478bd9Sstevel@tonic-gate	! We have an interrupt number.
1657c478bd9Sstevel@tonic-gate        !
1667c478bd9Sstevel@tonic-gate	! Register usage:
1677c478bd9Sstevel@tonic-gate	!	%g5 - inum
1687c478bd9Sstevel@tonic-gate	!	%g1 - temp
1697c478bd9Sstevel@tonic-gate	!
1707c478bd9Sstevel@tonic-gate        ! We don't bother to verify that the received inum is valid (it should
171b0fc0e77Sgovinda        ! be < MAXIVNUM) since setvecint_tl1 will do that for us.
1727c478bd9Sstevel@tonic-gate        !
1737c478bd9Sstevel@tonic-gate	! clear BUSY bit
1747c478bd9Sstevel@tonic-gate	!
1757c478bd9Sstevel@tonic-gate	stxa	%g0, [%g0]ASI_INTR_RECEIVE_STATUS
1767c478bd9Sstevel@tonic-gate	membar	#Sync
1777c478bd9Sstevel@tonic-gate
178b0fc0e77Sgovinda	! setvecint_tl1 will do all the work, and finish with a retry
1797c478bd9Sstevel@tonic-gate	!
180b0fc0e77Sgovinda	ba,pt	%xcc, setvecint_tl1
181b0fc0e77Sgovinda	mov	%g5, %g1		! setvecint_tl1 expects inum in %g1
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gate	/* Never Reached */
1847c478bd9Sstevel@tonic-gate	SET_SIZE(vec_interrupt)
1857c478bd9Sstevel@tonic-gate
1867c478bd9Sstevel@tonic-gate
1877c478bd9Sstevel@tonic-gate!
1887c478bd9Sstevel@tonic-gate!   See usr/src/uts/sun4u/sys/dmv.h for the Databearing Mondo Vector
1897c478bd9Sstevel@tonic-gate!	 interrupt format
1907c478bd9Sstevel@tonic-gate!
1917c478bd9Sstevel@tonic-gate! Inputs:
1927c478bd9Sstevel@tonic-gate!	g1: value of ASI_INTR_RECEIVE_STATUS
1937c478bd9Sstevel@tonic-gate!	g5: word 0 of the interrupt data
1947c478bd9Sstevel@tonic-gate! Register use:
1957c478bd9Sstevel@tonic-gate!	g2: dmv inum
1967c478bd9Sstevel@tonic-gate!	g3: scratch
1977c478bd9Sstevel@tonic-gate!	g4: pointer to dmv_dispatch_table
1987c478bd9Sstevel@tonic-gate!	g6: handler pointer from dispatch table
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gate
2017c478bd9Sstevel@tonic-gate	DGDEF(dmv_spurious_cnt)
2027c478bd9Sstevel@tonic-gate	.word	0
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gate	ENTRY_NP(dmv_vector)
2057c478bd9Sstevel@tonic-gate	srlx	%g5, DMV_INUM_SHIFT, %g2
2067c478bd9Sstevel@tonic-gate	set	DMV_INUM_MASK, %g3
2077c478bd9Sstevel@tonic-gate	and	%g2, %g3, %g2		   ! %g2 = inum
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate	set	dmv_totalints, %g3
2107c478bd9Sstevel@tonic-gate	ld	[%g3], %g3
2117c478bd9Sstevel@tonic-gate	cmp	%g2, %g3
2127c478bd9Sstevel@tonic-gate	bge,pn	%xcc, 2f		   ! inum >= dmv_totalints
2137c478bd9Sstevel@tonic-gate	nop
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gate	set	dmv_dispatch_table, %g3
2167c478bd9Sstevel@tonic-gate	ldn	[%g3], %g4
2177c478bd9Sstevel@tonic-gate	brz,pn	%g4, 2f
2187c478bd9Sstevel@tonic-gate	sll	%g2, DMV_DISP_SHIFT, %g3   ! %g3 = inum*sizeof(struct dmv_disp)
2197c478bd9Sstevel@tonic-gate
2207c478bd9Sstevel@tonic-gate	add	%g4, %g3, %g4		! %g4 = &dmv_dispatch_table[inum]
2217c478bd9Sstevel@tonic-gate#if (DMV_FUNC != 0) || (DMV_ARG != 8)
2227c478bd9Sstevel@tonic-gate#error "DMV_FUNC or DMV_SIZE has changed"
2237c478bd9Sstevel@tonic-gate#endif
2247c478bd9Sstevel@tonic-gate	ldda	[%g4]ASI_NQUAD_LD, %g2  ! %g2=handler %g3=argument
2257c478bd9Sstevel@tonic-gate	mov	%g3, %g1
2267c478bd9Sstevel@tonic-gate	brz,pn  %g2, 2f
2277c478bd9Sstevel@tonic-gate	nop
2287c478bd9Sstevel@tonic-gate
2297c478bd9Sstevel@tonic-gate	! we have a handler, so call it
2307c478bd9Sstevel@tonic-gate	! On entry to the handler, the %g registers are set as follows:
2317c478bd9Sstevel@tonic-gate	!
2327c478bd9Sstevel@tonic-gate	!	%g1	The argument (arg) passed to dmv_add_intr().
2337c478bd9Sstevel@tonic-gate	!	%g2	Word 0 of the incoming mondo vector.
2347c478bd9Sstevel@tonic-gate	!
2357c478bd9Sstevel@tonic-gate	jmp	%g2
2367c478bd9Sstevel@tonic-gate	mov	%g5, %g2
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate	! No handler was listed in the table, so just record it
2397c478bd9Sstevel@tonic-gate	! as an error condition and continue.  There is a race
2407c478bd9Sstevel@tonic-gate	! window here updating the counter, but that's ok since
2417c478bd9Sstevel@tonic-gate	! just knowing that spurious interrupts happened is enough,
2427c478bd9Sstevel@tonic-gate	! we probably won't need to know exactly how many.
2437c478bd9Sstevel@tonic-gate2:
2447c478bd9Sstevel@tonic-gate	set	dmv_spurious_cnt, %g1
2457c478bd9Sstevel@tonic-gate	ld	[%g1], %g2
2467c478bd9Sstevel@tonic-gate	inc	%g2
2477c478bd9Sstevel@tonic-gate	ba,pt	%xcc,3f
2487c478bd9Sstevel@tonic-gate	st	%g2, [%g1]
2497c478bd9Sstevel@tonic-gate
2507c478bd9Sstevel@tonic-gate	!	When the handler's processing (which should be as quick as
2517c478bd9Sstevel@tonic-gate	!	possible) is complete, the handler must exit by jumping to
2527c478bd9Sstevel@tonic-gate	!	the label dmv_finish_intr.  The contents of %g1 at this time
2537c478bd9Sstevel@tonic-gate	!	determine whether a software interrupt will be issued, as
2547c478bd9Sstevel@tonic-gate	!	follows:
2557c478bd9Sstevel@tonic-gate	!
2567c478bd9Sstevel@tonic-gate	!		If %g1 is less than zero, no interrupt will be queued.
2577c478bd9Sstevel@tonic-gate	!		Otherwise, %g1 will be used as the interrupt number
2587c478bd9Sstevel@tonic-gate	!		to simulate; this means that the behavior of the
2597c478bd9Sstevel@tonic-gate	!		interrupt system will be exactly that which would have
2607c478bd9Sstevel@tonic-gate	!		occurred if the first word of the incoming interrupt
2617c478bd9Sstevel@tonic-gate	!		vector had contained the contents of %g1.
2627c478bd9Sstevel@tonic-gate
2637c478bd9Sstevel@tonic-gate	ENTRY_NP(dmv_finish_intr)
2647c478bd9Sstevel@tonic-gate	brlz,pn %g1,3f
2657c478bd9Sstevel@tonic-gate	nop
2667c478bd9Sstevel@tonic-gate	!	generate an interrupt based on the contents of %g1
2677c478bd9Sstevel@tonic-gate	ba,pt	%xcc,vec_interrupt_resume
2687c478bd9Sstevel@tonic-gate	mov	%g1, %g5
2697c478bd9Sstevel@tonic-gate	!	We are done
2707c478bd9Sstevel@tonic-gate3:
2717c478bd9Sstevel@tonic-gate	stxa	%g0, [%g0]ASI_INTR_RECEIVE_STATUS ! clear the busy bit
2727c478bd9Sstevel@tonic-gate	retry
2737c478bd9Sstevel@tonic-gate	SET_SIZE(dmv_vector)
2747c478bd9Sstevel@tonic-gate
2757c478bd9Sstevel@tonic-gate#endif	/* lint */
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate#if defined(lint)
2787c478bd9Sstevel@tonic-gate
2797c478bd9Sstevel@tonic-gatevoid
2807c478bd9Sstevel@tonic-gatevec_intr_spurious(void)
2817c478bd9Sstevel@tonic-gate{}
2827c478bd9Sstevel@tonic-gate
2837c478bd9Sstevel@tonic-gate#else	/* lint */
2847c478bd9Sstevel@tonic-gate
2857c478bd9Sstevel@tonic-gate	DGDEF(vec_spurious_cnt)
2867c478bd9Sstevel@tonic-gate	.word	0
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate	ENTRY_NP(vec_intr_spurious)
2897c478bd9Sstevel@tonic-gate	sethi	%hi(vec_spurious_cnt), %g2
2907c478bd9Sstevel@tonic-gate	ld	[%g2 + %lo(vec_spurious_cnt)], %g2
2917c478bd9Sstevel@tonic-gate#ifdef TRAPTRACE
2927c478bd9Sstevel@tonic-gate	TRACE_PTR(%g4, %g6)
293*023e71deSHaik Aftandilian	GET_TRACE_TICK(%g6, %g3)
2947c478bd9Sstevel@tonic-gate	stxa	%g6, [%g4 + TRAP_ENT_TICK]%asi
2957c478bd9Sstevel@tonic-gate	rdpr	%tl, %g6
2967c478bd9Sstevel@tonic-gate	stha	%g6, [%g4 + TRAP_ENT_TL]%asi
2977c478bd9Sstevel@tonic-gate	rdpr	%tt, %g6
2987c478bd9Sstevel@tonic-gate	or	%g6, TT_SPURIOUS_INT, %g6
2997c478bd9Sstevel@tonic-gate	stha	%g6, [%g4 + TRAP_ENT_TT]%asi
3007c478bd9Sstevel@tonic-gate	rdpr	%tpc, %g6
3017c478bd9Sstevel@tonic-gate	stna	%g6, [%g4 + TRAP_ENT_TPC]%asi
3027c478bd9Sstevel@tonic-gate	rdpr	%tstate, %g6
3037c478bd9Sstevel@tonic-gate	stxa	%g6, [%g4 + TRAP_ENT_TSTATE]%asi
3047c478bd9Sstevel@tonic-gate	stna	%sp, [%g4 + TRAP_ENT_SP]%asi
3057c478bd9Sstevel@tonic-gate	stna	%g1, [%g4 + TRAP_ENT_TR]%asi	! irsr
3067c478bd9Sstevel@tonic-gate	stna	%g2, [%g4 + TRAP_ENT_F1]%asi
3077c478bd9Sstevel@tonic-gate	ldxa	[%g0]ASI_INTR_RECEIVE_STATUS, %g5
3087c478bd9Sstevel@tonic-gate	stxa	%g5, [%g4 + TRAP_ENT_F2]%asi
3097c478bd9Sstevel@tonic-gate	stxa	%g0, [%g4 + TRAP_ENT_F4]%asi
3107c478bd9Sstevel@tonic-gate	TRACE_NEXT(%g4, %g6, %g3)
3117c478bd9Sstevel@tonic-gate#endif /* TRAPTRACE */
3127c478bd9Sstevel@tonic-gate	cmp	%g2, 16
3137c478bd9Sstevel@tonic-gate	bl,a,pt	%xcc, 1f
3147c478bd9Sstevel@tonic-gate	inc	%g2
3157c478bd9Sstevel@tonic-gate	!
3167c478bd9Sstevel@tonic-gate	! prepare for sys_trap()
3177c478bd9Sstevel@tonic-gate	!	%g1 - sys_tl1_panic
3187c478bd9Sstevel@tonic-gate	!	%g2 - panic message
3197c478bd9Sstevel@tonic-gate	!	%g4 - current pil
3207c478bd9Sstevel@tonic-gate	!
32117e9c21cShyw#ifdef CLEAR_INTR_BUSYBIT_ON_SPURIOUS
32217e9c21cShyw	/*
32317e9c21cShyw	 * Certain processors (OPL) need to explicitly
32417e9c21cShyw	 * clear the intr busy bit even though it is
32517e9c21cShyw	 * not visibly set (spurious intrs)
32617e9c21cShyw	 */
32717e9c21cShyw	stxa	%g0, [%g0]ASI_INTR_RECEIVE_STATUS	! clear the BUSY bit
32817e9c21cShyw	membar  #Sync
32917e9c21cShyw#endif /* CLEAR_INTR_BUSYBIT_ON_SPURIOUS */
3307c478bd9Sstevel@tonic-gate	sub	%g0, 1, %g4
3317c478bd9Sstevel@tonic-gate	set	_not_ready, %g2
3327c478bd9Sstevel@tonic-gate	sethi	%hi(sys_tl1_panic), %g1
3337c478bd9Sstevel@tonic-gate	ba,pt	%xcc, sys_trap
3347c478bd9Sstevel@tonic-gate	or	%g1, %lo(sys_tl1_panic), %g1
3357c478bd9Sstevel@tonic-gate	!
3367c478bd9Sstevel@tonic-gate1:	sethi	%hi(vec_spurious_cnt), %g1
3377c478bd9Sstevel@tonic-gate	st	%g2, [%g1 + %lo(vec_spurious_cnt)]
3387c478bd9Sstevel@tonic-gate	retry
3397c478bd9Sstevel@tonic-gate	SET_SIZE(vec_intr_spurious)
3407c478bd9Sstevel@tonic-gate
3417c478bd9Sstevel@tonic-gate_not_ready:	.asciz	"Interrupt Vector Receive Register not READY"
3427c478bd9Sstevel@tonic-gate
3437c478bd9Sstevel@tonic-gate#endif	/* lint */
344