Skip to content

Commit 1c1ed47

Browse files
committed
x86/alternatives: Add macro comments
... so that when one stares at the .s output, one can find her way around the resulting asm magic. With it, ALTERNATIVE looks like this now: # ALT: oldnstr 661: ... 662: # ALT: padding .skip ... 663: .pushsection .altinstructions,"a" ... .popsection .pushsection .altinstr_replacement, "ax" # ALT: replacement 1 6641: ... 6651: .popsection Merge __OLDINSTR() into OLDINSTR(), while at it. No functional changes. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: X86 ML <x86@kernel.org> Link: https://lkml.kernel.org/r/20181211222326.14581-2-bp@alien8.de
1 parent 1c7fc5c commit 1c1ed47

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

arch/x86/include/asm/alternative.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,12 @@ static inline int alternatives_text_reserved(void *start, void *end)
9494
#define alt_total_slen alt_end_marker"b-661b"
9595
#define alt_rlen(num) e_replacement(num)"f-"b_replacement(num)"f"
9696

97-
#define __OLDINSTR(oldinstr, num) \
97+
#define OLDINSTR(oldinstr, num) \
98+
"# ALT: oldnstr\n" \
9899
"661:\n\t" oldinstr "\n662:\n" \
100+
"# ALT: padding\n" \
99101
".skip -(((" alt_rlen(num) ")-(" alt_slen ")) > 0) * " \
100-
"((" alt_rlen(num) ")-(" alt_slen ")),0x90\n"
101-
102-
#define OLDINSTR(oldinstr, num) \
103-
__OLDINSTR(oldinstr, num) \
102+
"((" alt_rlen(num) ")-(" alt_slen ")),0x90\n" \
104103
alt_end_marker ":\n"
105104

106105
/*
@@ -116,7 +115,9 @@ static inline int alternatives_text_reserved(void *start, void *end)
116115
* additionally longer than the first replacement alternative.
117116
*/
118117
#define OLDINSTR_2(oldinstr, num1, num2) \
118+
"# ALT: oldinstr2\n" \
119119
"661:\n\t" oldinstr "\n662:\n" \
120+
"# ALT: padding2\n" \
120121
".skip -((" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")) > 0) * " \
121122
"(" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")), 0x90\n" \
122123
alt_end_marker ":\n"
@@ -129,8 +130,9 @@ static inline int alternatives_text_reserved(void *start, void *end)
129130
" .byte " alt_rlen(num) "\n" /* replacement len */ \
130131
" .byte " alt_pad_len "\n" /* pad len */
131132

132-
#define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \
133-
b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"
133+
#define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \
134+
"# ALT: replacement " #num "\n" \
135+
b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n"
134136

135137
/* alternative assembly primitive: */
136138
#define ALTERNATIVE(oldinstr, newinstr, feature) \

0 commit comments

Comments
 (0)