Messages in this thread | | | Date | Wed, 10 Mar 2021 15:27:54 +0100 | From | Borislav Petkov <> | Subject | Re: [PATCH v6 05/12] x86/alternative: support ALTERNATIVE_TERNARY |
| |
On Tue, Mar 09, 2021 at 02:48:06PM +0100, Juergen Gross wrote: > diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h > index 89889618ae01..4fb844e29d26 100644 > --- a/arch/x86/include/asm/alternative.h > +++ b/arch/x86/include/asm/alternative.h > @@ -178,6 +178,9 @@ static inline int alternatives_text_reserved(void *start, void *end) > ALTINSTR_REPLACEMENT(newinstr2, 2) \ > ".popsection\n" > > +#define ALTERNATIVE_TERNARY(oldinstr, feature, newinstr1, newinstr2) \ > + ALTERNATIVE_2(oldinstr, newinstr2, X86_FEATURE_ALWAYS, newinstr1, feature)
Make that:
/* * If @feature is set, patch @newinstr_yes, else @newinstr_no */ #define ALTERNATIVE_TERNARY(oldinstr, feature, newinstr_yes, newinstr_no) \ ALTERNATIVE_2(oldinstr, newinstr_no, X86_FEATURE_ALWAYS, newinstr_yes, feature)
and in alternative-asm.h too pls.
Regardless, this looks nice! :)
Thx.
-- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
| |