* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: libc.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 ============================================
!--------------------------------------------------------------------------
! tso diags related definitions
!--------------------------------------------------------------------------
#define LOCK_TIMEOUT 0x100
#define ENTRY(a) .align 32; .global a; a:
!--------------------------------------------------------------------------
#ifndef MY_PRINTF_ROUTINE
!--------------------------------------------------------------------------
! tso diags related library functions
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Ported frm MPCONS test:
! Acquire a lock using ldstub - spins using ldub until lock is free
! status = mplock(addr, owner, timeout, timecount)
! Note: timecount is not used any more.
! Note: simplfied for pre-silicon env purposes.
!--------------------------------------------------------------------------
ldstub [%i0], %l1 ! try to acquire lock
stb %i1, [%i0+1] ! got lock, set owner field
mov %i2, %l2 ! set timeout limit
ldub [%i0], %l1 ! read lock value
subcc %l2, 1, %l2 ! timecount expired?
restore %g0, 1, %o0 ! return failure
!--------------------------------------------------------------------------
! Ported frm MPCONS test:
! Acquire a lock using ldstub - spins using ldub until lock is free
! status = mplockcasx(addr, owner, timeout, timecount)
! Note: timecount is not used any more.
! Note: simplfied for pre-silicon env purposes.
!--------------------------------------------------------------------------
casx [%i0], %g0, %l1 ! try to get lock
stx %i1, [%i0+8] ! got lock, set owner field
mov %i2, %l2 ! set timeout limit
ldx [%i0], %l1 ! read lock value
subcc %l2, 1, %l2 ! timecount expired?
restore %g0, 1, %o0 ! return failure
!--------------------------------------------------------------------------
! data1 = loadd(&data2, addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Load a halfword (short), one byte a time
! data = loadh_by_bytes(addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Load a word, 1 byte at a time
! data = loadw_by_bytes(addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Load a dowbleword, 1 byte at a time
! data1 = loadd_by_bytes(&data2, addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Load a pointer, 1 byte at a time
! addr = loadp_by_bytes(addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Store a block (64-bytes)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! These below were inline( functions in tests...
! I made the assembly routines.
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! stored(data1, data2, addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! data = swap(data, addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Compare and swap a word
! data = casa(data, addr)
!--------------------------------------------------------------------------
casa [%o1] 0x80, %g0, %o0
!--------------------------------------------------------------------------
! Store a halfword (short), 1 byte at a time
! storeh_by_bytes(data, addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Store a word (integer), 1 byte at a time
! storew_by_bytes(data, addr)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Prefetch a line for many reads - loads into E$
! prefetch_for_read_many(addr)
!--------------------------------------------------------------------------
ENTRY(prefetch_for_read_many)
!--------------------------------------------------------------------------
! Prefetch a line for one reads - loads into P$
! prefetch_for_read_once(addr)
!--------------------------------------------------------------------------
ENTRY(prefetch_for_read_once)
!--------------------------------------------------------------------------
! Prefetch a line for write
! prefetch_for_write_many(addr)
!--------------------------------------------------------------------------
ENTRY(prefetch_for_write_many)
!--------------------------------------------------------------------------
! Prefetch a line for write
! prefetch_for_write_once(addr)
!--------------------------------------------------------------------------
ENTRY(prefetch_for_write_once)
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
!================= end for now ============================================