atomic_swap.S revision 1.2
11.2Smatt/* $NetBSD: atomic_swap.S,v 1.2 2008/08/16 07:12:40 matt Exp $ */ 21.2Smatt 31.2Smatt/*- 41.2Smatt * Copyright (c) 2007 The NetBSD Foundation, Inc. 51.2Smatt * All rights reserved. 61.2Smatt * 71.2Smatt * This code is derived from software contributed to The NetBSD Foundation 81.2Smatt * by Jason R. Thorpe and Matt Thomas. 91.2Smatt * 101.2Smatt * Redistribution and use in source and binary forms, with or without 111.2Smatt * modification, are permitted provided that the following conditions 121.2Smatt * are met: 131.2Smatt * 1. Redistributions of source code must retain the above copyright 141.2Smatt * notice, this list of conditions and the following disclaimer. 151.2Smatt * 2. Redistributions in binary form must reproduce the above copyright 161.2Smatt * notice, this list of conditions and the following disclaimer in the 171.2Smatt * documentation and/or other materials provided with the distribution. 181.2Smatt * 3. All advertising materials mentioning features or use of this software 191.2Smatt * must display the following acknowledgement: 201.2Smatt * This product includes software developed by the NetBSD 211.2Smatt * Foundation, Inc. and its contributors. 221.2Smatt * 4. Neither the name of The NetBSD Foundation nor the names of its 231.2Smatt * contributors may be used to endorse or promote products derived 241.2Smatt * from this software without specific prior written permission. 251.2Smatt * 261.2Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.2Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.2Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.2Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.2Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.2Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.2Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.2Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.2Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.2Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.2Smatt * POSSIBILITY OF SUCH DAMAGE. 371.2Smatt */ 381.2Smatt 391.2Smatt#include "atomic_op_asm.h" 401.2Smatt 411.2SmattENTRY_NP(_atomic_swap_32) 421.2Smatt swp r0, r1, [r0] 431.2Smatt RET 441.2Smatt END(_atomic_swap_32) 451.2SmattATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) 461.2SmattATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) 471.2SmattATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) 481.2SmattATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) 491.2SmattSTRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) 501.2SmattSTRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) 511.2SmattSTRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) 521.2Smatt 531.2SmattENTRY_NP(_atomic_swap_8) 541.2Smatt swpb r0, r1, [r0] 551.2Smatt RET 561.2Smatt END(_atomic_swap_8) 571.2SmattATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) 581.2SmattATOMIC_OP_ALIAS(atomic_swap_char,_atomic_swap_8) 591.2SmattATOMIC_OP_ALIAS(atomic_swap_uchar,_atomic_swap_8) 601.2SmattSTRONG_ALIAS(_atomic_swap_char,_atomic_swap_32) 611.2SmattSTRONG_ALIAS(_atomic_swap_uchar,_atomic_swap_32) 62