.. | .. |
---|
15 | 15 | s32 offset; |
---|
16 | 16 | } __packed; |
---|
17 | 17 | |
---|
18 | | -struct insn_args { |
---|
19 | | - struct jump_entry *entry; |
---|
20 | | - enum jump_label_type type; |
---|
21 | | -}; |
---|
22 | | - |
---|
23 | 18 | static void jump_label_make_nop(struct jump_entry *entry, struct insn *insn) |
---|
24 | 19 | { |
---|
25 | | - /* brcl 0,0 */ |
---|
| 20 | + /* brcl 0,offset */ |
---|
26 | 21 | insn->opcode = 0xc004; |
---|
27 | | - insn->offset = 0; |
---|
| 22 | + insn->offset = (jump_entry_target(entry) - jump_entry_code(entry)) >> 1; |
---|
28 | 23 | } |
---|
29 | 24 | |
---|
30 | 25 | static void jump_label_make_branch(struct jump_entry *entry, struct insn *insn) |
---|
31 | 26 | { |
---|
32 | 27 | /* brcl 15,offset */ |
---|
33 | 28 | insn->opcode = 0xc0f4; |
---|
34 | | - insn->offset = (entry->target - entry->code) >> 1; |
---|
| 29 | + insn->offset = (jump_entry_target(entry) - jump_entry_code(entry)) >> 1; |
---|
35 | 30 | } |
---|
36 | 31 | |
---|
37 | 32 | static void jump_label_bug(struct jump_entry *entry, struct insn *expected, |
---|
38 | 33 | struct insn *new) |
---|
39 | 34 | { |
---|
40 | | - unsigned char *ipc = (unsigned char *)entry->code; |
---|
| 35 | + unsigned char *ipc = (unsigned char *)jump_entry_code(entry); |
---|
41 | 36 | unsigned char *ipe = (unsigned char *)expected; |
---|
42 | 37 | unsigned char *ipn = (unsigned char *)new; |
---|
43 | 38 | |
---|
.. | .. |
---|
57 | 52 | enum jump_label_type type, |
---|
58 | 53 | int init) |
---|
59 | 54 | { |
---|
| 55 | + void *code = (void *)jump_entry_code(entry); |
---|
60 | 56 | struct insn old, new; |
---|
61 | 57 | |
---|
62 | 58 | if (type == JUMP_LABEL_JMP) { |
---|
.. | .. |
---|
67 | 63 | jump_label_make_nop(entry, &new); |
---|
68 | 64 | } |
---|
69 | 65 | if (init) { |
---|
70 | | - if (memcmp((void *)entry->code, &orignop, sizeof(orignop))) |
---|
| 66 | + if (memcmp(code, &orignop, sizeof(orignop))) |
---|
71 | 67 | jump_label_bug(entry, &orignop, &new); |
---|
72 | 68 | } else { |
---|
73 | | - if (memcmp((void *)entry->code, &old, sizeof(old))) |
---|
| 69 | + if (memcmp(code, &old, sizeof(old))) |
---|
74 | 70 | jump_label_bug(entry, &old, &new); |
---|
75 | 71 | } |
---|
76 | | - s390_kernel_write((void *)entry->code, &new, sizeof(new)); |
---|
| 72 | + s390_kernel_write(code, &new, sizeof(new)); |
---|
77 | 73 | } |
---|
78 | 74 | |
---|
79 | | -static int __sm_arch_jump_label_transform(void *data) |
---|
| 75 | +static void __jump_label_sync(void *dummy) |
---|
80 | 76 | { |
---|
81 | | - struct insn_args *args = data; |
---|
82 | | - |
---|
83 | | - __jump_label_transform(args->entry, args->type, 0); |
---|
84 | | - return 0; |
---|
85 | 77 | } |
---|
86 | 78 | |
---|
87 | 79 | void arch_jump_label_transform(struct jump_entry *entry, |
---|
88 | 80 | enum jump_label_type type) |
---|
89 | 81 | { |
---|
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); |
---|
96 | 84 | } |
---|
97 | 85 | |
---|
98 | 86 | void arch_jump_label_transform_static(struct jump_entry *entry, |
---|