1/* $NetBSD: atomic_or.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */ 2 3/*- 4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> 30#include <machine/asm.h> 31#include "atomic_op_asm.h" 32 33 .text 34 .set noat 35 .set noreorder 36 .set nomacro 37 38LEAF(_atomic_or_32) 391: INT_LL t0, 0(a0) 40 nop 41 or t0, a1 42 INT_SC t0, 0(a0) 43 beq t0, zero, 1b 44 nop 45 j ra 46 nop 47END(_atomic_or_32) 48ATOMIC_OP_ALIAS(atomic_or_32, _atomic_or_32) 49 50LEAF(_atomic_or_32_nv) 511: INT_LL v0, 0(a0) 52 nop 53 or v0, a1 54 move t0, v0 55 INT_SC t0, 0(a0) 56 beq t0, zero, 1b 57 nop 58 j ra 59 nop 60END(_atomic_or_32_nv) 61ATOMIC_OP_ALIAS(atomic_or_32_nv, _atomic_or_32_nv) 62 63#if !defined(__mips_o32) 64LEAF(_atomic_or_64) 651: REG_LL t0, 0(a0) 66 nop 67 or t0, a1 68 REG_SC t0, 0(a0) 69 beq t0, zero, 1b 70 nop 71 j ra 72 nop 73END(_atomic_or_64) 74ATOMIC_OP_ALIAS(atomic_or_64, _atomic_or_64) 75 76LEAF(_atomic_or_64_nv) 771: REG_LL v0, 0(a0) 78 nop 79 or v0, a1 80 move t0, v0 81 REG_SC t0, 0(a0) 82 beq t0, zero, 1b 83 nop 84 j ra 85 nop 86END(_atomic_or_64_nv) 87ATOMIC_OP_ALIAS(atomic_or_64_nv, _atomic_or_64_nv) 88#endif 89 90#ifdef _LP64 91STRONG_ALIAS(_atomic_or_ulong, _atomic_or_64) 92STRONG_ALIAS(_atomic_or_ulong_nv, _atomic_or_64_nv) 93#else 94STRONG_ALIAS(_atomic_or_ulong, _atomic_or_32) 95STRONG_ALIAS(_atomic_or_ulong_nv, _atomic_or_32_nv) 96#endif 97STRONG_ALIAS(_atomic_or_uint, _atomic_or_32) 98STRONG_ALIAS(_atomic_or_uint_nv, _atomic_or_32_nv) 99 100ATOMIC_OP_ALIAS(atomic_or_uint, _atomic_or_uint) 101ATOMIC_OP_ALIAS(atomic_or_uint_nv, _atomic_or_uint_nv) 102ATOMIC_OP_ALIAS(atomic_or_ulong, _atomic_or_ulong) 103ATOMIC_OP_ALIAS(atomic_or_ulong_nv, _atomic_or_ulong_nv) 104