On Thu, 2018-01-25 at 12:50 +0100, Borislav Petkov wrote:
> On Thu, Jan 25, 2018 at 11:47:35AM +0000, David Woodhouse wrote:
> > 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.
> 
> and I'm thinking exactly the opposite: if an alternative can lose a
> bunch of inputs which don't change, then that's a good thing.

They're immediates, not registers. So it's like the first example in...

void foo(void)
{
        asm volatile ("alternative me away; my numbers are %0 and %1\n"
                      :: "i" (3456), "i" (1234));

        asm volatile ("alternative me away; GCC already loaded regs %0 and %1\n"
                      :: "c" (3456), "a" (1234));
}

... which gives you...

foo:
.LFB0:
        .cfi_startproc
#APP
# 4 "foo.c" 1
        alternative me away; my numbers are $3456 and $1234

# 0 "" 2
#NO_APP
        movl    $1234, %eax
        movl    $3456, %ecx
#APP
# 7 "foo.c" 1
        alternative me away; GCC already loaded regs %ecx and %eax

# 0 "" 2
#NO_APP
        ret
        .cfi_endproc

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to