Back to home page

OSCL-LXR

 
 

    


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