xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/llsc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
3*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
4*4882a593Smuzhiyun  * for more details.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Macros for 32/64-bit neutral inline assembler
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __ASM_LLSC_H
10*4882a593Smuzhiyun #define __ASM_LLSC_H
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <asm/isa-rev.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #if _MIPS_SZLONG == 32
15*4882a593Smuzhiyun #define __LL		"ll	"
16*4882a593Smuzhiyun #define __SC		"sc	"
17*4882a593Smuzhiyun #define __INS		"ins	"
18*4882a593Smuzhiyun #define __EXT		"ext	"
19*4882a593Smuzhiyun #elif _MIPS_SZLONG == 64
20*4882a593Smuzhiyun #define __LL		"lld	"
21*4882a593Smuzhiyun #define __SC		"scd	"
22*4882a593Smuzhiyun #define __INS		"dins	"
23*4882a593Smuzhiyun #define __EXT		"dext	"
24*4882a593Smuzhiyun #endif
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /*
27*4882a593Smuzhiyun  * Using a branch-likely instruction to check the result of an sc instruction
28*4882a593Smuzhiyun  * works around a bug present in R10000 CPUs prior to revision 3.0 that could
29*4882a593Smuzhiyun  * cause ll-sc sequences to execute non-atomically.
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun #ifdef CONFIG_WAR_R10000_LLSC
32*4882a593Smuzhiyun # define __SC_BEQZ "beqzl	"
33*4882a593Smuzhiyun #elif MIPS_ISA_REV >= 6
34*4882a593Smuzhiyun # define __SC_BEQZ "beqzc	"
35*4882a593Smuzhiyun #else
36*4882a593Smuzhiyun # define __SC_BEQZ "beqz	"
37*4882a593Smuzhiyun #endif
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun #endif /* __ASM_LLSC_H  */
40