Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_ARM_JUMP_LABEL_H
0003 #define _ASM_ARM_JUMP_LABEL_H
0004 
0005 #ifndef __ASSEMBLY__
0006 
0007 #include <linux/types.h>
0008 #include <asm/unified.h>
0009 
0010 #define JUMP_LABEL_NOP_SIZE 4
0011 
0012 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
0013 {
0014     asm_volatile_goto("1:\n\t"
0015          WASM(nop) "\n\t"
0016          ".pushsection __jump_table,  \"aw\"\n\t"
0017          ".word 1b, %l[l_yes], %c0\n\t"
0018          ".popsection\n\t"
0019          : :  "i" (&((char *)key)[branch]) :  : l_yes);
0020 
0021     return false;
0022 l_yes:
0023     return true;
0024 }
0025 
0026 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
0027 {
0028     asm_volatile_goto("1:\n\t"
0029          WASM(b) " %l[l_yes]\n\t"
0030          ".pushsection __jump_table,  \"aw\"\n\t"
0031          ".word 1b, %l[l_yes], %c0\n\t"
0032          ".popsection\n\t"
0033          : :  "i" (&((char *)key)[branch]) :  : l_yes);
0034 
0035     return false;
0036 l_yes:
0037     return true;
0038 }
0039 
0040 typedef u32 jump_label_t;
0041 
0042 struct jump_entry {
0043     jump_label_t code;
0044     jump_label_t target;
0045     jump_label_t key;
0046 };
0047 
0048 #endif  /* __ASSEMBLY__ */
0049 #endif