x86/speculation/mds: Fix documentation typo
[linux/fpc-iii.git] / arch / s390 / include / asm / jump_label.h
blob40f651292aa78997232c74ae5f91afc0bbea035e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_JUMP_LABEL_H
3 #define _ASM_S390_JUMP_LABEL_H
5 #ifndef __ASSEMBLY__
7 #include <linux/types.h>
8 #include <linux/stringify.h>
10 #define JUMP_LABEL_NOP_SIZE 6
11 #define JUMP_LABEL_NOP_OFFSET 2
14 * We use a brcl 0,2 instruction for jump labels at compile time so it
15 * can be easily distinguished from a hotpatch generated instruction.
17 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
19 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
20 ".pushsection __jump_table, \"aw\"\n"
21 ".balign 8\n"
22 ".quad 0b, %l[label], %0\n"
23 ".popsection\n"
24 : : "X" (&((char *)key)[branch]) : : label);
26 return false;
27 label:
28 return true;
31 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
33 asm_volatile_goto("0: brcl 15, %l[label]\n"
34 ".pushsection __jump_table, \"aw\"\n"
35 ".balign 8\n"
36 ".quad 0b, %l[label], %0\n"
37 ".popsection\n"
38 : : "X" (&((char *)key)[branch]) : : label);
40 return false;
41 label:
42 return true;
45 typedef unsigned long jump_label_t;
47 struct jump_entry {
48 jump_label_t code;
49 jump_label_t target;
50 jump_label_t key;
53 #endif /* __ASSEMBLY__ */
54 #endif