.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013 Huawei Ltd. |
---|
3 | 4 | * Author: Jiang Liu <liuj97@gmail.com> |
---|
4 | 5 | * |
---|
5 | 6 | * Based on arch/arm/include/asm/jump_label.h |
---|
6 | | - * |
---|
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. |
---|
10 | | - * |
---|
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. |
---|
15 | | - * |
---|
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/>. |
---|
18 | 7 | */ |
---|
19 | 8 | #ifndef __ASM_JUMP_LABEL_H |
---|
20 | 9 | #define __ASM_JUMP_LABEL_H |
---|
.. | .. |
---|
26 | 15 | |
---|
27 | 16 | #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE |
---|
28 | 17 | |
---|
29 | | -static __always_inline bool arch_static_branch(struct static_key *key, bool branch) |
---|
| 18 | +static __always_inline bool arch_static_branch(struct static_key *key, |
---|
| 19 | + bool branch) |
---|
30 | 20 | { |
---|
31 | | - asm_volatile_goto("1: nop\n\t" |
---|
32 | | - ".pushsection __jump_table, \"aw\"\n\t" |
---|
33 | | - ".align 3\n\t" |
---|
34 | | - ".quad 1b, %l[l_yes], %c0\n\t" |
---|
35 | | - ".popsection\n\t" |
---|
| 21 | + asm_volatile_goto( |
---|
| 22 | + "1: nop \n\t" |
---|
| 23 | + " .pushsection __jump_table, \"aw\" \n\t" |
---|
| 24 | + " .align 3 \n\t" |
---|
| 25 | + " .long 1b - ., %l[l_yes] - . \n\t" |
---|
| 26 | + " .quad %c0 - . \n\t" |
---|
| 27 | + " .popsection \n\t" |
---|
36 | 28 | : : "i"(&((char *)key)[branch]) : : l_yes); |
---|
37 | 29 | |
---|
38 | 30 | return false; |
---|
.. | .. |
---|
40 | 32 | return true; |
---|
41 | 33 | } |
---|
42 | 34 | |
---|
43 | | -static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) |
---|
| 35 | +static __always_inline bool arch_static_branch_jump(struct static_key *key, |
---|
| 36 | + bool branch) |
---|
44 | 37 | { |
---|
45 | | - asm_volatile_goto("1: b %l[l_yes]\n\t" |
---|
46 | | - ".pushsection __jump_table, \"aw\"\n\t" |
---|
47 | | - ".align 3\n\t" |
---|
48 | | - ".quad 1b, %l[l_yes], %c0\n\t" |
---|
49 | | - ".popsection\n\t" |
---|
| 38 | + asm_volatile_goto( |
---|
| 39 | + "1: b %l[l_yes] \n\t" |
---|
| 40 | + " .pushsection __jump_table, \"aw\" \n\t" |
---|
| 41 | + " .align 3 \n\t" |
---|
| 42 | + " .long 1b - ., %l[l_yes] - . \n\t" |
---|
| 43 | + " .quad %c0 - . \n\t" |
---|
| 44 | + " .popsection \n\t" |
---|
50 | 45 | : : "i"(&((char *)key)[branch]) : : l_yes); |
---|
51 | 46 | |
---|
52 | 47 | return false; |
---|
53 | 48 | l_yes: |
---|
54 | 49 | return true; |
---|
55 | 50 | } |
---|
56 | | - |
---|
57 | | -typedef u64 jump_label_t; |
---|
58 | | - |
---|
59 | | -struct jump_entry { |
---|
60 | | - jump_label_t code; |
---|
61 | | - jump_label_t target; |
---|
62 | | - jump_label_t key; |
---|
63 | | -}; |
---|
64 | 51 | |
---|
65 | 52 | #endif /* __ASSEMBLY__ */ |
---|
66 | 53 | #endif /* __ASM_JUMP_LABEL_H */ |
---|