File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change 15
15
16
16
#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
17
17
18
+ #define JUMP_TABLE_ENTRY (key , label ) \
19
+ ".pushsection __jump_table, \"aw\"\n\t" \
20
+ ".align 3\n\t" \
21
+ ".long 1b - ., %l["#label"] - .\n\t" \
22
+ ".quad %c0 - .\n\t" \
23
+ ".popsection\n\t" \
24
+ : : "i"(key) : : label
25
+
18
26
static __always_inline bool arch_static_branch (struct static_key * const key ,
19
27
const bool branch )
20
28
{
29
+ char * k = & ((char * )key )[branch ];
30
+
21
31
asm goto(
22
32
"1: nop \n\t"
23
- " .pushsection __jump_table, \"aw\" \n\t"
24
- " .align 3 \n\t"
25
- " .long 1b - ., %l[l_yes] - . \n\t"
26
- " .quad %c0 - . \n\t"
27
- " .popsection \n\t"
28
- : : "i" (& ((char * )key )[branch ]) : : l_yes );
33
+ JUMP_TABLE_ENTRY (k , l_yes )
34
+ );
29
35
30
36
return false;
31
37
l_yes :
@@ -35,15 +41,11 @@ static __always_inline bool arch_static_branch(struct static_key * const key,
35
41
static __always_inline bool arch_static_branch_jump (struct static_key * const key ,
36
42
const bool branch )
37
43
{
44
+ char * k = & ((char * )key )[branch ];
38
45
asm goto(
39
46
"1: b %l[l_yes] \n\t"
40
- " .pushsection __jump_table, \"aw\" \n\t"
41
- " .align 3 \n\t"
42
- " .long 1b - ., %l[l_yes] - . \n\t"
43
- " .quad %c0 - . \n\t"
44
- " .popsection \n\t"
45
- : : "i" (& ((char * )key )[branch ]) : : l_yes );
46
-
47
+ JUMP_TABLE_ENTRY (k , l_yes )
48
+ );
47
49
return false;
48
50
l_yes :
49
51
return true;
You can’t perform that action at this time.
0 commit comments