blob: 510012bceb7512535caed85945d31e23f059c982 [file] [log] [blame]
Jan Glauber5373db82011-03-16 15:58:30 -04001#ifndef _ASM_S390_JUMP_LABEL_H
2#define _ASM_S390_JUMP_LABEL_H
3
4#include <linux/types.h>
5
6#define JUMP_LABEL_NOP_SIZE 6
Heiko Carstensd5caa4d2015-01-29 14:10:22 +01007#define JUMP_LABEL_NOP_OFFSET 2
Jan Glauber5373db82011-03-16 15:58:30 -04008
Heiko Carstensd5caa4d2015-01-29 14:10:22 +01009/*
10 * We use a brcl 0,2 instruction for jump labels at compile time so it
11 * can be easily distinguished from a hotpatch generated instruction.
12 */
Ingo Molnarc5905af2012-02-24 08:31:31 +010013static __always_inline bool arch_static_branch(struct static_key *key)
Jan Glauber5373db82011-03-16 15:58:30 -040014{
Heiko Carstensd5caa4d2015-01-29 14:10:22 +010015 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
Jan Glauber5373db82011-03-16 15:58:30 -040016 ".pushsection __jump_table, \"aw\"\n"
Heiko Carstens5a798592015-02-12 13:08:27 +010017 ".balign 8\n"
18 ".quad 0b, %l[label], %0\n"
Jan Glauber5373db82011-03-16 15:58:30 -040019 ".popsection\n"
20 : : "X" (key) : : label);
21 return false;
22label:
23 return true;
24}
25
26typedef unsigned long jump_label_t;
27
28struct jump_entry {
29 jump_label_t code;
30 jump_label_t target;
31 jump_label_t key;
32};
33
34#endif