hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/s390/kernel/jump_label.c
....@@ -15,29 +15,24 @@
1515 s32 offset;
1616 } __packed;
1717
18
-struct insn_args {
19
- struct jump_entry *entry;
20
- enum jump_label_type type;
21
-};
22
-
2318 static void jump_label_make_nop(struct jump_entry *entry, struct insn *insn)
2419 {
25
- /* brcl 0,0 */
20
+ /* brcl 0,offset */
2621 insn->opcode = 0xc004;
27
- insn->offset = 0;
22
+ insn->offset = (jump_entry_target(entry) - jump_entry_code(entry)) >> 1;
2823 }
2924
3025 static void jump_label_make_branch(struct jump_entry *entry, struct insn *insn)
3126 {
3227 /* brcl 15,offset */
3328 insn->opcode = 0xc0f4;
34
- insn->offset = (entry->target - entry->code) >> 1;
29
+ insn->offset = (jump_entry_target(entry) - jump_entry_code(entry)) >> 1;
3530 }
3631
3732 static void jump_label_bug(struct jump_entry *entry, struct insn *expected,
3833 struct insn *new)
3934 {
40
- unsigned char *ipc = (unsigned char *)entry->code;
35
+ unsigned char *ipc = (unsigned char *)jump_entry_code(entry);
4136 unsigned char *ipe = (unsigned char *)expected;
4237 unsigned char *ipn = (unsigned char *)new;
4338
....@@ -57,6 +52,7 @@
5752 enum jump_label_type type,
5853 int init)
5954 {
55
+ void *code = (void *)jump_entry_code(entry);
6056 struct insn old, new;
6157
6258 if (type == JUMP_LABEL_JMP) {
....@@ -67,32 +63,24 @@
6763 jump_label_make_nop(entry, &new);
6864 }
6965 if (init) {
70
- if (memcmp((void *)entry->code, &orignop, sizeof(orignop)))
66
+ if (memcmp(code, &orignop, sizeof(orignop)))
7167 jump_label_bug(entry, &orignop, &new);
7268 } else {
73
- if (memcmp((void *)entry->code, &old, sizeof(old)))
69
+ if (memcmp(code, &old, sizeof(old)))
7470 jump_label_bug(entry, &old, &new);
7571 }
76
- s390_kernel_write((void *)entry->code, &new, sizeof(new));
72
+ s390_kernel_write(code, &new, sizeof(new));
7773 }
7874
79
-static int __sm_arch_jump_label_transform(void *data)
75
+static void __jump_label_sync(void *dummy)
8076 {
81
- struct insn_args *args = data;
82
-
83
- __jump_label_transform(args->entry, args->type, 0);
84
- return 0;
8577 }
8678
8779 void arch_jump_label_transform(struct jump_entry *entry,
8880 enum jump_label_type type)
8981 {
90
- struct insn_args args;
91
-
92
- args.entry = entry;
93
- args.type = type;
94
-
95
- stop_machine_cpuslocked(__sm_arch_jump_label_transform, &args, NULL);
82
+ __jump_label_transform(entry, type, 0);
83
+ smp_call_function(__jump_label_sync, NULL, 1);
9684 }
9785
9886 void arch_jump_label_transform_static(struct jump_entry *entry,