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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ 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 #define arch_jump_label_transform_static arch_jump_label_transform
 12 
 13 #ifndef __ASSEMBLY__
 14 
 15 #include <linux/types.h>
 16 #include <asm/isa-rev.h>
 17 
 18 struct module;
 19 extern void jump_label_apply_nops(struct module *mod);
 20 
 21 #define JUMP_LABEL_NOP_SIZE 4
 22 
 23 #ifdef CONFIG_64BIT
 24 #define WORD_INSN ".dword"
 25 #else
 26 #define WORD_INSN ".word"
 27 #endif
 28 
 29 #ifdef CONFIG_CPU_MICROMIPS
 30 # define B_INSN "b32"
 31 # define J_INSN "j32"
 32 #elif MIPS_ISA_REV >= 6
 33 # define B_INSN "bc"
 34 # define J_INSN "bc"
 35 #else
 36 # define B_INSN "b"
 37 # define J_INSN "j"
 38 #endif
 39 
 40 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
 41 {
 42         asm goto("1:\t" B_INSN " 2f\n\t"
 43                 "2:\t.insn\n\t"
 44                 ".pushsection __jump_table,  \"aw\"\n\t"
 45                 WORD_INSN " 1b, %l[l_yes], %0\n\t"
 46                 ".popsection\n\t"
 47                 : :  "i" (&((char *)key)[branch]) : : l_yes);
 48 
 49         return false;
 50 l_yes:
 51         return true;
 52 }
 53 
 54 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
 55 {
 56         asm goto("1:\t" J_INSN " %l[l_yes]\n\t"
 57                 ".pushsection __jump_table,  \"aw\"\n\t"
 58                 WORD_INSN " 1b, %l[l_yes], %0\n\t"
 59                 ".popsection\n\t"
 60                 : :  "i" (&((char *)key)[branch]) : : l_yes);
 61 
 62         return false;
 63 l_yes:
 64         return true;
 65 }
 66 
 67 #ifdef CONFIG_64BIT
 68 typedef u64 jump_label_t;
 69 #else
 70 typedef u32 jump_label_t;
 71 #endif
 72 
 73 struct jump_entry {
 74         jump_label_t code;
 75         jump_label_t target;
 76         jump_label_t key;
 77 };
 78 
 79 #endif  /* __ASSEMBLY__ */
 80 #endif /* _ASM_MIPS_JUMP_LABEL_H */
 81 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php