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