* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: barrier_subr_v9.s
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named 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 work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
* void barrier(uint32_t loopticks)
* Hmm, this function is not used anymore and should be deleted.
* In fact, the following files should be deleted:
* system/util/barrier_subr_v9.s
* system/util/barrier_subr_v8.s
* system/util/include/barrier.h
* and all references to cpu_barrier
#pragma ident "@(#)1.3 07/07/10 barrier_subr_v9.s"
#include <sys/asm_linkage.h>
ldx [%o0+24], %o1 ! load bp->sbp into %o1
! atomic decrement of running count
! check if this is the last one
! YES, switch sub-barriers, reset count and CV
add %o0, 4, %o2 ! %o2 = &bp->sb[0]
add %o0, 12, %o2 ! %o2 = &bp->sb[1]
1: stx %o2, [%o0 + 24] ! store %o2 into bp->sbp
! release the CV busy-waiters
or %o0, 0, %o5 ! loopticks
setx cpu_barrier, %o2, %o0
ldx [%o0 + 24], %o1 ! load bp->sbp into %o1
ldx [%o0 + 32], %o0 !!!!!! global tick pointer
! atomic decrement of running count
retry1: ldx [%o0], %o2 !! global_tick + looptick
! check if this is the last one
! YES, switch sub-barriers, reset count and CV
setx cpu_barrier, %o2, %o0
add %o0, 4, %o2 ! %o2 = &bp->sb[0]
add %o0, 12, %o2 ! %o2 = &bp->sb[1]
1: stx %o2, [%o0 + 24] ! store %o2 into bp->sbp
! release the CV busy-waiters