1/* Copyright (C) 2005 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; see the file COPYING.LIB. If 16 not, see <http://www.gnu.org/licenses/>. */ 17 18#define _ERRNO_H 1 19#include <bits/errno.h> 20#include <bits/xtensa-config.h> 21#include <sysdep.h> 22 23 .text 24ENTRY (pthread_spin_trylock) 25 26#if XCHAL_HAVE_EXCLUSIVE 27 memw 28 l32ex a3, a2 29 bnez a3, 1f 30 movi a3, 1 31 s32ex a3, a2 32 getex a3 33 addi a3, a3, -1 34 memw 351: 36#elif XCHAL_HAVE_S32C1I 37 movi a3, 0 38 wsr a3, scompare1 39 movi a3, 1 40 s32c1i a3, a2, 0 41#else 42 43#error No hardware atomic operations 44 45#endif 46 movi a2, EBUSY 47 moveqz a2, a3, a3 48 49 abi_ret 50 51END (pthread_spin_trylock) 52