2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com>
5 * Based on arch/arm/include/asm/jump_label.h
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __ASM_JUMP_LABEL_H
20 #define __ASM_JUMP_LABEL_H
24 #include <linux/types.h>
27 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
29 static __always_inline
bool arch_static_branch(struct static_key
*key
, bool branch
)
32 ".pushsection __jump_table, \"aw\"\n\t"
34 ".quad 1b, %l[l_yes], %c0\n\t"
36 : : "i"(&((char *)key
)[branch
]) : : l_yes
);
43 static __always_inline
bool arch_static_branch_jump(struct static_key
*key
, bool branch
)
45 asm goto("1: b %l[l_yes]\n\t"
46 ".pushsection __jump_table, \"aw\"\n\t"
48 ".quad 1b, %l[l_yes], %c0\n\t"
50 : : "i"(&((char *)key
)[branch
]) : : l_yes
);
57 typedef u64 jump_label_t
;
65 #endif /* __ASSEMBLY__ */
66 #endif /* __ASM_JUMP_LABEL_H */