Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Move definitions for 32/64-bit agonstic inline assembler to new file.

Inspired by Markos Chandras' patch. I just didn't want do pull bitsops.h
into pgtable.h.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
References: https://patchwork.linux-mips.org/patch/11052/

+31 -25
+1 -16
arch/mips/include/asm/bitops.h
··· 19 19 #include <asm/byteorder.h> /* sigh ... */ 20 20 #include <asm/compiler.h> 21 21 #include <asm/cpu-features.h> 22 + #include <asm/llsc.h> 22 23 #include <asm/sgidefs.h> 23 24 #include <asm/war.h> 24 - 25 - #if _MIPS_SZLONG == 32 26 - #define SZLONG_LOG 5 27 - #define SZLONG_MASK 31UL 28 - #define __LL "ll " 29 - #define __SC "sc " 30 - #define __INS "ins " 31 - #define __EXT "ext " 32 - #elif _MIPS_SZLONG == 64 33 - #define SZLONG_LOG 6 34 - #define SZLONG_MASK 63UL 35 - #define __LL "lld " 36 - #define __SC "scd " 37 - #define __INS "dins " 38 - #define __EXT "dext " 39 - #endif 40 25 41 26 /* 42 27 * These are the "slower" versions of the functions and are in bitops.c.
+28
arch/mips/include/asm/llsc.h
··· 1 + /* 2 + * This file is subject to the terms and conditions of the GNU General Public 3 + * License. See the file "COPYING" in the main directory of this archive 4 + * for more details. 5 + * 6 + * Macros for 32/64-bit neutral inline assembler 7 + */ 8 + 9 + #ifndef __ASM_LLSC_H 10 + #define __ASM_LLSC_H 11 + 12 + #if _MIPS_SZLONG == 32 13 + #define SZLONG_LOG 5 14 + #define SZLONG_MASK 31UL 15 + #define __LL "ll " 16 + #define __SC "sc " 17 + #define __INS "ins " 18 + #define __EXT "ext " 19 + #elif _MIPS_SZLONG == 64 20 + #define SZLONG_LOG 6 21 + #define SZLONG_MASK 63UL 22 + #define __LL "lld " 23 + #define __SC "scd " 24 + #define __INS "dins " 25 + #define __EXT "dext " 26 + #endif 27 + 28 + #endif /* __ASM_LLSC_H */
+2 -9
arch/mips/include/asm/pgtable.h
··· 187 187 * For SMP, multiple CPUs can race, so we need to do 188 188 * this atomically. 189 189 */ 190 - #ifdef CONFIG_64BIT 191 - #define LL_INSN "lld" 192 - #define SC_INSN "scd" 193 - #else /* CONFIG_32BIT */ 194 - #define LL_INSN "ll" 195 - #define SC_INSN "sc" 196 - #endif 197 190 unsigned long page_global = _PAGE_GLOBAL; 198 191 unsigned long tmp; 199 192 200 193 __asm__ __volatile__ ( 201 194 " .set push\n" 202 195 " .set noreorder\n" 203 - "1: " LL_INSN " %[tmp], %[buddy]\n" 196 + "1: " __LL " %[tmp], %[buddy]\n" 204 197 " bnez %[tmp], 2f\n" 205 198 " or %[tmp], %[tmp], %[global]\n" 206 - " " SC_INSN " %[tmp], %[buddy]\n" 199 + " " __SC " %[tmp], %[buddy]\n" 207 200 " beqz %[tmp], 1b\n" 208 201 " nop\n" 209 202 "2:\n"