]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/arm/include/asm/jump_label.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / arch / arm / include / asm / jump_label.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
09f05d85
RV
2#ifndef _ASM_ARM_JUMP_LABEL_H
3#define _ASM_ARM_JUMP_LABEL_H
4
55dd0df7 5#ifndef __ASSEMBLY__
09f05d85
RV
6
7#include <linux/types.h>
11276d53 8#include <asm/unified.h>
09f05d85
RV
9
10#define JUMP_LABEL_NOP_SIZE 4
11
11276d53
PZ
12static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
13{
14 asm_volatile_goto("1:\n\t"
15 WASM(nop) "\n\t"
16 ".pushsection __jump_table, \"aw\"\n\t"
17 ".word 1b, %l[l_yes], %c0\n\t"
18 ".popsection\n\t"
19 : : "i" (&((char *)key)[branch]) : : l_yes);
20
21 return false;
22l_yes:
23 return true;
24}
09f05d85 25
11276d53 26static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
09f05d85 27{
3f0116c3 28 asm_volatile_goto("1:\n\t"
11276d53 29 WASM(b) " %l[l_yes]\n\t"
09f05d85
RV
30 ".pushsection __jump_table, \"aw\"\n\t"
31 ".word 1b, %l[l_yes], %c0\n\t"
32 ".popsection\n\t"
11276d53 33 : : "i" (&((char *)key)[branch]) : : l_yes);
09f05d85
RV
34
35 return false;
36l_yes:
37 return true;
38}
39
09f05d85
RV
40typedef u32 jump_label_t;
41
42struct jump_entry {
43 jump_label_t code;
44 jump_label_t target;
45 jump_label_t key;
46};
47
55dd0df7 48#endif /* __ASSEMBLY__ */
09f05d85 49#endif