* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: interrupt_INT_VEC_DIS_all.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
#define MAIN_PAGE_NUCLEUS_ALSO
#define MAIN_PAGE_HV_ALSO
#define H_HT0_Interrupt_0x60
#define My_HT0_Interrupt_0x60 \
/************************************************************************
************************************************************************/
! Switch to hypervisor mode.
wr %g0, INT_VEC_DIS, %asi
! Initialize the global registers.
mov %o1, %g6 ! %o1, %g6 = thread ID
setx user_data_start, %g1, %g3
add %l7, %g3, %g7 ! %g7 = pointer to thread's data area
be main_t0 ! branch if tread 0
ba main_t1_to_t63 ! branch if not thread 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Sync up all the treads.
SYNC_THREAD_MAIN( test_failed, %g1, %g2, %g3 )
! For each of the 64 threads generate an interrupt to that thread
mov %g0, %l7 ! destination thread number
sllx %l7, 8, %l6 ! send interrupt with vector number
or %l6, %l7, %l6 ! set to destination thread number
add %l7, 1, %l7 ! increment destination thread number
! Wait until interrupt occurs in this thread, 0.
set 4000, %l4 ! l4 = timeout counter
mov %g7, %l2 ! l2 = interrupt count
be test_failed ! branch if no interrupt occured
add %l4, -1, %l4 ! decrement wait count
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Core portable version for thread 0
! Needs run arg -midas_args=-DSYNC_THREADS
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Generate an interrupt to each thread in this core
ldxa [%g0]ASI_INTR_ID, %l7 ! get full thread ID
sllx %l7, 8, %l6 ! send interrupt with vector number
or %l6, %l7, %l6 ! set to destination thread number
add %l7, 1, %l7 ! increment destination thread number
! Wait until interrupt occurs in this thread, 0.
set 4000, %l4 ! l4 = timeout counter
mov %g7, %l2 ! l2 = interrupt count
be test_failed ! branch if no interrupt occured
add %l4, -1, %l4 ! decrement wait count
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! All Threads Except 0 Start Here
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Sync up all the treads.
SYNC_THREAD_OTHER( %g6,%g1,%g2 )
! Wait for interrupt to arrive to this thread.
setx 8000, %i6, %i5 ! i5 = timeout counter
mov %g7, %i2 ! i2 = interrupt count address
be test_failed ! branch if no interrupt occured
/**********************************************************************
Interrupt trap handler. Same interrupt handler for all threads.
**********************************************************************/
! Get the thread ID & find data area
ta T_RD_THID ! %o1 = thread id
ldxa [%g0]ASI_INTR_ID, %o2 ! get full thread ID
setx user_data_start, %l2, %l3
! Increment the interrupt count
! Check the core interrupt receive and incoming vector registers.
ldxa [%g0]ASI_SWVR_INTR_RECEIVE, %g4
cmp %g4, %g1 ! vector bit # should = thread ID
ldxa [%g0]ASI_SWVR_INTR_R, %g3
cmp %g3, %o1 ! vector # should = thread ID
cmp %g3, %o2 ! vector # should = thread ID
ldxa [%g0]ASI_SWVR_INTR_RECEIVE, %g4
cmp %g4, 0 ! now should be 0
ldxa [%g0]ASI_SWVR_INTR_R, %g3
cmp %g3, 0x0 ! should also now be 0
/************************************************************************
************************************************************************/
.word 0x0 ! Thread 0 interrupt count
.word 0x0 ! Thread 1 interrupt count