1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2013 Huawei Ltd.
4 * Author: Jiang Liu <liuj97@gmail.com>
6 * Based on arch/arm/include/asm/jump_label.h
8 #ifndef __ASM_JUMP_LABEL_H
9 #define __ASM_JUMP_LABEL_H
13 #include <linux/types.h>
16 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
19 * Prefer the constraint "S" to support PIC with GCC. Clang before 19 does not
20 * support "S" on a symbol with a constant offset, so we use "i" as a fallback.
22 static __always_inline bool arch_static_branch(struct static_key * const key,
27 " .pushsection __jump_table, \"aw\" \n\t"
29 " .long 1b - ., %l[l_yes] - . \n\t"
30 " .quad (%[key] - .) + %[bit0] \n\t"
32 : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);
39 static __always_inline bool arch_static_branch_jump(struct static_key * const key,
44 " .pushsection __jump_table, \"aw\" \n\t"
46 " .long 1b - ., %l[l_yes] - . \n\t"
47 " .quad (%[key] - .) + %[bit0] \n\t"
49 : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);
56 #endif /* __ASSEMBLY__ */
57 #endif /* __ASM_JUMP_LABEL_H */