Skip to content

Commit

Permalink
x86/alternative: Convert the asm ALTERNATIVE() macro
Browse files Browse the repository at this point in the history
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
bp3tk0v committed Jun 11, 2024
1 parent 9369412 commit a6c7a6a
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions arch/x86/include/asm/alternative.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,24 +422,6 @@ void nop_func(void);
* @newinstr. ".skip" directive takes care of proper instruction padding
* in case @newinstr is longer than @oldinstr.
*/
.macro ALTERNATIVE oldinstr, newinstr, ft_flags
140:
\oldinstr
141:
.skip -(((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)),0x90
142:

.pushsection .altinstructions,"a"
altinstr_entry 140b,143f,\ft_flags,142b-140b,144f-143f
.popsection

.pushsection .altinstr_replacement,"ax"
143:
\newinstr
144:
.popsection
.endm

#define __N_ALTERNATIVE(oldinst, newinst, flag) \
740: \
oldinst ; \
Expand All @@ -455,12 +437,10 @@ void nop_func(void);
744: \
.popsection ;


.macro N_ALTERNATIVE oldinstr, newinstr, ft_flags
.macro ALTERNATIVE oldinstr, newinstr, ft_flags
__N_ALTERNATIVE(\oldinstr, \newinstr, \ft_flags)
.endm


#define old_len 141b-140b
#define new_len1 144f-143f
#define new_len2 145f-144f
Expand Down

0 comments on commit a6c7a6a

Please sign in to comment.