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 HAVE_JUMP_LABEL_BATCH
17 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
19 #define JUMP_TABLE_ENTRY(key, label) \
20 ".pushsection __jump_table, \"aw\"\n\t" \
22 ".long 1b - ., " label " - .\n\t" \
23 ".quad " key " - .\n\t" \
26 /* This macro is also expanded on the Rust side. */
27 #define ARCH_STATIC_BRANCH_ASM(key, label) \
29 JUMP_TABLE_ENTRY(key, label)
31 static __always_inline
bool arch_static_branch(struct static_key
* const key
,
34 char *k
= &((char *)key
)[branch
];
37 ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]")
46 static __always_inline
bool arch_static_branch_jump(struct static_key
* const key
,
49 char *k
= &((char *)key
)[branch
];
53 JUMP_TABLE_ENTRY("%c0", "%l[l_yes]")
61 #endif /* __ASSEMBLY__ */
62 #endif /* __ASM_JUMP_LABEL_H */