xref: /minix3/common/lib/libc/arch/arm/atomic/atomic_op_asm.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: atomic_op_asm.h,v 1.7 2015/05/17 20:57:11 justin Exp $	*/
2b6cbf720SGianluca Guida 
3b6cbf720SGianluca Guida /*-
4b6cbf720SGianluca Guida  * Copyright (c) 2007 The NetBSD Foundation, Inc.
5b6cbf720SGianluca Guida  * All rights reserved.
6b6cbf720SGianluca Guida  *
7b6cbf720SGianluca Guida  * This code is derived from software contributed to The NetBSD Foundation
8b6cbf720SGianluca Guida  * by Jason R. Thorpe.
9b6cbf720SGianluca Guida  *
10b6cbf720SGianluca Guida  * Redistribution and use in source and binary forms, with or without
11b6cbf720SGianluca Guida  * modification, are permitted provided that the following conditions
12b6cbf720SGianluca Guida  * are met:
13b6cbf720SGianluca Guida  * 1. Redistributions of source code must retain the above copyright
14b6cbf720SGianluca Guida  *    notice, this list of conditions and the following disclaimer.
15b6cbf720SGianluca Guida  * 2. Redistributions in binary form must reproduce the above copyright
16b6cbf720SGianluca Guida  *    notice, this list of conditions and the following disclaimer in the
17b6cbf720SGianluca Guida  *    documentation and/or other materials provided with the distribution.
18b6cbf720SGianluca Guida  * 3. All advertising materials mentioning features or use of this software
19b6cbf720SGianluca Guida  *    must display the following acknowledgement:
20b6cbf720SGianluca Guida  *	This product includes software developed by the NetBSD
21b6cbf720SGianluca Guida  *	Foundation, Inc. and its contributors.
22b6cbf720SGianluca Guida  * 4. Neither the name of The NetBSD Foundation nor the names of its
23b6cbf720SGianluca Guida  *    contributors may be used to endorse or promote products derived
24b6cbf720SGianluca Guida  *    from this software without specific prior written permission.
25b6cbf720SGianluca Guida  *
26b6cbf720SGianluca Guida  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27b6cbf720SGianluca Guida  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28b6cbf720SGianluca Guida  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29b6cbf720SGianluca Guida  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30b6cbf720SGianluca Guida  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31b6cbf720SGianluca Guida  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32b6cbf720SGianluca Guida  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33b6cbf720SGianluca Guida  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34b6cbf720SGianluca Guida  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35b6cbf720SGianluca Guida  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36b6cbf720SGianluca Guida  * POSSIBILITY OF SUCH DAMAGE.
37b6cbf720SGianluca Guida  */
38b6cbf720SGianluca Guida 
39b6cbf720SGianluca Guida #ifndef _ATOMIC_OP_ASM_H_
40b6cbf720SGianluca Guida #define	_ATOMIC_OP_ASM_H_
41b6cbf720SGianluca Guida 
42b6cbf720SGianluca Guida #include <machine/asm.h>
43b6cbf720SGianluca Guida 
44*0a6a1f1dSLionel Sambuc #if defined(_KERNEL) || defined(_STANDALONE)
45b6cbf720SGianluca Guida 
46b6cbf720SGianluca Guida #define	ATOMIC_OP_ALIAS(a,s)	STRONG_ALIAS(a,s)
47b6cbf720SGianluca Guida 
48b6cbf720SGianluca Guida #else /* _KERNEL */
49b6cbf720SGianluca Guida 
50b6cbf720SGianluca Guida #define	ATOMIC_OP_ALIAS(a,s)	WEAK_ALIAS(a,s)
51*0a6a1f1dSLionel Sambuc #ifdef _LIBC
52*0a6a1f1dSLionel Sambuc #define	CRT_ALIAS(a,s)		STRONG_ALIAS(a,s)
53*0a6a1f1dSLionel Sambuc #endif
54b6cbf720SGianluca Guida 
55b6cbf720SGianluca Guida #endif /* _KERNEL */
56b6cbf720SGianluca Guida 
57f14fb602SLionel Sambuc #ifdef __ARMEB__
58f14fb602SLionel Sambuc #define	HI	r0
59f14fb602SLionel Sambuc #define	LO	r1
60f14fb602SLionel Sambuc #define	NHI	r2
61f14fb602SLionel Sambuc #define	NLO	r3
6284d9c625SLionel Sambuc #define	THI	r4
6384d9c625SLionel Sambuc #define	TLO	r5
64f14fb602SLionel Sambuc #else
65f14fb602SLionel Sambuc #define	LO	r0
66f14fb602SLionel Sambuc #define	HI	r1
67f14fb602SLionel Sambuc #define	NLO	r2
68f14fb602SLionel Sambuc #define	NHI	r3
6984d9c625SLionel Sambuc #define	TLO	r4
7084d9c625SLionel Sambuc #define	THI	r5
71f14fb602SLionel Sambuc #endif
72f14fb602SLionel Sambuc 
73*0a6a1f1dSLionel Sambuc #ifndef CRT_ALIAS
74*0a6a1f1dSLionel Sambuc #define	CRT_ALIAS(a,s)
75*0a6a1f1dSLionel Sambuc #endif
76*0a6a1f1dSLionel Sambuc 
77b6cbf720SGianluca Guida #endif /* _ATOMIC_OP_ASM_H_ */
78