* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: tso_n1_mutex2_ldstub.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 spinlock_addr_reg %o0
#define data_base_reg %o1
#define global_cnt_reg %o5
#if defined CREGS_LSU_CTL_REG_DC && CREGS_LSU_CTL_REG_DC == 0
#if defined CREGS_LSU_CTL_REG_IC && CREGS_LSU_CTL_REG_IC == 0
#if defined CREGS_L2_CTL_REG_DIS && CREGS_L2_CTL_REG_DIS == 1
setx spinlock_address, %l0, spinlock_addr_reg ! spinlock address
set TIMEOUT, to_reg ! set timeout count
set ITERATIONS, global_cnt_reg
or spinlock_addr_reg, %g0, my_id_reg
add my_id_reg, 0x20, my_id_reg ! my ID address
stb %g0, [my_id_reg] ! clear it
add my_id_reg, 0x24, my_id_reg
add my_id_reg, 0x28, my_id_reg
add my_id_reg, 0x2c, my_id_reg
add my_id_reg, 0x30, my_id_reg
add my_id_reg, 0x34, my_id_reg
add my_id_reg, 0x38, my_id_reg
add my_id_reg, 0x3c, my_id_reg
deccc to_reg ! dec timeout count
be bad_end ! branch if no timeout
or %g0, my_id_reg, test_reg ! ldstub
ldstub [spinlock_addr_reg], test_reg ! try to acquire lock
tst test_reg ! did we get it?
set TIMEOUT, to_reg ! set to count again
setx protected_area, %l0, data_base_reg
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+8] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+16] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+24] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+32] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+40] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+48] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+56] ! store my ID in there
add %l0, my_id_reg, %l0 ! initial value
stx %l0, [data_base_reg+64] ! store my ID in there
ldx [data_base_reg], %i0 ! read the data area
stx %i0, [data_base_reg] ! store my ID in there
ldx [data_base_reg+8], %i0 ! read the data area
stx %i0, [data_base_reg+8] ! store my ID in there
ldx [data_base_reg+16], %i0 ! read the data area
stx %i0, [data_base_reg+16] ! store my ID in there
ldx [data_base_reg+24], %i0 ! read the data area
stx %i0, [data_base_reg+24] ! store my ID in there
ldx [data_base_reg+32], %i0 ! read the data area
stx %i0, [data_base_reg+32] ! store my ID in there
ldx [data_base_reg+40], %i0 ! read the data area
stx %i0, [data_base_reg+40] ! store my ID in there
ldx [data_base_reg+48], %i0 ! read the data area
stx %i0, [data_base_reg+48] ! store my ID in there
ldx [data_base_reg+56], %i0 ! read the data area
stx %i0, [data_base_reg+56] ! store my ID in there
ldx [data_base_reg+64], %i0 ! read the data area
stx %i0, [data_base_reg+64] ! store my ID in there
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+8], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+16], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+24], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+32], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+40], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+48], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+56], tmp1 ! read the data area
add %l0, my_id_reg, %i0 ! initial value
ldx [data_base_reg+64], tmp1 ! read the data area
stb %g0, [spinlock_addr_reg] ! unlock
!==========================