Skip to content

Commit 4afeb67

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/alternatives: use instructions instead of byte patterns
Use readable nop instructions within the code which generates the padding areas, instead of unreadable byte patterns. The generated code is identical. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent f09354f commit 4afeb67

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

arch/s390/include/asm/alternative-asm.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@
3737
* a 2-byte nop if the size of the area is not divisible by 6.
3838
*/
3939
.macro alt_pad_fill bytes
40-
.fill ( \bytes ) / 6, 6, 0xc0040000
41-
.fill ( \bytes ) % 6 / 4, 4, 0x47000000
42-
.fill ( \bytes ) % 6 % 4 / 2, 2, 0x0700
40+
.rept ( \bytes ) / 6
41+
jgnop .
42+
.endr
43+
.rept ( \bytes ) % 6 / 4
44+
nop
45+
.endr
46+
.rept ( \bytes ) % 6 % 4 / 2
47+
nopr
48+
.endr
4349
.endm
4450

4551
/*

arch/s390/include/asm/alternative.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,18 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
7171
".if " oldinstr_pad_len(num) " > 6\n" \
7272
"\tjg " e_oldinstr_pad_end "f\n" \
7373
"6620:\n" \
74-
"\t.fill (" oldinstr_pad_len(num) " - (6620b-662b)) / 2, 2, 0x0700\n" \
74+
"\t.rept (" oldinstr_pad_len(num) " - (6620b-662b)) / 2\n" \
75+
"\tnopr\n" \
7576
".else\n" \
76-
"\t.fill " oldinstr_pad_len(num) " / 6, 6, 0xc0040000\n" \
77-
"\t.fill " oldinstr_pad_len(num) " %% 6 / 4, 4, 0x47000000\n" \
78-
"\t.fill " oldinstr_pad_len(num) " %% 6 %% 4 / 2, 2, 0x0700\n" \
77+
"\t.rept " oldinstr_pad_len(num) " / 6\n" \
78+
"\t.jgnop .\n" \
79+
"\t.endr\n" \
80+
"\t.rept " oldinstr_pad_len(num) " %% 6 / 4\n" \
81+
"\tnop\n" \
82+
"\t.endr\n" \
83+
"\t.rept " oldinstr_pad_len(num) " %% 6 %% 4 / 2\n" \
84+
"\tnopr\n" \
85+
".endr\n" \
7986
".endif\n"
8087

8188
#define OLDINSTR(oldinstr, num) \

0 commit comments

Comments
 (0)