]>
Commit | Line | Data |
---|---|---|
5373db88 JG |
1 | #ifndef _ASM_S390_JUMP_LABEL_H |
2 | #define _ASM_S390_JUMP_LABEL_H | |
3 | ||
55dd0df7 AB |
4 | #ifndef __ASSEMBLY__ |
5 | ||
5373db88 | 6 | #include <linux/types.h> |
ac314184 | 7 | #include <linux/stringify.h> |
5373db88 JG |
8 | |
9 | #define JUMP_LABEL_NOP_SIZE 6 | |
d5caa4db | 10 | #define JUMP_LABEL_NOP_OFFSET 2 |
5373db88 | 11 | |
d5caa4db HC |
12 | /* |
13 | * We use a brcl 0,2 instruction for jump labels at compile time so it | |
14 | * can be easily distinguished from a hotpatch generated instruction. | |
15 | */ | |
11276d53 | 16 | static __always_inline bool arch_static_branch(struct static_key *key, bool branch) |
5373db88 | 17 | { |
d5caa4db | 18 | asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n" |
5373db88 | 19 | ".pushsection __jump_table, \"aw\"\n" |
5a79859a HC |
20 | ".balign 8\n" |
21 | ".quad 0b, %l[label], %0\n" | |
5373db88 | 22 | ".popsection\n" |
11276d53 PZ |
23 | : : "X" (&((char *)key)[branch]) : : label); |
24 | ||
25 | return false; | |
26 | label: | |
27 | return true; | |
28 | } | |
29 | ||
30 | static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) | |
31 | { | |
32 | asm_volatile_goto("0: brcl 15, %l[label]\n" | |
33 | ".pushsection __jump_table, \"aw\"\n" | |
34 | ".balign 8\n" | |
35 | ".quad 0b, %l[label], %0\n" | |
36 | ".popsection\n" | |
37 | : : "X" (&((char *)key)[branch]) : : label); | |
38 | ||
5373db88 JG |
39 | return false; |
40 | label: | |
41 | return true; | |
42 | } | |
43 | ||
44 | typedef unsigned long jump_label_t; | |
45 | ||
46 | struct jump_entry { | |
47 | jump_label_t code; | |
48 | jump_label_t target; | |
49 | jump_label_t key; | |
50 | }; | |
51 | ||
55dd0df7 | 52 | #endif /* __ASSEMBLY__ */ |
5373db88 | 53 | #endif |