1
2#ifndef _ASM_S390_JUMP_LABEL_H
3#define _ASM_S390_JUMP_LABEL_H
4
5#ifndef __ASSEMBLY__
6
7#include <linux/types.h>
8#include <linux/stringify.h>
9
10#define JUMP_LABEL_NOP_SIZE 6
11#define JUMP_LABEL_NOP_OFFSET 2
12
13
14
15
16
17static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
18{
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);
25
26 return false;
27label:
28 return true;
29}
30
31static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
32{
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);
39
40 return false;
41label:
42 return true;
43}
44
45typedef unsigned long jump_label_t;
46
47struct jump_entry {
48 jump_label_t code;
49 jump_label_t target;
50 jump_label_t key;
51};
52
53#endif
54#endif
55