On Thu, 2018-01-25 at 12:41 +0100, Borislav Petkov wrote: > > > +static inline void indirect_branch_prediction_barrier(void) > > +{ > > +     asm volatile(ALTERNATIVE("", > > +                              "movl %[msr], %%ecx\n\t" > > +                              "movl %[val], %%eax\n\t" > > +                              "movl $0, %%edx\n\t" > > +                              "wrmsr", > > +                              X86_FEATURE_IBPB) > > +                  : : [msr] "i" (MSR_IA32_PRED_CMD), > > +                      [val] "i" (PRED_CMD_IBPB) > > +                  : "eax", "ecx", "edx", "memory"); > > Lemme paste my simplification suggestion from the other day: > > "Btw, we can simplify this a bit by dropping the inputs and marking the 3 > GPRs as clobbered: > >         alternative_input("", >                           "mov $0x49, %%ecx\n\t" >                           "mov $1, %%eax\n\t" >                           "xor %%edx, %%edx\n\t" >                           "wrmsr\n\t", >                           X86_FEATURE_IBPB, >                           ASM_NO_INPUT_CLOBBER("eax", "ecx", "edx", "memory")); Yeah, I saw that; sorry for not replying explicitly. I did already do the explicit clobbers now you reminded me how to do them, but I elected not to use ASM_NO_INPUT_CLOBBER() because on balance, losing the MSR_IA32_PRED_CMD / PRED_CMD_IBPB definitions and having to hard-code the numbers was not so much of a win.