forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/arch/arm64/include/asm/jump_label.h
....@@ -1,20 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2013 Huawei Ltd.
34 * Author: Jiang Liu <liuj97@gmail.com>
45 *
56 * 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/>.
187 */
198 #ifndef __ASM_JUMP_LABEL_H
209 #define __ASM_JUMP_LABEL_H
....@@ -26,13 +15,16 @@
2615
2716 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
2817
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)
3020 {
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"
3628 : : "i"(&((char *)key)[branch]) : : l_yes);
3729
3830 return false;
....@@ -40,27 +32,22 @@
4032 return true;
4133 }
4234
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)
4437 {
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"
5045 : : "i"(&((char *)key)[branch]) : : l_yes);
5146
5247 return false;
5348 l_yes:
5449 return true;
5550 }
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
-};
6451
6552 #endif /* __ASSEMBLY__ */
6653 #endif /* __ASM_JUMP_LABEL_H */