On Fri, Jan 5, 2018 at 2:00 PM, Woodhouse, David <[email protected]> wrote:
> +.macro RETPOLINE_JMP reg:req
> +       call    1112f
> +1111:  lfence
> +       jmp     1111b
> +1112:  mov     %\reg, (%_ASM_SP)
> +       ret
> +.endm
> +
> +.macro RETPOLINE_CALL reg:req
> +       jmp     1113f
> +1110:  RETPOLINE_JMP \reg
> +1113:  call    1110b
> +.endm

Why do these still force a register name?

Is it because this is the only user?

> index 2a4b1f09eb84..90d9a1589a54 100644
> --- a/arch/x86/lib/retpoline.S
> +++ b/arch/x86/lib/retpoline.S
> @@ -6,19 +6,14 @@
>  #include <asm/cpufeatures.h>
>  #include <asm/alternative-asm.h>
>  #include <asm/export.h>
> +#include <asm/nospec-branch.h>
>
> -.macro THUNK sp reg
> +.macro THUNK reg
>         .section .text.__x86.indirect_thunk.\reg
>
>  ENTRY(__x86.indirect_thunk.\reg)
>         CFI_STARTPROC
> -       ALTERNATIVE_2 "call 2f", __stringify(lfence;jmp *%\reg), 
> X86_FEATURE_K8, __stringify(jmp *%\reg), X86_FEATURE_NO_RETPOLINE
> -1:
> -       lfence
> -       jmp     1b
> -2:
> -       mov     %\reg, (%\sp)
> -       ret
> +       NOSPEC_JMP \reg
>         CFI_ENDPROC

Can we just move those macros into retpoline.S because using them
outside that shouldn't happen?

                 Linus

Reply via email to