~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/include/asm/jump_label.h

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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  * Copyright (c) 2010 Cavium Networks, Inc.
  7  */
  8 #ifndef _ASM_MIPS_JUMP_LABEL_H
  9 #define _ASM_MIPS_JUMP_LABEL_H
 10 
 11 #ifndef __ASSEMBLY__
 12 
 13 #include <linux/types.h>
 14 
 15 #define JUMP_LABEL_NOP_SIZE 4
 16 
 17 #ifdef CONFIG_64BIT
 18 #define WORD_INSN ".dword"
 19 #else
 20 #define WORD_INSN ".word"
 21 #endif
 22 
 23 #ifdef CONFIG_CPU_MICROMIPS
 24 #define NOP_INSN "nop32"
 25 #else
 26 #define NOP_INSN "nop"
 27 #endif
 28 
 29 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
 30 {
 31         asm_volatile_goto("1:\t" NOP_INSN "\n\t"
 32                 "nop\n\t"
 33                 ".pushsection __jump_table,  \"aw\"\n\t"
 34                 WORD_INSN " 1b, %l[l_yes], %0\n\t"
 35                 ".popsection\n\t"
 36                 : :  "i" (&((char *)key)[branch]) : : l_yes);
 37 
 38         return false;
 39 l_yes:
 40         return true;
 41 }
 42 
 43 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
 44 {
 45         asm_volatile_goto("1:\tj %l[l_yes]\n\t"
 46                 "nop\n\t"
 47                 ".pushsection __jump_table,  \"aw\"\n\t"
 48                 WORD_INSN " 1b, %l[l_yes], %0\n\t"
 49                 ".popsection\n\t"
 50                 : :  "i" (&((char *)key)[branch]) : : l_yes);
 51 
 52         return false;
 53 l_yes:
 54         return true;
 55 }
 56 
 57 #ifdef CONFIG_64BIT
 58 typedef u64 jump_label_t;
 59 #else
 60 typedef u32 jump_label_t;
 61 #endif
 62 
 63 struct jump_entry {
 64         jump_label_t code;
 65         jump_label_t target;
 66         jump_label_t key;
 67 };
 68 
 69 #endif  /* __ASSEMBLY__ */
 70 #endif /* _ASM_MIPS_JUMP_LABEL_H */
 71 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp