1*b6cbf720SGianluca Guida /* $NetBSD: atomic_op_asm.h,v 1.6 2011/01/17 18:11:09 joerg Exp $ */ 2*b6cbf720SGianluca Guida 3*b6cbf720SGianluca Guida /*- 4*b6cbf720SGianluca Guida * Copyright (c) 2007 The NetBSD Foundation, Inc. 5*b6cbf720SGianluca Guida * All rights reserved. 6*b6cbf720SGianluca Guida * 7*b6cbf720SGianluca Guida * This code is derived from software contributed to The NetBSD Foundation 8*b6cbf720SGianluca Guida * by Jason R. Thorpe. 9*b6cbf720SGianluca Guida * 10*b6cbf720SGianluca Guida * Redistribution and use in source and binary forms, with or without 11*b6cbf720SGianluca Guida * modification, are permitted provided that the following conditions 12*b6cbf720SGianluca Guida * are met: 13*b6cbf720SGianluca Guida * 1. Redistributions of source code must retain the above copyright 14*b6cbf720SGianluca Guida * notice, this list of conditions and the following disclaimer. 15*b6cbf720SGianluca Guida * 2. Redistributions in binary form must reproduce the above copyright 16*b6cbf720SGianluca Guida * notice, this list of conditions and the following disclaimer in the 17*b6cbf720SGianluca Guida * documentation and/or other materials provided with the distribution. 18*b6cbf720SGianluca Guida * 19*b6cbf720SGianluca Guida * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*b6cbf720SGianluca Guida * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*b6cbf720SGianluca Guida * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*b6cbf720SGianluca Guida * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*b6cbf720SGianluca Guida * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*b6cbf720SGianluca Guida * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*b6cbf720SGianluca Guida * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*b6cbf720SGianluca Guida * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*b6cbf720SGianluca Guida * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*b6cbf720SGianluca Guida * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*b6cbf720SGianluca Guida * POSSIBILITY OF SUCH DAMAGE. 30*b6cbf720SGianluca Guida */ 31*b6cbf720SGianluca Guida 32*b6cbf720SGianluca Guida #ifndef _ATOMIC_OP_ASM_H_ 33*b6cbf720SGianluca Guida #define _ATOMIC_OP_ASM_H_ 34*b6cbf720SGianluca Guida 35*b6cbf720SGianluca Guida #include <machine/asm.h> 36*b6cbf720SGianluca Guida 37*b6cbf720SGianluca Guida #if defined(_KERNEL) 38*b6cbf720SGianluca Guida 39*b6cbf720SGianluca Guida #define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) 40*b6cbf720SGianluca Guida 41*b6cbf720SGianluca Guida #ifdef __arch64__ 42*b6cbf720SGianluca Guida #define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _64) 43*b6cbf720SGianluca Guida #else 44*b6cbf720SGianluca Guida #define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _32) 45*b6cbf720SGianluca Guida #endif 46*b6cbf720SGianluca Guida 47*b6cbf720SGianluca Guida #else /* _KERNEL */ 48*b6cbf720SGianluca Guida 49*b6cbf720SGianluca Guida #define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) 50*b6cbf720SGianluca Guida 51*b6cbf720SGianluca Guida #ifdef __arch64__ 52*b6cbf720SGianluca Guida #define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s ## _64) 53*b6cbf720SGianluca Guida #else 54*b6cbf720SGianluca Guida #define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s ## _32) 55*b6cbf720SGianluca Guida #endif 56*b6cbf720SGianluca Guida 57*b6cbf720SGianluca Guida #endif /* _KERNEL */ 58*b6cbf720SGianluca Guida 59*b6cbf720SGianluca Guida #ifdef __arch64__ 60*b6cbf720SGianluca Guida #define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _64) 61*b6cbf720SGianluca Guida #else 62*b6cbf720SGianluca Guida #define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _32) 63*b6cbf720SGianluca Guida #endif 64*b6cbf720SGianluca Guida 65*b6cbf720SGianluca Guida #endif /* _ATOMIC_OP_ASM_H_ */ 66